diff --git a/openshift/integration/koji/pipelines/templates/mbs-polling-pagure.yaml b/openshift/integration/koji/pipelines/templates/mbs-polling-pagure.yaml
index 9e5b377f..04221b52 100644
--- a/openshift/integration/koji/pipelines/templates/mbs-polling-pagure.yaml
+++ b/openshift/integration/koji/pipelines/templates/mbs-polling-pagure.yaml
@@ -90,6 +90,8 @@ objects:
jenkinsPipelineStrategy:
jenkinsfile: |-
// Don't use external Jenkinsfile here, or Jenkins will also poll on that repo and branch
+ library identifier: 'c3i@master', changelog: false,
+ retriever: modernSCM([$class: 'GitSCMSource', remote: 'https://pagure.io/c3i-library.git'])
pipeline {
agent {
kubernetes {
@@ -131,10 +133,12 @@ objects:
environment {
PIPELINE_NAMESPACE = readFile('/run/secrets/kubernetes.io/serviceaccount/namespace').trim()
PAGURE_URL = "${PAGURE_URL}"
+ PAGURE_API = "${env.PAGURE_URL}/api/0"
+ PAGURE_REPO_NAME = "${PAGURE_REPO_NAME}"
PAGURE_REPO_IS_FORK = "${PAGURE_REPO_IS_FORK}"
PAGURE_POLLING_FOR_PR = "${PAGURE_POLLING_FOR_PR}"
- PAGURE_REPO_HOME = "${env.PAGURE_URL}${env.PAGURE_REPO_IS_FORK == 'true' ? '/fork' : ''}/${PAGURE_REPO_NAME}"
- GIT_URL = "${env.PAGURE_URL}/${env.PAGURE_REPO_IS_FORK == 'true' ? 'forks/' : ''}${PAGURE_REPO_NAME}.git"
+ PAGURE_REPO_HOME = "${env.PAGURE_URL}${env.PAGURE_REPO_IS_FORK == 'true' ? '/fork' : ''}/${env.PAGURE_REPO_NAME}"
+ GIT_URL = "${env.PAGURE_URL}/${env.PAGURE_REPO_IS_FORK == 'true' ? 'forks/' : ''}${env.PAGURE_REPO_NAME}.git"
PREMERGE_JOB_NAME = "${PREMERGE_JOB_NAME}"
POSTMERGE_JOB_NAME = "${POSTMERGE_JOB_NAME}"
}
@@ -169,12 +173,20 @@ objects:
currentBuild.description = """${currentBuild.displayName}"""
} else if (env.PAGURE_POLLING_FOR_PR == 'true' && branch ==~ /^pull\/[0-9]+\/head$/) {
env.PR_NO = branch.split('/')[1]
- env.PR_URL = "${env.PAGURE_REPO_HOME}/pull-request/${env.PR_NO}"
- // To HTML syntax in build description, go to `Jenkins/Global Security/Markup Formatter` and select 'Safe HTML'.
- def pagureLink = """PR#${env.PR_NO}"""
- echo "Building PR #${env.PR_NO}: ${env.PR_URL}"
- currentBuild.displayName = "PR#${env.PR_NO}"
- currentBuild.description = pagureLink
+ def prInfo = withPagure {
+ it.getPR(env.PR_NO)
+ }
+ if (prInfo.status == 'Open') {
+ env.PR_URL = "${env.PAGURE_REPO_HOME}/pull-request/${env.PR_NO}"
+ // To HTML syntax in build description, go to `Jenkins/Global Security/Markup Formatter` and select 'Safe HTML'.
+ def pagureLink = """PR#${env.PR_NO}"""
+ echo "Building PR #${env.PR_NO}: ${env.PR_URL}"
+ currentBuild.displayName = "PR#${env.PR_NO}"
+ currentBuild.description = pagureLink
+ } else {
+ echo "Skipping PR#${env.PR_NO} because it is ${prInfo.status}"
+ env.SKIP = 'true'
+ }
} else { // This shouldn't happen.
error("Build is aborted due to unexpected polling trigger actions.")
}
@@ -209,6 +221,11 @@ objects:
}
}
stage('Build') {
+ when {
+ not {
+ environment name: 'SKIP', value: 'true'
+ }
+ }
steps {
script {
openshift.withCluster() {
@@ -231,3 +248,10 @@ objects:
}
}
}
+ def withPagure(args=[:], cl) {
+ args.apiUrl = env.PAGURE_API
+ args.repo = env.PAGURE_REPO_NAME
+ args.isFork = env.PAGURE_REPO_IS_FORK == 'true'
+ def pagureClient = pagure.client(args)
+ return cl(pagureClient)
+ }