-
Notifications
You must be signed in to change notification settings - Fork 658
Fix environment variable parsing for authentication #2277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…rname options intead of setting the Password option. Also make sure authentication is set even if no other command line arguments are present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
@arturcic Thanks! Still some authentication on my end, I'm getting a "Could not find a 'develop' or 'master' branch, neither locally nor remotely." when in a Docker build running on GitLab CI. This didn't end up fixing it, but we're getting closer maybe... |
You should pass the GitLab env vars to the docker run from the GitLab pipeline |
@arturcic Yikes, getting a NullReference now: /root/.nuget/packages/gitversiontask/5.4.0-pullrequest2277-50/build/GitVersionTask.targets(10,9): error : NullReferenceException: Object reference not set to an instance of an object. [/src/Services.Common/Services.Common.csproj] Which seems to be this line: |
You are using GitversionTask it Gitversion.Tool? As what you fixed is for the tool, not the task |
Is there any way of passing parameters to the MsBuild task? I could use the dynamic repository feature to make sure it has access to everything it needs, instead of copying the .git repository into the Docker image. Using the GitVersionTask, I was looking through the code to see if I could trace my change into the task but it doesn't look like it. Looks like the documentation is not accurate, then. https://gitversion.readthedocs.io/en/latest/input/docs/usage/msbuild-task/ At the very bottom of the page. |
@arturcic I figured the Task is an elegant way to make it work both locally, and from the CI, sort of seamlessly. Is there any way to achieve the same thing with the EXE? For example, I have a test validating that my ASP.NET Core endpoint can return the Git version, when I run the tests on my local machine, when the tests are run in the CI, and when the application is deployed. Is there a way to have a similar sort of workflow with the EXE? |
Fix an issue where GITVERSION_REMOTE_PASSWORD would overwrite the Username options intead of setting the Password option.
Also make sure authentication is set even if no other command line arguments are present.
Description
Changed the one-liner where the assignation happens in ArgumentParser.cs. Pretty self-evident change. Relevant unit tests have been added.
While making this change, I realized that my tests failed when no other command line arguments were passed. I made sure to add authentication even in the case where no other command line arguments exist, and added relevant unit tests.
Related Issue
Fixes #2276
Motivation and Context
I need this to get GitVersion working in a GitLab CI build that needs authentication because it builds with Docker.
How Has This Been Tested?
I have added 4 relevant unit tests.
Checklist: