def pushObject()

in jenkins-pipeline-shared-libraries/vars/githubscm.groovy [347:359]


def pushObject(String remote, String object, String credentialsId = 'kie-ci') {
    try {
        withCredentials([usernamePassword(credentialsId: "${credentialsId}", usernameVariable: 'GITHUB_USER', passwordVariable: 'GITHUB_TOKEN')]) {
            setUserConfig("${GITHUB_USER}")
            sh("git config --local credential.helper \"!f() { echo username=\\$GITHUB_USER; echo password=\\$GITHUB_TOKEN; }; f\"")
            sh("git push ${remote} ${object}")
        }
    } catch (Exception e) {
        println "[ERROR] Couldn't push object '${object}' to ${remote}."
        throw e
    }
    println "[INFO] Pushed object '${object}' to ${remote}."
}