forked from afalko/dockerfile-image-update
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
42 lines (42 loc) · 1.29 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
pipeline {
agent any
stages {
stage('Build and Test') {
steps {
sh "docker run --rm -v `pwd`:/tmp/ws maven /bin/bash -c 'cd /tmp/ws; mvn --quiet --batch-mode install'"
sh "docker build -t afalko/dockerfile-image-update:${BUILD_ID} ."
}
}
stage('Publish') {
environment {
DOCKER_PASSWORD = credentials('DOCKER_PASSWORD')
}
when {
expression {
BRANCH_NAME == "master"
}
}
steps {
sh "docker login -u afalko -p ${DOCKER_PASSWORD}"
sh "docker push afalko/dockerfile-image-update:${BUILD_ID}"
}
}
stage('Update Docker Images') {
when {
expression {
BRANCH_NAME == "master"
}
}
environment {
git_api_url = 'https://api.github.com'
git_api_token = credentials('DOCKERFILE_IMAGE_UPDATE_TOKEN')
image_map_store = 'docker-tag-store-df17-demo'
}
steps {
sh "docker run --rm -e git_api_token -e git_api_url \
salesforce/dockerfile-image-update --org afalko \
parent afalko/hello-world-app ${BUILD_ID} ${image_map_store}"
}
}
}
}