-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
51 lines (43 loc) · 1.54 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
pipeline {
agent {
label 'My-Jenkins-Agent'
}
environment {
APP_NAME = "devops-003-pipeline-aws"
}
stages {
stage('Cleanup Workspace') {
steps {
cleanWs()
}
}
stage('Checkout from SCM') {
steps {
// checkout scmGit(branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/mimaraslan/gitops-devops-003-pipeline-aws']])
git branch: 'master', credentialsId: 'github', url: 'https://github.com/mimaraslan/gitops-devops-003-pipeline-aws'
}
}
stage("Update the Deployment Tags") {
steps {
sh """
cat deployment.yaml
sed -i 's/${APP_NAME}.*/${APP_NAME}:${IMAGE_TAG}/g' deployment.yaml
cat deployment.yaml
"""
}
}
stage("Push the changed deployment file to Git") {
steps {
sh """
git config --global user.name "mimaraslan"
git config --global user.email "mimaraslan@gmail.com"
git add deployment.yaml
git commit -m "Updated Deployment Manifest"
"""
withCredentials([gitUsernamePassword(credentialsId: 'github', gitToolName: 'Default')]) {
sh "git push https://github.com/mimaraslan/gitops-devops-003-pipeline-aws master"
}
}
}
}
}