-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
47 lines (40 loc) · 1.3 KB
/
Jenkinsfile
File metadata and controls
47 lines (40 loc) · 1.3 KB
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
pipeline {
agent any
environment {
APP_NAME = "reactjs-blog"
}
stages {
stage ('Clean Workspace') {
steps {
cleanWs()
}
}
stage ('Checkout from SCM') {
steps {
git branch: 'main', credentialsId: 'github', url: 'https://github.com/Devnikops/Reactjs-Blog-CD.git'
}
}
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 GitHub') {
steps {
sh """
git config --global user.name "nikhil999999"
git config --global user.email "devopswithnik@gmail.com"
git add deployment.yaml
git commit -m "Updated Deployment Manifest"
"""
withCredentials([gitUsernamePassword(credentialsId: 'github', gitToolName: 'Default')]) {
sh "git push https://github.com/Devnikops/Reactjs-Blog-CD main"
}
}
}
}
}