-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
42 lines (40 loc) · 1.29 KB
/
Jenkinsfile
File metadata and controls
42 lines (40 loc) · 1.29 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
pipeline {
agent { label "jenlins-agent" }
environment {
APP_NAME = "net-pipeline"
}
stages {
stage("Cleanup Workspace") {
steps {
cleanWs()
}
}
stage("Checkout from SCM") {
steps {
git branch: 'main', credentialsId: 'github', url: 'https://github.com/kushal9897/net-gitops.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 Git") {
steps {
sh """
git config --global user.name "kushal9897"
git config --global user.email "kushalag2580@gmail.com"
git add deployment.yaml
git commit -m "Updated Deployment Manifest"
"""
withCredentials([gitUsernamePassword(credentialsId: 'github', gitToolName: 'Default')]) {
sh "git push https://github.com/kushal9897/net-gitops.git"
}
}
}
}
}