forked from xebialabs/xl-deploy-docker-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
50 lines (39 loc) · 1.64 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
43
44
45
46
47
48
49
#!groovy
pipeline {
agent none
environment {
GRADLE_OPTS = '-Xmx1024m'
}
options {
buildDiscarder(logRotator(artifactDaysToKeepStr: '7', artifactNumToKeepStr: '5'))
skipDefaultCheckout()
timeout(time: 1, unit: 'HOURS')
timestamps()
ansiColor('xterm')
}
parameters {
string(name: 'version', description: 'Version to tag the docker image')
string(name: 'flavor', defaultValue: "debian-slim", description: 'Flavor of the docker image')
string(name: 'registry', defaultValue: "xl-docker.xebialabs.com", description: 'Registry to push the image to')
string(name: 'repository', defaultValue: "xl-deploy", description: 'Repository to push the image to')
}
stages {
stage('Publish Docker image to XLD docker registry') {
when {
expression { params.version != '' }
}
agent {
node {
label 'xld || release-xld'
}
}
steps {
checkout scm
withCredentials([usernamePassword(credentialsId: 'nexus-ci', passwordVariable: 'nexus_pass', usernameVariable: 'nexus_user'),
usernamePassword(credentialsId: 'xldevdocker', passwordVariable: 'docker_pass', usernameVariable: 'docker_user')]) {
sh "./build.sh -f \"${params.flavor}\" -h -v \"${params.version}\" -s nexus -u \"${nexus_user}\" -p \"${nexus_pass}\" -U \"${docker_user}\" -P \"${docker_pass}\" -g \"${params.registry}\" -r \"${params.repository}\""
}
}
}
}
}