Skip to content

Commit 7b3ff68

Browse files
author
WindSekirun (wind.seo)
authored
add Jenkinsfile
1 parent a88ca6b commit 7b3ff68

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

Jenkinsfile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
@Library('jenkins-shared-library')_
2+
pipeline {
3+
environment {
4+
registry = "windsekirun/jenkins-android-docker"
5+
registryCredential = 'DockerHub'
6+
}
7+
agent any
8+
stages {
9+
stage ('Start') {
10+
steps {
11+
sendNotifications 'STARTED'
12+
}
13+
}
14+
stage('Environment') {
15+
parallel {
16+
stage('display') {
17+
steps {
18+
sh 'ls -la'
19+
}
20+
}
21+
}
22+
}
23+
stage('Build docker image') {
24+
steps {
25+
sh 'docker build -t $registry:latest --build-arg VCS_REF=`git rev-parse --short HEAD` .'
26+
}
27+
}
28+
stage('Deploy docker image') {
29+
steps {
30+
withDockerRegistry([ credentialsId: registryCredential, url: "" ]) {
31+
sh 'docker push $registry:latest'
32+
}
33+
}
34+
}
35+
stage('Clean docker image') {
36+
steps{
37+
script {
38+
try {
39+
sh "docker rmi $registry"
40+
} catch (Exception e) {
41+
echo err.getMessage()
42+
}
43+
}
44+
}
45+
}
46+
}
47+
post {
48+
always {
49+
sendNotifications currentBuild.result
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)