Skip to content

Instantly share code, notes, and snippets.

@eeganlf
Last active February 16, 2025 17:33
Show Gist options
  • Save eeganlf/85c9479772d90a165d08a32017a295c4 to your computer and use it in GitHub Desktop.
Save eeganlf/85c9479772d90a165d08a32017a295c4 to your computer and use it in GitHub Desktop.
node {
def app
stage('Clone repository') {
checkout scm
}
stage('Update GIT') {
script {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
withCredentials([usernamePassword(credentialsId: 'JenkinsGithubCreds', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh "git config user.email [email protected]"
sh "git config user.name yourGitHubUsername"
sh "cat vote-ui-deployment.yaml"
sh "sed -i 's+dockerHubUserName/vote.*+dockerHubUsername/vote:${DOCKERTAG}+g' vote-ui-deployment.yaml"
sh "cat vote-ui-deployment.yaml"
sh "git add ."
sh "git commit -m 'Done by Jenkins Job deployment: ${env.BUILD_NUMBER}'"
sh "git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${GIT_USERNAME}/vote-deploy.git HEAD:master"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment