Skip to content

fix(buildah): define IMAGE shell variable from params to fix multi-arch builds - #738

Closed
ArthurVardevanyan wants to merge 1 commit into
mainfrom
fix/buildah-image-var-new
Closed

ArthurVardevanyan wants to merge 1 commit into
mainfrom
fix/buildah-image-var-new

Conversation

@ArthurVardevanyan

@ArthurVardevanyan ArthurVardevanyan commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

User description

Summary

Fixes multi-arch build failures caused by undefined \${IMAGE} variable in the buildah task script.

Problem

Line 125 used \${IMAGE%:*} to extract the image name without the tag, but \${IMAGE} was never defined in the script. The task receives params: IMAGE, but the script referenced \${IMAGE} (undefined/empty) instead of \$(params.IMAGE).

This caused per-arch image names to be :amd64 and :arm64 (invalid references), which failed when buildah tried to create manifests.

Root cause in k8s-gitops-ci

This bug was masked in k8s-gitops-ci because the top-level params never set IMAGE_TAG for PR events, so IMAGE_TAG defaulted to "". This resulted in IMAGE being registry.arthurvardevanyan.com/homelab/k8s-gitops-ci: (with an empty tag), which exposed the bug when the buildah task tried to extract the image name.

Fix

Added IMAGE="$(params.IMAGE)" at the top of the script to resolve the IMAGE param into a shell variable. This is a single-source fix that covers all downstream \${IMAGE} usages (lines 137, 141, 153, 154, 180) which rely on the variable being defined.

Impact

  • Fixes tag amd64:-amd64: invalid reference format errors in multi-arch builds
  • No behavior change for single-arch builds (they don't use \${IMAGE})

PR Type

Bug fix


Description

  • Define IMAGE shell variable from task parameters

  • Fix invalid image reference errors in multi-arch builds

  • Resolve undefined variable causing buildah manifest failures


Diagram Walkthrough

flowchart LR
  P["params.IMAGE"]
  R["resolve_to_shell_var"]
  F["fix_invalid_refs"]
  S["success_multi_arch_build"]
  P -- "resolve" --> R
  R -- "fix" --> F
  F -- "result" --> S
Loading

File Walkthrough

Relevant files
Bug fix
buildah.yaml
Define IMAGE shell variable from task parameters                 

tekton/tasks/buildah/0.8.0/buildah.yaml

  • Added IMAGE="$(params.IMAGE)" to resolve task parameter
  • Included comment explaining the fix for string operations
  • Placed variable definition before multi-arch detection logic
+4/-0     


⚙️ Agent run details
  • Model: openai/qwen3.6-35b-a3b
  • Tokens: 4,662 in / 3,262 out / 7,924 total
  • Time cost: 26.8s
  • AI calls: 1

…ch builds

Line 125 used ${IMAGE%:*} to extract the image name without the tag,
but ${IMAGE} was never defined in the script - the task receives
params: IMAGE but the script referenced ${IMAGE} (undefined/empty)
instead of $(params.IMAGE).

This caused per-arch image names to be ":amd64" and ":arm64"
(invalid references), which failed when buildah tried to create
manifests.

Fix: resolve IMAGE=$(params.IMAGE) at the top of the script so
${IMAGE%:*} works correctly. This is a single-source fix that covers
all downstream ${IMAGE} usages (lines 137, 141, 153, 154, 180) which
rely on the variable being defined.
@homelab-okd

homelab-okd Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

GitOps CI Results

Last Updated: 2026-09-22T19:44:51Z

✅ Expand: PR Checks
      ✅ PR Title

Passed.

      ✅ Signed Commits

Passed.

      ✅ PR Checklist

Passed.

✅ Expand: Linting
      ✅ Markdownlint

No markdown files changed.

      ✅ Prettier

Passed.

      ✅ Shellcheck

Passed.

      ✅ golangci-lint

No Go files changed.

      ✅ Kubeconform

Passed.

✅ Expand: Static Checks
      ✅ Large File

Passed.

      ✅ YAML Syntax

Passed.

      ✅ Config Sort Order

Passed.

      ✅ Starting CSV

Passed.

      ✅ Scaffold Table

Disabled.

✅ Expand: Kustomize Build
      ✅ Overlay Build

0 overlay(s) built successfully.

      ✅ Hooks

No hooks defined.

      ✅ Kustomize Fix

All kustomization.yaml files are up to date.

      ✅ Ghost Patches

None detected.

✅ Expand: Scaffold Validation
      ✅ Scaffold Drift

No drift detected.

      ✅ Scaffold Exec

All scaffold runs succeeded.

      ✅ Disabled Overlays

No modified overlay is disabled.

      ✅ Pre-Existing Scaffold Drift

None detected.

      ✅ Cluster Coverage

All clusters accounted for.

✅ Expand: Scaffold Drift Protection

All modified overlays with a scaffold template have drift protection enabled.

✅ Expand: Resource Compliance

No compliance findings.

✅ Expand: CI Notes

Pipeline completed.

  • Tool version: k8s-gitops-ci version 0.60.0-rc.1
k8s-gitops-ci pipeline --url="https://github.com/ArthurVardevanyan/HomeLab" --pr=738 --assume-openshift

@homelab-pr-agent

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

⚙️ Agent run details
  • Model: openai/qwen3.6-35b-a3b
  • Tokens: 5,230 in / 1,211 out / 6,441 total
  • Time cost: 9.1s
  • AI calls: 1

@homelab-pr-agent

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.


⚙️ Agent run details
  • Model: openai/qwen3.6-35b-a3b
  • Tokens: 4,157 in / 3,124 out / 7,281 total
  • Time cost: 23.7s
  • AI calls: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant