-
-
Save domdorn/5f8a8d6047f936653922091db453d4d0 to your computer and use it in GitHub Desktop.
Jenkins + HTTPS Git + .netrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
environment { | |
JENKINS_GIT = credentials('jenkins_svc-git.credentials') | |
} | |
…. | |
stage('Deploy to TEST') { | |
when { | |
branch 'master' | |
expression { | |
input message: 'Deploy to test system?' | |
return true | |
} | |
} | |
options { | |
timeout(time: 10, unit: 'MINUTES') | |
} | |
steps { | |
script { | |
sh "git config --local user.name 'Jenkins CI'" | |
sh "git config --local user.email 'jenkins@acme.com'" | |
sh "git remote set-url origin https://srv.acme.com/bitbucket/scm/proj/repo.git" | |
sh 'echo "machine srv.acme.com\nlogin ${JENKINS_GIT_USR}\npassword ${JENKINS_GIT_PSW}" > .netrc; chmod 600 ./.netrc; ' | |
sh "HOME=`pwd` git push --tags" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment