Install yq on demand in updateHelmTag (missing from docker:27-cli)

Build #11 failed: "yq: not found". docker:27-cli's Alpine base
doesn't ship yq by default, same gap as the bash/python3 on-demand
installs already in runHooks.groovy. Alpine renamed the mikefarah/yq
package from `yq` to `yq-go` at v3.20 (and an unrelated Python-based
tool is also sometimes packaged as plain `yq` on other distros, with
incompatible syntax) — tries yq-go first, falls back to yq, rather
than assume which Alpine version docker:27-cli currently ships.
This commit is contained in:
Mukul Sharma
2026-09-02 18:12:37 +05:30
parent 0d7389e28a
commit a6eb8ef625
@@ -43,6 +43,14 @@ def run(Map config) {
def authedUrl = "${urlParts[0]}://\${GIT_USER}:\${GIT_PASS}@${urlParts[1]}" def authedUrl = "${urlParts[0]}://\${GIT_USER}:\${GIT_PASS}@${urlParts[1]}"
sh """ sh """
git clone ${authedUrl} . git clone ${authedUrl} .
# docker:27-cli's Alpine base doesn't ship yq by
# default. Package name is 'yq-go' on Alpine >= 3.20,
# plain 'yq' on older Alpine (both are mikefarah/yq,
# the Go tool this -i/path-expression syntax assumes
# — a same-named 'yq' package on some distros is a
# completely different, Python-based tool). Try both
# rather than guess which Alpine base is current.
apk add --no-cache yq-go 2>/dev/null || apk add --no-cache yq
yq -i '${config.image_tag_yq_path} = "${env.TAG}"' ${valuesFile} yq -i '${config.image_tag_yq_path} = "${env.TAG}"' ${valuesFile}
git config user.email 'jenkins-ci@homelab.local' git config user.email 'jenkins-ci@homelab.local'
git config user.name 'jenkins-ci' git config user.name 'jenkins-ci'