update jenkinfile
This commit is contained in:
5
Jenkinsfile
vendored
5
Jenkinsfile
vendored
@@ -47,6 +47,9 @@ pipeline {
|
|||||||
|
|
||||||
stage('Deploy via SSH') {
|
stage('Deploy via SSH') {
|
||||||
steps {
|
steps {
|
||||||
|
script {
|
||||||
|
env.DEPLOY_BRANCH = env.BRANCH_NAME ?: 'main'
|
||||||
|
}
|
||||||
sshagent(credentials: ['deploy-ssh-key']) {
|
sshagent(credentials: ['deploy-ssh-key']) {
|
||||||
sh """
|
sh """
|
||||||
ssh -o StrictHostKeyChecking=no ${env.DEPLOY_USER}@${env.DEPLOY_HOST} << 'DEPLOY_EOF'
|
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)
|
# Clone or pull the repo (contains docker-compose.yml)
|
||||||
if [ -d .git ]; then
|
if [ -d .git ]; then
|
||||||
git fetch origin
|
git fetch origin
|
||||||
git reset --hard origin/${env.BRANCH_NAME}
|
git reset --hard origin/${env.DEPLOY_BRANCH}
|
||||||
else
|
else
|
||||||
git clone ${env.GIT_REPO_URL} .
|
git clone ${env.GIT_REPO_URL} .
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user