Skip to content

ci: gitea publishes Harbor on tag, github does the rest - #5

Open
ashish1099 wants to merge 1 commit into
masterfrom
ci/gitea-harbor-github-ghcr
Open

ci: gitea publishes Harbor on tag, github does the rest#5
ashish1099 wants to merge 1 commit into
masterfrom
ci/gitea-harbor-github-ghcr

Conversation

@ashish1099

Copy link
Copy Markdown
Member

What

Splits release responsibilities now that origin points at GitHub and Gitea is a mirror:

Gitea GitHub
Tests / lint / fmt removed .github/workflows/test.yml
Container image harbor.obmondo.com/obmondo/gfetch ghcr.io/obmondo/gfetch
Binaries + release notes removed GoReleaser in .github/workflows/release.yml
Trigger v* tag only v* tag (release), push/PR (CI)

Gitea keeps exactly one job — the Harbor push, which GitHub cannot do — and nothing else.

Why the release workflows also needed fixing

d4c49bf ("unify build and release process with goreleaser") moved image building out of
docker/build-push-action and into GoReleaser's dockers: block. That cannot work here:
GoReleaser builds images in a temp directory containing only the compiled binaries plus the
Dockerfile, but our Dockerfile builds from source (COPY go.mod go.sum ./ then go build).
go.mod is not in that context, so the build fails before it starts.

It went unnoticed because no release workflow has ever run — GitHub Actions history shows only
Tests and CodeQL, zero goreleaser runs. The image currently published at
ghcr.io/obmondo/gfetch:v1.2.0 was built by the old docker.yml that d4c49bf deleted.

So image building returns to docker/build-push-action with full repo context, and GoReleaser goes
back to what it does well: binaries, archives, changelog, GitHub release.

Bugs fixed along the way

  • Gitea had no Harbor login. The "Login to Harbor" step invoked setup-go, not
    docker/login-action — a copy-paste slip, so no authentication happened at all.
  • GitHub had no registry login whatsoever, while .goreleaser-github.yaml had push: true to
    ghcr.io.
  • Malformed GHCR image name. ghcr.io/{{.Env.GITHUB_REPOSITORY}}/gfetch resolves to
    ghcr.io/Obmondo/gfetch/gfetch — a doubled path segment, and uppercase, which GHCR rejects.
    Verified against the registry: ghcr.io/obmondo/gfetch:v1.2.0 returns 200, the doubled name 403s.
  • No QEMU/buildx setup in either workflow, despite both declaring
    --platform=linux/amd64,linux/arm64. (An abandoned checkpoint branch in this repo carries the
    matching buildx failed ... failed to solve error.)

Judgement call worth a look

.goreleaser-gitea.yaml is deleted. With GoReleaser no longer running on Gitea it is dead
config — but it also means no more Gitea releases or binary archives; Harbor becomes the only
artifact Gitea produces. That follows "only the tags push for gitea and nothing else", but it is one
revert away if you want Gitea releases kept.

Before this actually works

  • Gitea needs HARBOR_USERNAME / HARBOR_PASSWORD secrets, and the obmondo project must exist in
    Harbor. I could not verify either from here.
  • The Gitea mirror must receive tags. It is currently 3 commits behind and pushes now go only to
    GitHub — if EnableIT/gfetch is not configured as a Gitea pull-mirror, the tag never lands there
    and the Harbor job never fires.
  • CodeQL is GitHub "default setup" (repo settings, not a workflow file), so it stays on GitHub
    automatically — nothing to change.

Not run: go build / tests, per your usual preference. YAML of all workflows was parse-checked.

🤖 Generated with Claude Code

Gitea is a mirror now, so it keeps only the one job GitHub cannot do: push the container image to Harbor on a v* tag. Tests, lint, fmt, the GitHub release and the GHCR image all live on GitHub.

Image building moves back to docker/build-push-action. d4c49bf moved it into GoReleaser's dockers: block, but GoReleaser builds in a temp dir holding only the compiled binaries and the Dockerfile, while this Dockerfile builds from source - so go.mod is absent and the build cannot succeed. No release workflow had ever run, so the regression went unnoticed.

Along the way: Gitea's Login to Harbor step ran setup-go instead of docker/login-action, so no login happened; the GitHub release had no registry login at all; the GHCR image template resolved to ghcr.io/Obmondo/gfetch/gfetch (doubled path segment, and uppercase, which GHCR rejects) while the published image is ghcr.io/obmondo/gfetch; and neither workflow set up QEMU/buildx for the declared linux/arm64 build.

.goreleaser-gitea.yaml is dropped, since GoReleaser no longer runs on Gitea.

Signed-off-by: Ashish Jaiswal <ashish@obmondo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant