-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
23 lines (22 loc) · 1.11 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
pipeline {
agent any
stages {
stage('Update Git') {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
withCredentials([usernamePassword(credentialsId: 'github-credentials', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh "git config user.email ${GIT_EMAIL}"
sh "git config user.name ${GIT_NAME}"
sh "cat deployment.yaml"
sh "sed -i 's+image:.*+image: ${DOCKER_IMAGE}+' deployment.yaml"
sh "cat deployment.yaml"
sh "git add ."
sh "git commit -m 'Feito por Jenkins através do Job conversao-temperatura-manifest-update: ${env.BUILD_NUMBER}'"
// Para interpolação de variáveis sensíveis deve-se usar aspas simples
sh 'git push https://$GIT_USERNAME:[email protected]/$GIT_USERNAME/conversao-temperatura-kubemanifest.git HEAD:main'
}
}
}
}
}
}