Repository navigation
Merge stable into develop - #1385
Merged
Merged
Conversation
…1293) * fix: target configured default_branch in generators, transforms and checks `InfrahubOperation.branch_name` and `InfrahubCheck.branch_name` resolved the branch from the local Git checkout whenever no explicit branch was passed, ignoring the client's resolved default branch. Runs against a configured `default_branch` therefore failed with `BranchNotFoundError` when the local Git branch did not exist in Infrahub. Resolve the branch from `client.default_branch` instead, which already honours the `default_branch_from_git` config flag, so the Git branch is only used when that flag is enabled. * fix: resolve the Git default branch from the operation's root directory `ConfigBase.default_infrahub_branch` always resolved the local Git branch from the process working directory. Operations and checks are rooted at their own `root_directory`, so with `default_branch_from_git` enabled they could resolve against a different repository than the one they run in. Add `ConfigBase.get_default_infrahub_branch(directory=...)`, which the existing property now delegates to, and pass `root_directory` from `InfrahubOperation` and `InfrahubCheck`. Stub the Git lookup in the branch resolution tests. They previously compared against `get_branch()` evaluated at assert time, which depends on the state of the local checkout and fails outright when it has no active branch, as in CI. * test: cover Git branch resolution from a check's root directory * docs(changelog): call out default branch behaviour change
Deploying infrahub-sdk-python with
|
| Latest commit: |
494e74a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f1f5ec6f.infrahub-sdk-python.pages.dev |
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.
Merging stable into develop after merging pull request #1293.
Summary by cubic
Fixes generators, transforms, and checks targeting the wrong branch, and prevents
BranchNotFoundErrorwhen run without an explicit branch.--branchnow target the configureddefault_branch(INFRAHUB_DEFAULT_BRANCH,mainby default) instead of the local Git checkout's active branch. SetINFRAHUB_DEFAULT_BRANCH_FROM_GIT=trueto keep following the local Git branch.default_branch_from_gitis enabled.Written for commit 494e74a. Summary will update on new commits.