forked from jenkins-infra/kubernetes-management
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: separate updatecli to its own pipeline
- Loading branch information
1 parent
0c43391
commit c583c7a
Showing
2 changed files
with
64 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |