fix: fall back to direct provider registry when init via Hermitcrab mirror fails - #939
Open
mvanhorn wants to merge 2 commits into
Open
fix: fall back to direct provider registry when init via Hermitcrab mirror fails#939mvanhorn wants to merge 2 commits into
mvanhorn wants to merge 2 commits into
Conversation
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.
Summary
Burrito cannot fix Hermitcrab's cache, but it can stop a stale mirror from failing runs: make the runner fall back to the direct registry when init through the network mirror fails. In
internal/utils/runner/network_mirror.go, add aRemoveNetworkMirrorConfig(delete the generatedconfig.tfrcand unsetTF_CLI_CONFIG_FILE) alongsideCreateNetworkMirrorConfig. Ininternal/runner/actions.go, changeExecInitso that whenr.config.Hermitcrab.Enabledis true andr.exec.Init(r.workingDir)returns an error, it logs a warning that the Hermitcrab mirror may be stale or unreachable, removes the mirror config, and retries init once directly against the upstream registry (returning the retry's error if that also fails).Why this matters
On burrito 0.7.0 with the default Hermitcrab provider-cache setup, runners fail
terraform initwith "Failed to query available provider packages ... the previously-selected version X is no longer available" when a provider version released after the Hermitcrab pod started is required. The reporter confirmed Hermitcrab's cached version index for hashicorp/consul was missing 2.22.0 and that restarting Hermitcrab repopulated it. A maintainer (corrieriluca) traced the staleness to Hermitcrab's version-list caching (it refreshes via anIf-Modified-Sincerequest that never invalidates the cache), so the mirror can serve an index that lacks recently released versions indefinitely.See #642.
Testing
config.tfrcis removed,TF_CLI_CONFIG_FILEis unset, init is retried once and its result returned. - Both fail: first init and direct-registry retry fail - error is propagated (run still fails, with a clear log about the mirror). - Hermitcrab disabled: init failure is returned immediately with no retry.Fixes #642