From 990f9fa984abc77a058bb95f0ac616e0ab5464f7 Mon Sep 17 00:00:00 2001 From: Yuxiang Zhu Date: Oct 19 2018 04:31:49 +0000 Subject: CI/CD - Auto update pipeline jobs on merge --- diff --git a/openshift/pipelines/templates/waiverdb-polling-pagure.yaml b/openshift/pipelines/templates/waiverdb-polling-pagure.yaml index 1fa2c7a..7d3a6fc 100644 --- a/openshift/pipelines/templates/waiverdb-polling-pagure.yaml +++ b/openshift/pipelines/templates/waiverdb-polling-pagure.yaml @@ -46,6 +46,10 @@ parameters: displayName: Name of Secret for updating Pagure pull-requests status value: 'pagure-api-key' required: false +- name: PIPELINE_UPDATE_JOBS_DIR + displayName: location of pipeline job definitions for auto update + value: jobs + required: false - name: MAIL_ENABLED displayName: Whether to send an email value: 'true' @@ -187,6 +191,33 @@ objects: } } } + stage('Update pipeline jobs') { + when { + expression { + return "${PIPELINE_UPDATE_JOBS_DIR}" && env.PAGURE_POLLING_FOR_PR == 'false' && env.GIT_BRANCH == "${PAGURE_POLLED_BRANCH}" + } + } + steps { + checkout([$class: 'GitSCM', + branches: [[name: env.GIT_BRANCH]], + userRemoteConfigs: [ + [ + name: 'origin', + url: env.GIT_URL, + refspec: '+refs/heads/*:refs/remotes/origin/* +refs/pull/*/head:refs/remotes/origin/pull/*/head', + ], + ], + extensions: [[$class: 'CleanBeforeCheckout']], + ]) + script { + dir('openshift/pipelines') { + sh ''' + make install JOBS_DIR="${PIPELINE_UPDATE_JOBS_DIR}" + ''' + } + } + } + } stage('Run Dev Build') { steps { script {