-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
30 lines (26 loc) · 1.31 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
24
25
26
27
28
29
30
node {
def app
stage('Clone repository') {
checkout scm
}
stage('Update GIT') {
script {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
withCredentials([usernamePassword(credentialsId: 'github', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
//def encodedPassword = URLEncoder.encode("$GIT_PASSWORD",'UTF-8')
sh "git config user.email [email protected]"
sh "git config user.name mehdiouzz"
//sh "git switch master"
sh "cat deployment.yaml"
sh "cp deployment.yaml deployment${DOCKERTAG}.yaml"
sh "sed -i 's+mehdiouzz/test.*+mehdiouzz/test:${DOCKERTAG}+g' deployment${DOCKERTAG}.yaml"
sh "sed -i 's+name: flaskdemo.*+name: flaskdemo${DOCKERTAG}+g' deployment${DOCKERTAG}.yaml"
sh "cat deployment.yaml"
sh "git add ."
sh "git commit -m 'Done by Jenkins Job changemanifest: ${env.BUILD_NUMBER}'"
sh "git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/${GIT_USERNAME}/gitops_manifest.git HEAD:main"
}
}
}
}
}