Skip to content

Instantly share code, notes, and snippets.


domdorn/Jenkinsfile Secret

Created Mar 12, 2021
What would you like to do?
Jenkins + HTTPS Git + .netrc
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 'Jenkins CI'"
sh "git config --local ''"
sh "git remote set-url origin"
sh 'echo "machine\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