ci: serialize registry-based environment deployments

This commit is contained in:
2026-08-22 11:01:06 +08:00
parent ff9c1e2bc1
commit ba8a6b7832
3 changed files with 37 additions and 6 deletions
+8 -1
View File
@@ -167,6 +167,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) }
@@ -194,10 +196,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\""
}
}
}
}
}
}