Skip to content

fix(ci): worker docker-publish — drop local replace + bump api pin via goproxy#5

Merged
haydercyber merged 1 commit into
mainfrom
fix/docker-publish-no-replace
May 29, 2026
Merged

fix(ci): worker docker-publish — drop local replace + bump api pin via goproxy#5
haydercyber merged 1 commit into
mainfrom
fix/docker-publish-no-replace

Conversation

@haydercyber
Copy link
Copy Markdown
Contributor

Root cause

worker#4's docker-publish.yml staged the api repo under worker/.deps/api/ and rewrote the local replace path. That worked at the OS level but the Dockerfile runs go mod download before COPY . . (for build-cache layering), so .deps/api/ didn't yet exist in the layer where the replace had to resolve. Every push to main failed at layer 4 with:

go: github.com/secrets-bridge/api@v0.0.0-... (replaced by ./.deps/api):
reading .deps/api/go.mod: open /src/.deps/api/go.mod: no such file or directory

The fix

Drop the local replace AND bump the api pin to api/main's HEAD before docker build. goproxy then serves a pseudo-version matching the current api source, and the Dockerfile's existing COPY go.mod go.sum ./ + RUN go mod download resolves cleanly via the normal module path with no in-context staging needed.

Workflow changes

Step Before After
Checkout api alongside worker removed
mv api-source worker/.deps/api removed
sed -i ... go.mod (rewrite replace path) removed
actions/setup-go@v5 added
go mod edit -dropreplace added
go get github.com/secrets-bridge/api@main added
go mod tidy added
docker build context ./worker .

Pinned version bump

The pseudo-version pin in go.mod jumped from:

  • v0.0.0-20260529005625-257ebd2ff86b (pre-#41) v0.0.0-20260529211927-bd05303fcab4 (current api/main HEAD)

This was necessary anyway: api#41 changed keymgmt.FromEnv(ctx)(ctx, env), and the old pin couldn't compile worker#4's fix that already passes cfg.Env through.

Verified locally

$ go mod edit -dropreplace github.com/secrets-bridge/api
$ go get github.com/secrets-bridge/api@main
go: downloading github.com/secrets-bridge/api v0.0.0-20260529211927-bd05303fcab4
go: upgraded github.com/secrets-bridge/api v0.0.0-20260529005625-257ebd2ff86b => v0.0.0-20260529211927-bd05303fcab4
$ go mod tidy
$ go build ./...
# clean

Follow-up (post-v0.1.0)

When the api module gets a real semver tag, swap @main for @vX.Y.Z in the workflow AND pin in go.mod permanently. The dynamic @main lookup is acceptable for the rolling :dev channel; semver-tagged builds should be reproducible.

…a goproxy

The original workflow staged the api repo under `worker/.deps/api/`
and rewrote the local replace path. That worked at the OS level but
the Dockerfile runs `go mod download` BEFORE `COPY . .` (for build-
cache layering), so `.deps/api/` didn't yet exist in the layer
where `go mod download` resolved the replace. Result: every push
to main failed at layer 4 with:

  go: github.com/secrets-bridge/api@v0.0.0-... (replaced by ./.deps/api):
  reading .deps/api/go.mod: open /src/.deps/api/go.mod: no such
  file or directory

Cleaner fix: drop the local replace AND bump the api pin to api/main's
HEAD before docker build. goproxy then serves the pseudo-version
matching the current api source, and the Dockerfile's existing
`COPY go.mod go.sum ./` + `RUN go mod download` resolves cleanly via
the normal module path with no in-context staging needed.

Also bumped:
- api pseudo-version 257ebd2 (pre-#41) → bd05303 (current main).
  The signature change `keymgmt.FromEnv(ctx)` → `(ctx, env)` from
  api#41 needs the new api source; the old pin couldn't compile
  worker.

Workflow changes:
- Removed the api side-by-side checkout step
- Removed the `.deps/api/` move + sed rewrite step
- Added a `setup-go@v5` step + `go mod edit -dropreplace` +
  `go get github.com/secrets-bridge/api@main` + `go mod tidy`
- Reverted docker build context to `.` (was `./worker`)

When the api module gets a real semver tag, swap
`@main` for `@vX.Y.Z` and pin in go.mod permanently.

Verified locally: `go mod tidy && go build ./...` resolves
github.com/secrets-bridge/api to v0.0.0-20260529211927-bd05303fcab4
and compiles clean (the keymgmt.FromEnv two-arg signature matches).
@haydercyber haydercyber merged commit 4ae7178 into main May 29, 2026
4 checks passed
@haydercyber haydercyber deleted the fix/docker-publish-no-replace branch May 29, 2026 22:29
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