ci: serialize registry-based environment deployments

This commit is contained in:
2026-08-22 12:07:35 +08:00
parent 0f296e016e
commit fd1c582d45
3 changed files with 37 additions and 6 deletions
+8 -1
View File
@@ -163,6 +163,8 @@ pipeline {
}
steps {
script {
String deployLock = "firstleg-${params.ENVIRONMENT}-deploy"
lock(resource: deployLock, inversePrecedence: true) {
boolean development = params.ENVIRONMENT == 'development'
boolean testTargetIsLocal = ['master', 'built-in'].contains(env.NODE_NAME) ||
['master', 'built-in'].any { label -> env.NODE_LABELS?.tokenize()?.contains(label) }
@@ -189,10 +191,15 @@ pipeline {
"TARGET_SSH_KNOWN_HOSTS=${remoteKnownHosts}",
"TARGET_DEPLOY_DIR=${remoteDir}"
]) {
withCredentials([file(credentialsId: credentialId, variable: 'DEPLOY_ENV_FILE')]) {
withCredentials([
file(credentialsId: credentialId, variable: 'DEPLOY_ENV_FILE'),
usernamePassword(credentialsId: env.REGISTRY_CREDENTIALS,
usernameVariable: 'REGISTRY_USER', passwordVariable: 'REGISTRY_PASSWORD')
]) {
sh "sh deploy/scripts/deploy-built-service.sh '${params.ENVIRONMENT}' '${env.RESOLVED_IMAGE_REPOSITORY}' '${env.RESOLVED_IMAGE_TAG}' '${env.RESOLVED_SERVICE}' \"\$DEPLOY_ENV_FILE\""
}
}
}
}
}
}