This repository was archived by the owner on Aug 4, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathJenkinsfile
More file actions
56 lines (53 loc) · 2.13 KB
/
Copy pathJenkinsfile
File metadata and controls
56 lines (53 loc) · 2.13 KB
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
#!groovy
properties([
parameters([
string(
name: 'RELEASE_TAG',
defaultValue: '',
description: 'The GitHub release tag to build, WITHOUT the v, e.g. "0.1.0"',
required: true
),
string(
name: 'IMAGE_NAME',
// TODO: Specify your own image name here
defaultValue: 'haufelexware/pushgateway-pruner',
description: 'The image to build; must contain the registry if applicable',
required: true
),
string(
name: 'REGISTRY',
// TODO: Might make sense to fill in your default registry here
defaultValue: '',
description: 'Docker registry to push to, leave blank for Docker Hub',
required: false
),
choice(
name: 'CREDENTIALS_ID',
// TODO: Add your own credential IDs here
// If somebody knows how to just get a list of Jenkins credentials automatically
// here, please tell me how that works.
choices: 'Some-Credential\nSome-other-credential',
description: 'The Jenkins credentials id to use for the docker registry',
required: true
),
]),
[$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false]
])
node('docker') {
stage ('Clone Code') {
sh 'if [ -d pushgateway-pruner ]; then rm -rf pushgateway-pruner; fi'
// TODO: If you want to build from your own fork, change this
sh 'git clone https://github.com/Haufe-Lexware/pushgateway-pruner'
}
stage ('Build and Push Image') {
withCredentials([
usernamePassword(credentialsId: params.CREDENTIALS_ID, usernameVariable: 'REGISTRY_USERNAME', passwordVariable: 'REGISTRY_PASSWORD')
]) {
env.REGISTRY = params.REGISTRY
sh """
cd pushgateway-pruner
./build/build-release.sh ${params.RELEASE_TAG} ${params.IMAGE_NAME}
"""
}
}
}