Jenkins automatic push on external repository after pipeline complete

7 views
Skip to first unread message

Francesco Sisca

unread,
May 2, 2018, 6:02:15 AM5/2/18
to Jenkins Users
Hello everyone. I have a question for you.

At the moment, I and my team works on a staging repository. Every project have a Jenkins Job with declarative Pipeline. Our target is:

When pipeline complete correctly all steps, it can push on production repository all code?

i'm try with a simple step (on example repository):

this is Jenkinsfile on Staging repository (testSubTree it's staging name).

pipeline {
    agent any

    stages {
        stage('push on master prod'){
        steps{
        sh 'git push prod'
        }
        }
    }
}

when

[centos@cula03up TestAutocommitJenkins]$ sudo git remote -v
origin  xxxx/HO_staging/testSubTree.git (fetch)
origin  xxxx/HO_staging/testSubTree.git (push)
prod    xxxx/HO_production/testSubTree.git (fetch)
prod    xxxx/HO_production/testSubTree.git (push)


but doesn't work... and I don't get any errors, simply my production repository isn't update
Reply all
Reply to author
Forward
0 new messages