This repository has been archived by the owner on Sep 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJenkinsfile.base
63 lines (62 loc) · 2.74 KB
/
Jenkinsfile.base
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
pipeline {
agent any
environment {
registryCredential = "dockerhub-lssttsadmin"
dockerImageNameBuild = "lsstts/base-env:${image_tag}_${params.user_id}_${params.group_id}"
dockerImageBuild = ""
}
parameters {
string defaultValue: 'w_latest', description: 'lsstsqre/centos image tag.', name: 'image_tag', trim: false
string defaultValue: '1000', description: 'UID of saluser.', name: 'user_id', trim: false
string defaultValue: '1000', description: 'GID of saluser.', name: 'group_id', trim: false
booleanParam defaultValue: false, description: 'Trigger the SalObjContainer build?', name: 'BuildSalobjContainer'
booleanParam defaultValue: false, description: 'Trigger the DevelopEnvironment build?', name: 'BuildDevEnv'
}
stages {
stage("Build Docker image") {
steps {
script {
// Set the Current Build status, in order to make the email notification function work.
currentBuild.result = 'SUCCESS'
// Build the Docker Image.
sh "docker pull lsstsqre/centos:${params.image_tag}"
dockerImageBuild = docker.build(dockerImageNameBuild, "--no-cache --build-arg image_tag=${params.image_tag} --build-arg UID=${params.user_id} --build-arg GID=${params.group_id} ./develop-env/base/")
}
}
}
stage("Push Docker image") {
steps {
script {
docker.withRegistry("", registryCredential) {
dockerImageBuild.push()
}
}
}
}
stage("Trigger the SalObjContainer job") {
when {
expression {
return params.BuildSalobjContainer
}
}
steps {
// Start the SalObjContainer, Develop build.
build job: 'SalObjContainer', parameters: [booleanParam(name: 'BuildDevEnv_develop', value: true),
booleanParam(name: 'build_develop', value: true),
booleanParam(name: 'push_tag', value: false)], wait: false
// Start the SalObjContainer, Master build.
build job: 'SalObjContainer', parameters: [booleanParam(name: 'BuildDevEnv_master', value: true),
booleanParam(name: 'build_master', value: true),
booleanParam(name: 'push_tag', value: false)], wait: false
}
}
}
post {
always {
step([$class: 'Mailer',
notifyEveryUnstableBuild: false,
recipients: "[email protected]",
sendToIndividuals: true])
}
}
}