fix(ci): run go mod tidy after storage-e2e replace to survive dependency graph drift#56
Draft
fastrapier wants to merge 1 commit into
Draft
fix(ci): run go mod tidy after storage-e2e replace to survive dependency graph drift#56fastrapier wants to merge 1 commit into
fastrapier wants to merge 1 commit into
Conversation
…ncy graph drift go mod download does not re-resolve the dependency graph after the directory replace to the checked-out storage-e2e@main (or local replaces like ../api in PR merge commits) changes it. MVS can then select module versions absent from the consumer's go.sum, and go test fails with "missing go.sum entry for module providing package ..." (seen in deckhouse/sds-node-configurator PR #321). Run go mod tidy instead: it re-resolves go.mod/go.sum against the actual graph. Mutation is safe because both files are already backed up and restored by the EXIT trap; additionally remove a go.sum created by tidy when the consumer had none, so the working tree is left unchanged. Update script tests for the new behavior.
|
There was a problem hiding this comment.
Pull request overview
Updates the reusable e2e runner script to re-resolve a consumer module’s dependency graph after applying a local replace to the checked-out storage-e2e@main, preventing CI breakage caused by go.sum drift when the effective module graph differs from the pinned revision.
Changes:
- Switch
.github/scripts/e2e-run-tests.shfromgo mod downloadtogo mod tidyafter applying the directoryreplace. - Extend the EXIT trap restore logic to restore
go.sumwhen present, and remove ago.sumcreated bytidywhen none existed originally. - Update
.github/scripts/tests/test-run-tests.shto asserttidyusage and validatego.sumrestore/removal behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.github/scripts/e2e-run-tests.sh |
Runs go mod tidy after applying the storage-e2e directory replace and restores (or removes) go.sum via EXIT trap. |
.github/scripts/tests/test-run-tests.sh |
Updates stubbed go expectations and adds coverage for go.sum restoration/removal. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
.github/scripts/e2e-run-tests.sh(used by the reusablee2e.ymlworkflow) applies a directory replace pointing the consumer module at the checked-outstorage-e2e@mainand then runsgo mod download.downloaddoes not re-resolve the dependency graph, so when the replaced checkout (or another local replace such as../apiin a PR merge commit) changes the graph relative to what the consumer'sgo.mod/go.sumwere resolved against, MVS selects module versions that are missing from the consumer'sgo.sumandgo testfails with:This happened in practice in deckhouse/sds-node-configurator#321.
Solution
go mod tidyinstead ofgo mod download.tidyre-resolvesgo.mod/go.sumagainst the actual (replaced) graph, so consumer CI no longer breaks when the pinned revision andmaindrift apart.go.mod/go.sumis safe: the script already backs both up and restores them via a trap on EXIT. Additionally, if the consumer had nogo.sum, ago.sumcreated bytidyis now removed on exit so the working tree is left unchanged on self-hosted runners..github/scripts/tests/test-run-tests.sh: assertstidy(notdownload) is invoked after the replace,go.sumis restored, and a tidy-createdgo.sumis removed when none existed.Testing
All script tests pass locally: