Skip to content

Conversation

@BaptisteGi
Copy link
Contributor

@BaptisteGi BaptisteGi commented Feb 6, 2025

  • protocols command properly gets default branch setting from environment variable

resolves: #104

@BaptisteGi BaptisteGi requested a review from ogenstad February 6, 2025 16:41
@codecov
Copy link

codecov bot commented Feb 6, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
infrahub_sdk/ctl/cli_commands.py 0.00% 1 Missing ⚠️
@@            Coverage Diff             @@
##           stable     #263      +/-   ##
==========================================
- Coverage   70.37%   70.35%   -0.02%     
==========================================
  Files          82       82              
  Lines        7503     7498       -5     
  Branches     1391     1389       -2     
==========================================
- Hits         5280     5275       -5     
  Misses       1849     1849              
  Partials      374      374              
Flag Coverage Δ
integration-tests 22.45% <0.00%> (-0.06%) ⬇️
python-3.10 45.55% <0.00%> (+0.03%) ⬆️
python-3.11 45.55% <0.00%> (+0.03%) ⬆️
python-3.12 45.55% <0.00%> (+0.03%) ⬆️
python-3.13 45.55% <0.00%> (+0.03%) ⬆️
python-3.9 45.55% <0.00%> (+0.03%) ⬆️
python-filler-3.12 23.96% <0.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/ctl/exporter.py 50.00% <ø> (ø)
infrahub_sdk/ctl/importer.py 57.14% <ø> (ø)
infrahub_sdk/ctl/menu.py 65.38% <ø> (ø)
infrahub_sdk/ctl/object.py 65.38% <ø> (ø)
infrahub_sdk/ctl/repository.py 80.55% <ø> (ø)
infrahub_sdk/ctl/schema.py 55.83% <ø> (ø)
infrahub_sdk/ctl/cli_commands.py 58.59% <0.00%> (-0.23%) ⬇️

... and 1 file with indirect coverage changes

@BaptisteGi BaptisteGi self-assigned this Feb 7, 2025
debug: bool = False,
_: str = CONFIG_PARAM,
branch: str = typer.Option("main", help="Branch on which to run the script."),
branch: str = typer.Option("main", help="Branch on which to run the script."), # TODO: Replace main by None
Copy link
Contributor

@FragmentedPacket FragmentedPacket Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not understanding the change here, should it be setting the default to None?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion throughout infrahubctl the branch parameter should be an optional string defaulting to None and if not specified we should either not specify the branch or use the default branch provided by the SDK which will default to "main", alternatively something else if the SDK is configured that way with some environment variable.

Copy link
Contributor Author

@BaptisteGi BaptisteGi Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep with the current setup you can't use environment variable INFRAHUB_DEFAULT_BRANCH.

 ➜  export INFRAHUB_DEFAULT_BRANCH="test1"
 ➜  infrahubctl schema load some.yml   
 The schema in Infrahub was is already up to date, no changes were required
 1 schema processed in 0.138 seconds.

=> This loads schema to main branch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the issue to fix all remaining commands #264 I guess it could be breaking someone's workflow ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might, although hopefully it wouldn't be that impactful as any changes would be done against a non main branch. But worth including in a changelog to indicate this updated behaviour. Not sure if we need all those todo comments when we have #264, but they might be easier to find I guess.

@BaptisteGi BaptisteGi merged commit aa65bb0 into stable Feb 11, 2025
15 checks passed
@BaptisteGi BaptisteGi deleted the bgi-align-explicit-branch branch February 11, 2025 15:39
dgarros pushed a commit that referenced this pull request Feb 23, 2025
* Get default branch from env

* Add comment on all hardcoded main branch to be fixed later

* Add release note
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.

bug: Infrahubctl protocols command requires explicit branch

3 participants