Skip to content

Commit

Permalink
feat: separate updatecli to its own pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
lemeurherveCB committed Sep 2, 2022
1 parent 0c43391 commit c583c7a
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 50 deletions.
60 changes: 10 additions & 50 deletions Jenkinsfile_k8s
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
54 changes: 54 additions & 0 deletions Jenkinsfile_updatecli
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit c583c7a

Please sign in to comment.