GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(cli): allow options from CLI args or environment variables by nejch · Pull Request #1296 · python-gitlab/python-gitlab Conversation
|
Codecov Report
@@ Coverage Diff @@ ## master #1296 +/- ## ======================================= Coverage 78.26% 78.26% ======================================= Files 12 12 Lines 2894 2894 ======================================= Hits 2265 2265 Misses 629 629
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
We found this PR after we tried including gitlab-cli in a GitLab CI/CD pipeline job. This PR looks like it will achieve what we wanted to do (drive the GitLab API without creating a config file in each job) 🎉 One outstanding wishlist item we had was if the tool could look for the same environment variables that are set inside a GitLab CI/CD job, i.e. CI_JOB_TOKEN, CI_SERVER_URL and so on 1. If the tool shared these varaibles, it could authenticate with the GitLab instance without any extra code written in CI/CD jobs - is that something that has already been considered? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Yes, part of this was meant to implement zero-config for CI jobs. But I need to maybe tweak and add tests to really check all scenarios (for some endpoints, a PAT is needed, so we should allow overriding in a sensible precedence between cli args/env/config files/CI env). Currently the precedence planned is: python-gitlab/gitlab/__init__.py Lines 224 to 232 in cab343c
I'll try to get back to this PR in the coming days :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Aha. I'm blind 👀 That does indeed look like exactly the behaviour we wanted. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
cab343c to
13467c5
Compare
There was an error while loading. Please reload this page.
Codecov Report
@@ Coverage Diff @@ ## master #1296 +/- ## ========================================== + Coverage 91.57% 91.61% +0.03% ========================================== Files 74 74 Lines 4263 4281 +18 ========================================== + Hits 3904 3922 +18 Misses 359 359
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
13467c5 to
a998970
Compare
|
What do you think about using For example: But now that I look at the code I'm not sure where to do the processing to load the environment variable 😟 I'll just leave this comment anyway and maybe it gives you an idea 🤷♂️ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Thanks! Yes, I think it might be useful (not for arg/var exclusive I think but maybe for different types of tokens). But yes sometimes we want to validate those a bit later, because things like CI_JOB_TOKEN might always be present 🤦 I think we just need to write a bunch of tests for expected behaviors in all the possible combinations, and write the code based on that. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
a6390bf to
c60ae1f
Compare
14487b3 to
c6de2f5
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@JohnVillalovos took almost a year to get back to this, but ready for another look 😅 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
c6de2f5 to
fe964dd
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
A few nits. But overall looks good to me. Thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
BREAKING-CHANGE: The gitlab CLI will now accept CLI arguments and environment variables for its global options in addition to configuration file options. This may change behavior for some workflows such as running inside GitLab CI and with certain environment variables configured.
fe964dd to
1158be3
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nejch . Looks good.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
cli command line arguments for url and token CLI usage without configuration file
There was an error while loading. Please reload this page.