@@ -9,55 +9,59 @@ pipeline {
9
9
}
10
10
}
11
11
}
12
- // stage("Build Application"){
13
- // steps {
14
- // nodejs(nodeJSInstallationName: 'nodejs') {
15
- // bat 'npm install'
16
- // bat 'npm run build'
17
- // }
18
- // }
19
- // }
20
- // stage("Dockerize Application"){
21
- // steps {
22
- // bat 'docker build -t webapp .'
23
- // bat 'docker images'
24
- // }
25
- // }
26
- // stage("Push To DockerHub"){
27
- // steps {
28
- // withCredentials ([
29
- // usernamePassword(credentialsId: 'docker-cred',
30
- // usernameVariable: "USERNAME",
31
- // passwordVariable: "PASSWORD"
32
- // )]) {
33
- // bat 'docker login --username $USERNAME -- password PASSWORD'
34
- // bat 'docker push webapp:dev'
35
- // }
36
- // }
37
- // }
38
- // stage("Push To Github"){
39
- // steps {
40
- // bat 'git config --global user.email "auto@jenkins.com"'
41
- // bat 'git config --global user.name "Jenkins"'
42
- // bat 'git remote add jenkins https://github.com/lenn0n/jenkins-post-build.git'
43
- // bat 'git add .'
44
- // bat "git commit -m 'Commit from Jenkins'"
45
- // withCredentials([gitUsernamePassword(credentialsId: 'gh-cred', gitToolName: 'Default')]) {
46
- // bat "git push -u origin HEAD:jenkins"
47
- // }
48
- // }
49
- // }
50
- // stage("Push To EC2"){
51
- // steps {
52
-
53
- // }
54
- // }
55
- // stage("Restart Application (PM2, Deployments)"){
56
- // steps {
57
-
58
- // }
59
- // }
12
+ stage(" Build Application" ){
13
+ steps {
14
+ nodejs(nodeJSInstallationName : ' nodejs' ) {
15
+ bat ' npm install'
16
+ bat ' npm run build'
17
+ }
18
+ }
19
+ }
20
+ stage(" Dockerize Application" ){
21
+ steps {
22
+ bat ' docker build . -t lennonjansuy/webapp:dev'
23
+ bat ' docker images'
24
+ }
25
+ }
26
+ stage(" Push To DockerHub" ){
27
+ steps {
28
+ withCredentials ([
29
+ usernamePassword(credentialsId : ' docker-cred' ,
30
+ usernameVariable : " USERNAME" ,
31
+ passwordVariable : " PASSWORD"
32
+ )]) {
33
+ bat ' docker login -u $USERNAME -p $PASSWORD'
34
+ bat ' docker push lennonjansuy/webapp:dev'
35
+ }
36
+ }
37
+ }
38
+ stage(" Push To Github (Clone build to other repo)" ){
39
+ steps {
40
+ withCredentials([gitUsernamePassword(credentialsId : ' gh-cred' , gitToolName : ' Default' )]) {
41
+ git credentialsId : ' gh-cred' , url : ' https://github.com/lenn0n/jenkins-post-build.git'
42
+ bat " echo 'node_modules' > .gitignore"
43
+ bat ' git add .'
44
+ bat " git commit -m 'Commit from Jenkins' || true"
45
+ bat " git push -u origin HEAD:master || true"
46
+ }
47
+ }
48
+ }
49
+ stage(" Push Build Folder in Linux Machines and Restart" ){
50
+ steps {
51
+ echo ' TBD'
52
+ }
53
+ }
54
+ stage(" Kubernetes Deployment Restart" ){
55
+ steps {
56
+ echo ' TBD'
57
+ }
58
+ }
60
59
61
60
}
61
+ post {
62
+ always {
63
+ deleteDir()
64
+ }
65
+ }
62
66
63
67
}
0 commit comments