Skip to content

Commit 615b724

Browse files
authored
Merge pull request #1 from lenn0n/master
Master
2 parents d75d8e7 + 6588b46 commit 615b724

File tree

3 files changed

+7100
-50
lines changed

3 files changed

+7100
-50
lines changed

Jenkinsfile

Lines changed: 52 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,59 @@ pipeline {
99
}
1010
}
1111
}
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+
}
6059

6160
}
61+
post {
62+
always {
63+
deleteDir()
64+
}
65+
}
6266

6367
}

0 commit comments

Comments
 (0)