forked from galasa-dev-archives/build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.whitelist.docker
77 lines (71 loc) · 2.35 KB
/
Jenkinsfile.whitelist.docker
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
def mvnProfile = 'dev,whitelistbuild'
pipeline {
// Initially run on any agent
agent {
label 'docker-amd64'
}
options { timestamps () }
environment {
//Configure Maven from the maven tooling in Jenkins
def mvnHome = tool 'Default'
PATH = "${mvnHome}/bin:${env.PATH}"
//Set some defaults
def workspace = pwd()
def mvnGoal = 'install'
}
stages {
// for debugging purposes
stage('report') {
steps {
echo "Branch/Tag : ${env.GIT_BRANCH}"
echo "Commit Hash : ${env.GIT_COMMIT}"
echo "Workspace directory : ${workspace}"
echo "Maven profile : ${mvnProfile}"
}
}
// Set up the workspace, clear the git directories and setup the maven settings.xml files
stage('prep-workspace') {
steps {
configFileProvider([configFile(fileId: '86dde059-684b-4300-b595-64e83c2dd217', targetLocation: 'settings.xml')]) {
}
dir('repository/dev.galasa') {
deleteDir()
}
dir('repository/dev/galasa') {
deleteDir()
}
}
}
stage('Extract Artifacts') {
steps {
dir('docker/whitelist') {
sh "mvn --settings ${workspace}/settings.xml -Dmaven.repo.local=${workspace}/repository -P ${mvnProfile} -Dgalasa.output.directory=target -B -e -fae dev.galasa:galasastaging-maven-plugin:0.9.0-SNAPSHOT:extractartifacts"
}
}
}
stage('Build Docker Image') {
steps {
withFolderProperties {
dir('docker/whitelist') {
sh "docker build -t ${env.DOCKER_REPO}/galasa-offline-maven-generic:${env.DOCKER_VERSION} ."
}
}
}
}
stage('Push Docker Image') {
steps {
withFolderProperties {
dir('docker/whitelist') {
sh "docker push ${env.DOCKER_REPO}/galasa-offline-maven-generic:${env.DOCKER_VERSION}"
}
}
}
}
}
// post {
// // triggered when red sign
// failure {
// slackSend (channel: '#project-galasa-devs', color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
// }
// }
}