Skip to content

fix(ci): derive the image name from GITHUB_REPOSITORY - #1708

Merged
argoyle merged 1 commit into
mainfrom
fix/image-name-from-repository
Aug 1, 2026
Merged

fix(ci): derive the image name from GITHUB_REPOSITORY#1708
argoyle merged 1 commit into
mainfrom
fix/image-name-from-repository

Conversation

@argoyle

@argoyle argoyle commented Aug 1, 2026

Copy link
Copy Markdown
Member

The Github CI provider derived the image name from the last path element of RUNNER_WORKSPACE:

CIBuildName string `env:"RUNNER_WORKSPACE"`

func (c *Github) BuildName() string {
	if c.CIBuildName != "" {
		return c.Common.BuildName(filepath.Base(c.CIBuildName))
	}
	...
}

That holds on GitHub Actions, which checks out to /home/runner/work/<repository>. It does not hold on Gitea Actions, which checks out to /workspace/<owner>/<repository> and exports the parent of the workspace, so the last element is the owner:

platform RUNNER_WORKSPACE filepath.Base
GitHub Actions /home/runner/work/myrepo myrepo
Gitea Actions /workspace/myorg myorg

Images were published as <registry>/<owner>/<owner> instead of <registry>/<owner>/<repository> — for us, oci.example.com/myorg/myorg — and every deployment referencing the expected name failed to pull with a 404.

This stayed hidden for as long as the Gitea runner left RUNNER_WORKSPACE unset, because the empty value fell through to Common.BuildName("")filepath.Base(cwd), and the working directory basename is the repository name. Once the runner started exporting the variable, the name changed under us with no change on our side.

GITHUB_REPOSITORY is <owner>/<repository> on both platforms and names the repository directly, so this prefers it and keeps the previous paths as fallbacks. On GitHub Actions the result is identical to before.

Tests

Two new cases in pkg/ci/github_test.go: one for a GitHub-shaped workspace (asserting no behaviour change) and one for the Gitea layout, where RUNNER_WORKSPACE points at the owner and GITHUB_REPOSITORY has to win. Reverting the fix turns the Gitea case red and leaves the GitHub one green. TestGithub_Override_ImageName still passes, so an explicit IMAGE_NAME continues to beat both.

The Github CI provider took the image name from the last path element of
RUNNER_WORKSPACE. That holds on GitHub Actions, which checks out to
/home/runner/work/<repository>, but not on Gitea Actions: it checks out to
/workspace/<owner>/<repository> and exports the parent of that as
RUNNER_WORKSPACE, so the last element is the owner.

Images were therefore published as <owner>/<owner> instead of
<owner>/<repository>, and deployments referencing the expected name failed
to pull. The breakage only surfaced once the runner started exporting
RUNNER_WORKSPACE at all; before that the empty value fell through to the
working directory basename, which happened to be correct.

GITHUB_REPOSITORY is "<owner>/<repository>" on both platforms and names the
repository directly, so prefer it and keep the old paths as fallbacks.
@argoyle
argoyle requested a review from peter-svensson as a code owner August 1, 2026 21:00
@peter-svensson
peter-svensson enabled auto-merge (squash) August 1, 2026 21:00
@github-actions github-actions Bot added the bug Something isn't working label Aug 1, 2026
@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.90%. Comparing base (52a6510) to head (b879366).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1708   +/-   ##
=======================================
  Coverage   90.89%   90.90%           
=======================================
  Files          40       40           
  Lines        1923     1924    +1     
=======================================
+ Hits         1748     1749    +1     
  Misses        113      113           
  Partials       62       62           
Flag Coverage Δ
unittests 90.90% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@argoyle
argoyle disabled auto-merge August 1, 2026 21:06
@argoyle
argoyle merged commit 884791b into main Aug 1, 2026
12 checks passed
@argoyle
argoyle deleted the fix/image-name-from-repository branch August 1, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant