Support selecting build architecture

The `buildContainerImage` method now supports an optional `arch` keyword
argument.  This argument can be used to select the architecture of the
node running the pod building the container image.  If unspecified, it
defaults to `amd64`.
testing
Dustin 2022-11-27 17:25:34 -06:00
parent b6f57b7c1a
commit 579a42a5f0
1 changed files with 8 additions and 1 deletions

View File

@ -9,6 +9,7 @@ def call(args) {
def project = args.project def project = args.project
def name = args.name def name = args.name
def tag = args.tag def tag = args.tag
def arch = args.arch
if (registry == null) { if (registry == null) {
registry = 'git.pyrocufflink.net' registry = 'git.pyrocufflink.net'
} }
@ -28,12 +29,18 @@ def call(args) {
replaceAll('[^a-zA-z0-9._-]', '-'). replaceAll('[^a-zA-z0-9._-]', '-').
replaceAll('^[.-]', '_') replaceAll('^[.-]', '_')
} }
if (arch == null) {
arch = 'amd64'
}
def repo = "${registry}/${project}/${name}" def repo = "${registry}/${project}/${name}"
def full_name = "${repo}:${tag}" def full_name = "${repo}:${tag}"
def podTemplateYaml = libraryResource('podTemplate.yaml') def podTemplateYaml = libraryResource('podTemplate.yaml')
podTemplate(yaml: podTemplateYaml) { podTemplate(
yaml: podTemplateYaml,
nodeSelector: "kubernetes.io/arch=${arch}",
) {
node(POD_LABEL) { node(POD_LABEL) {
checkout scm checkout scm