forked from edoburu/docker-pgbouncer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
48 lines (43 loc) · 1.53 KB
/
Jenkinsfile
File metadata and controls
48 lines (43 loc) · 1.53 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
pipeline {
agent { label 'libvirt' }
// Jenkins builds from the Bitbucket mirror (sabio-it/docker-pgbouncer),
// which is auto-synced from the canonical GitHub repo. Trigger matches
// the build source, consistent with the other containerize-* jobs.
triggers {
bitbucketPush()
}
options {
timestamps()
disableConcurrentBuilds()
}
environment {
IMAGE = 'images.tools.swops.cloud/platform-engineering/pgbouncer'
}
stages {
stage('Resolve version') {
steps {
script {
// Single source of truth: the PgBouncer version is the ARG in the Dockerfile.
env.PGB_VERSION = sh(
script: "grep -oP '^ARG VERSION=\\K.*' Dockerfile",
returnStdout: true
).trim()
echo "PgBouncer version from Dockerfile: ${env.PGB_VERSION}"
}
}
}
stage('Containerize') {
steps {
// BuildKit on Greta, push to Harbor with two tags:
// :${BUILD_NUMBER} -> build traceability
// :${PGB_VERSION} -> semver pin so consumers pin a PgBouncer version, not a build
sh """
/opt/buildkit/ops-buildctl --debug build \\
--frontend dockerfile.v0 \\
--local context=. --local dockerfile=. \\
--output type=image,\\"name=${env.IMAGE}:${env.BUILD_NUMBER},${env.IMAGE}:${env.PGB_VERSION}\\",push=true
"""
}
}
}
}