fix(ci): add default deploy environment variables for bash-safe pipeline

This commit is contained in:
2026-03-06 16:08:50 +00:00
parent 6a09053ac3
commit d30a7d37b5

11
Jenkinsfile vendored
View File

@@ -1,8 +1,3 @@
def DEPLOY_SSH_CREDENTIAL_ID = env.DEPLOY_SSH_CREDENTIAL_ID ?: 'plesk-agency-deploy-key'
def APP_HOST = env.APP_HOST ?: '192.168.68.89'
def APP_USER = env.APP_USER ?: 'deploy'
def DEPLOY_PATH = env.DEPLOY_PATH ?: '/opt/plesk-agency-portal'
pipeline { pipeline {
// Build + deploy stages require Docker CLI/daemon access on the Jenkins node. // Build + deploy stages require Docker CLI/daemon access on the Jenkins node.
// Ensure this label maps to an agent with Docker installed and usable. // Ensure this label maps to an agent with Docker installed and usable.
@@ -12,6 +7,10 @@ pipeline {
REGISTRY_IMAGE = "plesk-agency-portal" REGISTRY_IMAGE = "plesk-agency-portal"
IMAGE_LATEST = "${REGISTRY_IMAGE}:latest" IMAGE_LATEST = "${REGISTRY_IMAGE}:latest"
IMAGE_BUILD = "${REGISTRY_IMAGE}:build-${BUILD_NUMBER}" IMAGE_BUILD = "${REGISTRY_IMAGE}:build-${BUILD_NUMBER}"
DEPLOY_SSH_CREDENTIAL_ID = "${env.DEPLOY_SSH_CREDENTIAL_ID ?: 'plesk-agency-deploy-key'}"
APP_HOST = "${env.APP_HOST ?: '192.168.68.89'}"
APP_USER = "${env.APP_USER ?: 'deploy'}"
DEPLOY_PATH = "${env.DEPLOY_PATH ?: '/opt/plesk-agency-portal'}"
} }
stages { stages {
@@ -74,7 +73,7 @@ pipeline {
stage('Deploy') { stage('Deploy') {
steps { steps {
withCredentials([sshUserPrivateKey( withCredentials([sshUserPrivateKey(
credentialsId: DEPLOY_SSH_CREDENTIAL_ID, credentialsId: "${env.DEPLOY_SSH_CREDENTIAL_ID}",
keyFileVariable: 'SSH_KEY' keyFileVariable: 'SSH_KEY'
)]) { )]) {
sh ''' sh '''