File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments