forked from sonatype/docker-nexus3
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile.rh
49 lines (45 loc) · 1.31 KB
/
Jenkinsfile.rh
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
/*
* Copyright (c) 2016-present Sonatype, Inc. All rights reserved.
* Includes the third-party code listed at http://links.sonatype.com/products/nexus/attributions.
* "Sonatype" is a trademark of Sonatype, Inc.
*/
@Library(['private-pipeline-library', 'jenkins-shared']) _
properties([
parameters([
string(
name: 'version',
description: 'Version tag to apply to the image, like 3.41.0-ubi-1.'
),
]),
])
node('ubuntu-zion') {
try {
stage('Preparation') {
deleteDir()
checkout scm
sh 'docker system prune -a -f'
sh '''
wget -q -O preflight \
https://github.com/redhat-openshift-ecosystem/openshift-preflight/releases/download/1.4.1/preflight-linux-amd64
chmod 755 preflight
'''
}
stage('Build') {
withCredentials([
usernamePassword(
credentialsId: 'red-hat-quay-nexus-repository-manager',
usernameVariable: 'REGISTRY_LOGIN',
passwordVariable: 'REGISTRY_PASSWORD'),
string(
credentialsId: 'red-hat-api-token',
variable: 'API_TOKEN')
]) {
sh 'PATH="$PATH:." VERSION=$version ./build_red_hat_image.sh'
}
}
} finally {
sh 'docker logout'
sh 'docker system prune -a -f'
sh 'git clean -f && git reset --hard origin/main'
}
}