diff --git a/Jenkinsfile b/Jenkinsfile index 79117d0..140b0f0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,6 +47,9 @@ pipeline { stage('Deploy via SSH') { steps { + script { + env.DEPLOY_BRANCH = env.BRANCH_NAME ?: 'main' + } sshagent(credentials: ['deploy-ssh-key']) { sh """ ssh -o StrictHostKeyChecking=no ${env.DEPLOY_USER}@${env.DEPLOY_HOST} << 'DEPLOY_EOF' @@ -56,7 +59,7 @@ pipeline { # Clone or pull the repo (contains docker-compose.yml) if [ -d .git ]; then git fetch origin - git reset --hard origin/${env.BRANCH_NAME} + git reset --hard origin/${env.DEPLOY_BRANCH} else git clone ${env.GIT_REPO_URL} . fi