Skip to content

Commit d24c730

Browse files
Update Jenkinsfile
1 parent a2c676c commit d24c730

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

Jenkinsfile

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1+
@Library("Shared") _
12
pipeline{
23

34
agent { label "dev"};
45

56
stages{
67
stage("Code Clone"){
78
steps{
8-
git url: "https://github.com/LondheShubham153/two-tier-flask-app.git", branch: "master"
9+
script{
10+
clone("https://github.com/LondheShubham153/two-tier-flask-app.git", "master")
11+
}
912
}
1013
}
1114
stage("Trivy File System Scan"){
1215
steps{
13-
sh "trivy fs . -o results.json"
16+
script{
17+
trivy_fs()
18+
}
1419
}
1520
}
1621
stage("Build"){
@@ -27,17 +32,9 @@ pipeline{
2732
}
2833
stage("Push to Docker Hub"){
2934
steps{
30-
withCredentials([usernamePassword(
31-
credentialsId:"dockerHubCreds",
32-
passwordVariable: "dockerHubPass",
33-
usernameVariable: "dockerHubUser"
34-
)]){
35-
36-
sh "docker login -u ${env.dockerHubUser} -p ${env.dockerHubPass}"
37-
sh "docker image tag two-tier-flask-app ${env.dockerHubUser}/two-tier-flask-app"
38-
sh "docker push ${env.dockerHubUser}/two-tier-flask-app:latest"
39-
40-
}
35+
script{
36+
docker_push("dockerHubCreds","two-tier-flask-app")
37+
}
4138
}
4239
}
4340
stage("Deploy"){

0 commit comments

Comments
 (0)