I want to tag the current git changeset and push the tag from inside the Jenkinsfile. If the tag already exists it must be replaced.
I want to use this logic in orde
I want to share my Jenkins Pipeline Setup and my solution to publish changes/tags to git repo via SSH (While Git Publish Support is under development). Please check it out for more info, any improvement ideas are welcome.
In short you just add file git_push_ssh.groovy
to your project and call method pushSSH()
from Jenkinsfile like this:
env.BRANCH_NAME = "mycoolbranch"// BRANCH_NAME is predefined in multibranch pipeline job
env.J_GIT_CONFIG = "true"
env.J_USERNAME = "Jenkins CI"
env.J_EMAIL = "jenkins-ci@example.com"
env.J_CREDS_IDS = '02aa92ec-593e-4a90-ac85-3f43a06cfae3' // Use credentials id from Jenkins
def gitLib = load "git_push_ssh.groovy"
...
gitLib.pushSSH(commitMsg: "Jenkins build #${env.BUILD_NUMBER}", tagName: "build-${env.BUILD_NUMBER}", files: "changelog.txt someotherfile.txt");