forked from d2iq-archive/marathon
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Jenkinsfile.release
61 lines (55 loc) · 2.57 KB
/
Jenkinsfile.release
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
#!/usr/bin/env groovy
ansiColor('xterm') {
node('JenkinsMarathonCI-Debian9-2019-06-19') {
properties([
parameters([
string(name: 'buildNumber',
defaultValue: '',
description: """Build that should be released to the community. Must start
|with a number and must include commit, e.g. 1.6.322-2bf46b341.
""".stripMargin()
),
booleanParam(name: 'runTests',
description: 'Whether unit/integration and package tests should be run',
defaultValue: true
),
booleanParam(name: 'latest',
defaultValue: false,
description: 'True if docker mesosphere/marathon:latest should be pushed'
),
booleanParam(name: 'dryRun',
defaultValue: false,
description: 'Set to true to only run the compile phase.'
)
])
])
stage("Run Pipeline") {
try {
checkout scm
withCredentials([
usernamePassword(credentialsId: 'a7ac7f84-64ea-4483-8e66-bb204484e58f', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USER'),
string(credentialsId: '3f0dbb48-de33-431f-b91c-2366d2f0e1cf',variable: 'AWS_ACCESS_KEY_ID'),
string(credentialsId: 'f585ec9a-3c38-4f67-8bdb-79e5d4761937',variable: 'AWS_SECRET_ACCESS_KEY'),
]) {
sshagent (credentials: ['0f7ec9c9-99b2-4797-9ed5-625572d5931d']) {
// add the ssh host key for the package uploader step
// These environment variables are defined in the "Properties Content" section for the job.
sh """echo "${PKG_SSH_HOST} ${PKG_SSH_HOSTKEY_TYPE} ${PKG_SSH_HOSTKEY}" | sudo -E tee -a /etc/ssh/ssh_known_hosts"""
withDockerRegistry([credentialsId: 'docker-hub-credentials']) {
targets = ''
if (params.dryRun == false)
targets = 'docker-tag linux-packages jar-artifact s3-package plugin-interface ' + (params.latest ? 'docker-latest' : '')
sh """sudo -E env ci/pipeline release --version $params.buildNumber --run-tests=$params.runTests $targets"""
}
}
}
} finally {
junit(allowEmptyResults: true, testResults: 'target/test-reports/*.xml')
junit(allowEmptyResults: true, testResults: 'tests/integration/target/test-reports/*.xml')
archive includes: "sandboxes.tar.gz"
archive includes: "ci-${env.BUILD_TAG}.log.tar.gz"
archive includes: "ci-${env.BUILD_TAG}.log" // Only in case the build was aborted and the logs weren't zipped
}
}
}
}