Skip to content

[DNM][TEST][operator_build] Use local path replace for go.mod in meta operator#4075

Open
lmiccini wants to merge 4 commits into
openstack-k8s-operators:mainfrom
lmiccini:fix-operator-build-gomod-replace
Open

[DNM][TEST][operator_build] Use local path replace for go.mod in meta operator#4075
lmiccini wants to merge 4 commits into
openstack-k8s-operators:mainfrom
lmiccini:fix-operator-build-gomod-replace

Conversation

@lmiccini

Copy link
Copy Markdown
Contributor

The go mod edit -replace command was using a remote module reference with a raw commit SHA (e.g. github.com/user/repo@sha), which requires go mod tidy to resolve the SHA to a pseudo-version via the Go module proxy. In CI environments where the proxy cannot reach fork repositories, go mod tidy silently fails (no set -e), leaving the raw SHA in go.mod. The subsequent go work use then fails with "version must be of the form v1.2.3".

Fix by using local path replaces instead — the operator source is already checked out at {{ operator.src }}, so no network access or version resolution is needed. Also add set -e to surface any future failures immediately.

The go mod edit -replace command was using a remote module reference
with a raw commit SHA (e.g. github.com/user/repo@sha), which requires
go mod tidy to resolve the SHA to a pseudo-version via the Go module
proxy. In CI environments where the proxy cannot reach fork
repositories, go mod tidy silently fails (no set -e), leaving the
raw SHA in go.mod. The subsequent go work use then fails with
"version must be of the form v1.2.3".

Fix by using local path replaces instead — the operator source is
already checked out at {{ operator.src }}, so no network access or
version resolution is needed. Also add set -e to surface any future
failures immediately.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign dasm for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@lmiccini lmiccini changed the title [DNM][TEST}[operator_build] Use local path replace for go.mod in meta operator [DNM][TEST][operator_build] Use local path replace for go.mod in meta operator Jul 23, 2026
@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/00bd2271649a45158745b6bcb867d69f

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 44m 31s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 30m 08s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 39m 48s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 29m 04s
✔️ cifmw-pod-zuul-files SUCCESS in 5m 37s
✔️ openstack-k8s-operators-content-provider-bootc SUCCESS in 2h 18m 46s
✔️ cifmw-crc-podified-edpm-baremetal-bootc SUCCESS in 1h 42m 39s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 9m 05s
✔️ cifmw-pod-pre-commit SUCCESS in 9m 17s
✔️ ci-framework-openstack-meta-content-provider SUCCESS in 15m 20s
cifmw-molecule-operator_build FAILURE in 5m 30s

lmiccini and others added 3 commits July 24, 2026 06:20
The previous fix used local path replaces which broke the bindata
step — pin-bundle-images.sh parses go.mod replace directives to
extract commit SHAs for bundle image tags, and local paths have no
version info.

Instead, construct a proper Go pseudo-version (v0.0.0-DATE-HASH)
from the commit metadata before calling go mod edit. This gives a
valid go.mod version that both go work use and pin-bundle-images.sh
can handle.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
git --date=format: uses the commit's original timezone, not UTC.
Go pseudo-versions require UTC timestamps. Switch to
--date=format-local: with TZ=UTC to convert correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
go mod tidy resolves raw commit SHAs to proper pseudo-versions,
but its failure was silently swallowed because the shell scripts
lacked set -e — the trailing if [ -d ./apis ] returned 0 even
when go mod tidy failed, masking the error. The unresolved raw
SHA then caused go work use to fail with "version must be of
the form v1.2.3".

Adding set -e ensures go mod tidy failures surface immediately.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/62868ec9eed64809a70c2c6894993fac

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 35m 41s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 29m 19s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 42m 22s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 21m 14s
✔️ cifmw-pod-zuul-files SUCCESS in 6m 59s
✔️ openstack-k8s-operators-content-provider-bootc SUCCESS in 2h 19m 15s
✔️ cifmw-crc-podified-edpm-baremetal-bootc SUCCESS in 1h 44m 26s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 10m 44s
✔️ cifmw-pod-pre-commit SUCCESS in 10m 26s
✔️ ci-framework-openstack-meta-content-provider SUCCESS in 14m 34s
cifmw-molecule-operator_build FAILURE in 5m 26s

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