| 123456789101112131415161718192021222324252627282930313233 |
- def SVC = [prodDir: 'dining', deployName: 'dining']
- def sparseCheckoutProduShared() {
- checkout scm: [$class: 'GitSCM', branches: scm.branches,
- extensions: [[$class: 'CloneOption', depth: 1, shallow: true, noTags: true],
- [$class: 'SparseCheckoutPaths', sparseCheckoutPaths: [[path: 'docs/jenkins/produ/_shared/']]]],
- userRemoteConfigs: scm.userRemoteConfigs]
- }
- pipeline {
- agent any
- options { buildDiscarder(logRotator(numToKeepStr: '15')); timestamps(); timeout(time: 45, unit: 'MINUTES') }
- parameters {
- string(name: 'SOURCE_TAG', defaultValue: 'uat-latest', trim: true,
- description: 'Harbor UAT tag,默认 uat-latest;回滚填 uat-build-<N>')
- string(name: 'TARGET_TAG', defaultValue: '', trim: true)
- string(name: 'HARBOR_REGISTRY', defaultValue: '39.105.153.68', trim: true)
- string(name: 'HARBOR_PROJECT', defaultValue: 'alien_cloud', trim: true)
- choice(name: 'DEPLOY_STRATEGY', choices: ['rolling', 'canary', 'skip'])
- string(name: 'CANARY_WEIGHT', defaultValue: '10', trim: true)
- string(name: 'K8S_NAMESPACE', defaultValue: 'alien-produ', trim: true)
- booleanParam(name: 'DRY_RUN', defaultValue: false)
- }
- environment { HARBOR_CREDENTIALS = 'harbor-robot-alien'; KUBECONFIG_CREDENTIALS = 'ack-kubeconfig-alien' }
- stages {
- stage('Promote image & Deploy ACK') {
- steps { script {
- sparseCheckoutProduShared()
- def k8s = load 'docs/jenkins/produ/_shared/k8s-produ-lib.groovy'
- k8s.promoteOneServiceToAck(this, SVC)
- echo ">>> dining: ${env.IMAGE_REF}"
- } }
- }
- }
- }
|