-
Notifications
You must be signed in to change notification settings - Fork 31
/
Jenkinsfile.rh.release
71 lines (66 loc) · 2.57 KB
/
Jenkinsfile.rh.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
62
63
64
65
66
67
68
69
70
71
/*
* Copyright (c) 2017-present Sonatype, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Library(['private-pipeline-library', 'jenkins-shared']) _
properties([
parameters([
string(
name: 'tag',
description: 'Version tag to apply to the image, like 1.140.0-ubi-1.'
),
run(name: 'releaseBuild',
filter: 'SUCCESSFUL',
projectName: 'insight/insight-brain/release',
description: 'The latest release of IQ Server to build the docker image')
]),
])
node('ubuntu-zion') {
try {
stage('Preparation') {
env.IQ_SERVER_VERSION = getVersionFromBuildName(env.releaseBuild_NAME)
env.IQ_SERVER_CHECKSUM = readBuildArtifact('insight/insight-brain/release', env.releaseBuild_NUMBER, "artifacts/nexus-iq-server-${env.IQ_SERVER_VERSION}-bundle.tar.gz.sha256").trim()
env.IQ_RELEASE = env.IQ_SERVER_VERSION.split("-")[0]
env.PF_VERSION = sh( returnStdout: true, script:
"curl -L -H 'Accept: application/vnd.github+json' https://api.github.com/repos/redhat-openshift-ecosystem/openshift-preflight/git/refs/tags | jq -r '.[-1].ref' | cut -d'/' -f 3"
).trim()
deleteDir()
checkout scm
sh 'docker system prune -a -f'
sh '''
echo "Downloading preflight ${PF_VERSION} ..."
wget -q -O preflight \
https://github.com/redhat-openshift-ecosystem/openshift-preflight/releases/download/${PF_VERSION}/preflight-linux-amd64
chmod 755 preflight
'''
}
stage('Build') {
withCredentials([
usernamePassword(
credentialsId: 'red-hat-quay-nexus-iq-server',
usernameVariable: 'REGISTRY_LOGIN',
passwordVariable: 'REGISTRY_PASSWORD'),
string(
credentialsId: 'red-hat-api-token',
variable: 'API_TOKEN')
]) {
sh 'PATH="$PATH:." VERSION=$IQ_SERVER_VERSION CHECKSUM=$IQ_SERVER_CHECKSUM RELEASE=$IQ_RELEASE TAG=$tag ./build_and_push_rh_image.sh'
}
}
} finally {
sh 'docker logout'
sh 'docker system prune -a -f'
sh 'git clean -f && git reset --hard origin/main'
}
}