Skip to content

Conversation

@BaptisteGi
Copy link
Contributor

Before (env variable is ignored):

export | grep INFRAHUB
INFRAHUB_ADDRESS=http://localhost:8000
INFRAHUB_API_TOKEN=06438eb2-8019-4776-878c-0941b1f1d1ecinfrahubctl schema check schema.yml
 schema 'schema.yml' is Valid!
diff:
    added:
        RandomGeneric:
            added: {}
            changed: {}
            removed: {}
        RandomStuff:
            added: {}
            changed: {}
            removed: {}
    changed: {}
    removed: {}export INFRAHUB_DEFAULT_BRANCH="doesntexist"infrahubctl schema check schema.yml
 schema 'schema.yml' is Valid!
diff:
    added:
        RandomGeneric:
            added: {}
            changed: {}
            removed: {}
        RandomStuff:
            added: {}
            changed: {}
            removed: {}
    changed: {}
    removed: {}

After (Take into account the env variable + If there is no default branch set then fallback on default branch set in SDK):

export | grep INFRAHUB
INFRAHUB_ADDRESS=http://localhost:8000
INFRAHUB_API_TOKEN=06438eb2-8019-4776-878c-0941b1f1d1ecinfrahubctl schema check schema.yml
 schema 'schema.yml' is Valid!
diff:
    added:
        RandomGeneric:
            added: {}
            changed: {}
            removed: {}
        RandomStuff:
            added: {}
            changed: {}
            removed: {}
    changed: {}
    removed: {}export INFRAHUB_DEFAULT_BRANCH="doesntexist"infrahubctl schema check schema.yml
HTTP communication failure: Client error '400 Bad Request' for url 'http://localhost:8000/api/schema/check?branch=doesntexist'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400 on POST to http://localhost:8000/api/schema/check?branch=doesntexist

resolves: #264

@BaptisteGi BaptisteGi requested a review from a team February 12, 2025 13:08
@codecov
Copy link

codecov bot commented Feb 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

@@            Coverage Diff             @@
##           stable     #270      +/-   ##
==========================================
- Coverage   70.36%   70.34%   -0.03%     
==========================================
  Files          82       82              
  Lines        7502     7502              
  Branches     1391     1391              
==========================================
- Hits         5279     5277       -2     
- Misses       1849     1850       +1     
- Partials      374      375       +1     
Flag Coverage Δ
integration-tests 22.44% <0.00%> (ø)
python-3.10 45.56% <100.00%> (-0.03%) ⬇️
python-3.11 45.56% <100.00%> (-0.03%) ⬇️
python-3.12 45.56% <100.00%> (-0.03%) ⬇️
python-3.13 45.56% <100.00%> (-0.03%) ⬇️
python-3.9 45.56% <100.00%> (-0.03%) ⬇️
python-filler-3.12 23.95% <0.00%> (ø)

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

Files with missing lines Coverage Δ
infrahub_sdk/ctl/cli_commands.py 58.59% <ø> (ø)
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 81.57% <100.00%> (ø)
infrahub_sdk/ctl/schema.py 55.83% <ø> (ø)

... and 1 file with indirect coverage changes

@BaptisteGi BaptisteGi marked this pull request as draft February 12, 2025 13:35
@BaptisteGi BaptisteGi marked this pull request as ready for review February 12, 2025 13:53
Copy link
Contributor

@BeArchiTek BeArchiTek left a comment

Choose a reason for hiding this comment

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

LGTM, wonder if there isn't more to do on the rest of the SDK as well

@BaptisteGi BaptisteGi requested a review from wvandeun February 18, 2025 08:32
@dgarros
Copy link
Contributor

dgarros commented Feb 20, 2025

@wvandeun @BaptisteGi are we good to merge this PR ?
I would like to merge #259 and this PR will introduce some conflicts so I would rather merge this one first

@BaptisteGi BaptisteGi merged commit 73cda31 into stable Feb 21, 2025
15 checks passed
@BaptisteGi BaptisteGi deleted the bgi-remove-default-branch-value-264 branch February 21, 2025 09:17
dgarros pushed a commit that referenced this pull request Feb 23, 2025
…TL commands (#270)

* Remove default value main for branch parameter

* Changelog

* Remove branch parameter from repository commands as node is branch agnostic

* Add None for username

* Remove branch parameter from tests

* Remove branch parameter from test

* Add option to list repository by branch

* Adjust parameter help
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.

task: Remove hardcoded main default value from CLI commands

4 participants