Use HTTPS Git remote in Jenkins pipeline checkout steps
This commit is contained in:
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@@ -24,25 +24,22 @@ pipeline {
|
|||||||
stages {
|
stages {
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
steps {
|
steps {
|
||||||
withCredentials([sshUserPrivateKey(credentialsId: 'gitea-ssh', keyFileVariable: 'GIT_KEYFILE')]) {
|
|
||||||
sh '''
|
sh '''
|
||||||
export GIT_SSH_COMMAND="ssh -i $GIT_KEYFILE -o StrictHostKeyChecking=accept-new"
|
|
||||||
if [ -d .git ]; then
|
if [ -d .git ]; then
|
||||||
if git remote get-url origin >/dev/null 2>&1; then
|
if git remote get-url origin >/dev/null 2>&1; then
|
||||||
git remote set-url origin ssh://git@git.mandelblog.com:2222/salt/mandelstudio.git
|
git remote set-url origin https://git.mandelblog.com/salt/mandelstudio.git
|
||||||
else
|
else
|
||||||
git remote add origin ssh://git@git.mandelblog.com:2222/salt/mandelstudio.git
|
git remote add origin https://git.mandelblog.com/salt/mandelstudio.git
|
||||||
fi
|
fi
|
||||||
git fetch --tags --force --progress origin +refs/heads/master:refs/remotes/origin/master
|
git fetch --tags --force --progress origin +refs/heads/master:refs/remotes/origin/master
|
||||||
else
|
else
|
||||||
git clone ssh://git@git.mandelblog.com:2222/salt/mandelstudio.git .
|
git clone https://git.mandelblog.com/salt/mandelstudio.git .
|
||||||
git fetch --tags --force --progress origin +refs/heads/master:refs/remotes/origin/master
|
git fetch --tags --force --progress origin +refs/heads/master:refs/remotes/origin/master
|
||||||
fi
|
fi
|
||||||
git checkout -f refs/remotes/origin/master
|
git checkout -f refs/remotes/origin/master
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
@@ -232,18 +229,16 @@ PY
|
|||||||
timeout(time: 10, unit: 'MINUTES')
|
timeout(time: 10, unit: 'MINUTES')
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
withCredentials([sshUserPrivateKey(credentialsId: 'gitea-ssh', keyFileVariable: 'GIT_KEYFILE')]) {
|
|
||||||
sh '''
|
sh '''
|
||||||
export GIT_SSH_COMMAND="ssh -i $GIT_KEYFILE -o StrictHostKeyChecking=accept-new"
|
|
||||||
if [ -d .git ]; then
|
if [ -d .git ]; then
|
||||||
if git remote get-url origin >/dev/null 2>&1; then
|
if git remote get-url origin >/dev/null 2>&1; then
|
||||||
git remote set-url origin ssh://git@git.mandelblog.com:2222/salt/mandelstudio.git
|
git remote set-url origin https://git.mandelblog.com/salt/mandelstudio.git
|
||||||
else
|
else
|
||||||
git remote add origin ssh://git@git.mandelblog.com:2222/salt/mandelstudio.git
|
git remote add origin https://git.mandelblog.com/salt/mandelstudio.git
|
||||||
fi
|
fi
|
||||||
git fetch --tags --force --progress origin +refs/heads/master:refs/remotes/origin/master
|
git fetch --tags --force --progress origin +refs/heads/master:refs/remotes/origin/master
|
||||||
else
|
else
|
||||||
git clone ssh://git@git.mandelblog.com:2222/salt/mandelstudio.git .
|
git clone https://git.mandelblog.com/salt/mandelstudio.git .
|
||||||
git fetch --tags --force --progress origin +refs/heads/master:refs/remotes/origin/master
|
git fetch --tags --force --progress origin +refs/heads/master:refs/remotes/origin/master
|
||||||
fi
|
fi
|
||||||
git checkout -f refs/remotes/origin/master
|
git checkout -f refs/remotes/origin/master
|
||||||
@@ -251,7 +246,6 @@ PY
|
|||||||
chmod +x scripts/run_remote_multilingual_audit.sh
|
chmod +x scripts/run_remote_multilingual_audit.sh
|
||||||
./scripts/run_remote_multilingual_audit.sh
|
./scripts/run_remote_multilingual_audit.sh
|
||||||
'''
|
'''
|
||||||
}
|
|
||||||
script {
|
script {
|
||||||
int status = sh(script: 'python3 scripts/multilingual_audit_ci.py --json artifacts/multilingual-audit.json', returnStatus: true)
|
int status = sh(script: 'python3 scripts/multilingual_audit_ci.py --json artifacts/multilingual-audit.json', returnStatus: true)
|
||||||
if (status == 2) {
|
if (status == 2) {
|
||||||
|
|||||||
Reference in New Issue
Block a user