From c583c7a9ea415959a66c27e25b5bfcb5e8622807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Fri, 2 Sep 2022 18:32:21 +0200 Subject: [PATCH] feat: separate updatecli to its own pipeline Ref: https://github.com/jenkins-infra/helpdesk/issues/2778 --- Jenkinsfile_k8s | 60 ++++++++----------------------------------- Jenkinsfile_updatecli | 54 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 50 deletions(-) create mode 100644 Jenkinsfile_updatecli diff --git a/Jenkinsfile_k8s b/Jenkinsfile_k8s index 7a99c4937..a096ae799 100644 --- a/Jenkinsfile_k8s +++ b/Jenkinsfile_k8s @@ -14,56 +14,16 @@ pipeline { } stages { - stage('Chore Tasks') { - parallel { - stage('Dependency Management') { - agent { - kubernetes { - yamlFile 'PodTemplates.yaml' - } - } - environment { - AWS_ACCESS_KEY_ID = credentials('packer-aws-access-key-id') - AWS_SECRET_ACCESS_KEY = credentials('packer-aws-secret-access-key') - AWS_DEFAULT_REGION = 'us-east-2' - } - stages { - stage('Check Configuration Update') { - // Run updatecli's diff on both push and pull requests (in case a configuration change breaks updatecli) - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - updatecli(action: 'diff', cronTriggerExpression: cronExpr, - updatecliDockerImage: 'jenkinsciinfra/helmfile:2.4.61', // Tracked by updatecli - ) - } - } - } // stage - stage('Apply Configuration Update') { - when { - expression { env.BRANCH_IS_PRIMARY } - } - steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - updatecli(action: 'apply', cronTriggerExpression: cronExpr, - updatecliDockerImage: 'jenkinsciinfra/helmfile:2.4.61', // Tracked by updatecli, - ) - } - } - } // stage - } - } // stage 'Dependency Management' - stage('Yaml Lint') { - agent { - kubernetes { - yamlFile 'PodTemplates.yaml' - } - } - steps { - sh 'yamllint --config-file yamllint.config config' - } - } // stage 'Yaml Lint' - } // parallel - } // stage 'Chore Tasks + stage('Yaml Lint') { + agent { + kubernetes { + yamlFile 'PodTemplates.yaml' + } + } + steps { + sh 'yamllint --config-file yamllint.config config' + } + } // stage 'Yaml Lint' stage('Kubernetes Management Tasks') { matrix { axes { diff --git a/Jenkinsfile_updatecli b/Jenkinsfile_updatecli new file mode 100644 index 000000000..ffd421650 --- /dev/null +++ b/Jenkinsfile_updatecli @@ -0,0 +1,54 @@ +def cronExpr = env.BRANCH_IS_PRIMARY ? 'H/30 * * * *' : '' + +pipeline { + agent none + + options { + buildDiscarder(logRotator(numToKeepStr: '10')) + timeout(time: 30, unit: 'MINUTES') + disableConcurrentBuilds() + } + + triggers { + cron (cronExpr) + } + + stages { + stage('Updatecli') { + agent { + kubernetes { + yamlFile 'PodTemplates.yaml' + } + } + environment { + AWS_ACCESS_KEY_ID = credentials('packer-aws-access-key-id') + AWS_SECRET_ACCESS_KEY = credentials('packer-aws-secret-access-key') + AWS_DEFAULT_REGION = 'us-east-2' + } + stages { + stage('Check Configuration Update') { + // Run updatecli's diff on both push and pull requests (in case a configuration change breaks updatecli) + steps { + catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { + updatecli(action: 'diff', cronTriggerExpression: cronExpr, + updatecliDockerImage: 'jenkinsciinfra/helmfile:2.4.60', // Tracked by updatecli + ) + } + } + } // stage + stage('Apply Configuration Update') { + when { + expression { env.BRANCH_IS_PRIMARY } + } + steps { + catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { + updatecli(action: 'apply', cronTriggerExpression: cronExpr, + updatecliDockerImage: 'jenkinsciinfra/helmfile:2.4.60', // Tracked by updatecli, + ) + } + } + } // stage + } + } // stage 'Dependency Management' + } // stages +}