From 579a42a5f0799159b3bfc9c95cf2b6a25da81c24 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sun, 27 Nov 2022 17:25:34 -0600 Subject: [PATCH] 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`. --- vars/buildContainerImage.groovy | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vars/buildContainerImage.groovy b/vars/buildContainerImage.groovy index c270b10..c46e480 100644 --- a/vars/buildContainerImage.groovy +++ b/vars/buildContainerImage.groovy @@ -9,6 +9,7 @@ def call(args) { def project = args.project def name = args.name def tag = args.tag + def arch = args.arch if (registry == null) { registry = 'git.pyrocufflink.net' } @@ -28,12 +29,18 @@ def call(args) { replaceAll('[^a-zA-z0-9._-]', '-'). replaceAll('^[.-]', '_') } + if (arch == null) { + arch = 'amd64' + } def repo = "${registry}/${project}/${name}" def full_name = "${repo}:${tag}" def podTemplateYaml = libraryResource('podTemplate.yaml') - podTemplate(yaml: podTemplateYaml) { + podTemplate( + yaml: podTemplateYaml, + nodeSelector: "kubernetes.io/arch=${arch}", + ) { node(POD_LABEL) { checkout scm