def SVC = [prodDir: 'second', deployName: 'second'] 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-') 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 ">>> second: ${env.IMAGE_REF}" } } } } }