Skip to content

azure-pipelines: properly expand negotiate passwords #5375

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

Merged
merged 1 commit into from
Jan 31, 2020

Conversation

pks-t
Copy link
Member

@pks-t pks-t commented Jan 31, 2020

To allow testing against a Kerberos instance, we have added variables
for the Kerberos password to allow authentication against LIBGIT2.ORG in
commit e5fb5fe (ci: perform SPNEGO tests, 2019-10-20). To set up the
password, we assign

"GITTEST_NEGOTIATE_PASSWORD=$(GITTEST_NEGOTIATE_PASSWORD)"

in the environmentVariables section which is then passed through to a
template. As the template does build-time expansion of the environment
variables, it will expand the above line verbosely, and due to the
envVar section not doing any further expansion the password variable
will end up with the value "$(GITTEST_NEGOTIATE_PASSWORD)" in the
container's environment.

Fix this fixed by doing expansion of GITTEST_NEGOTIATE_PASSWORD at
build-time, as well.

@pks-t pks-t force-pushed the pks/test-ci branch 3 times, most recently from d23860b to 7407275 Compare January 31, 2020 11:46
To allow testing against a Kerberos instance, we have added variables
for the Kerberos password to allow authentication against LIBGIT2.ORG in
commit e5fb5fe (ci: perform SPNEGO tests, 2019-10-20). To set up the
password, we assign

    "GITTEST_NEGOTIATE_PASSWORD=$(GITTEST_NEGOTIATE_PASSWORD)"

in the environmentVariables section which is then passed through to a
template. As the template does build-time expansion of the environment
variables, it will expand the above line verbosely, and due to the
envVar section not doing any further expansion the password variable
will end up with the value "$(GITTEST_NEGOTIATE_PASSWORD)" in the
container's environment.

Fix this fixed by doing expansion of GITTEST_NEGOTIATE_PASSWORD at
build-time, as well.
@ethomson
Copy link
Member

The reason that this is failing is because you're opening a pull request from a fork. Azure Pipelines doesn't provide secrets to forks, to prevent untrusted users from exfiltrating secrets. (The idea being that people with write access to the repository are trusted - which in our case is a pretty reasonable assumption).

I think that we should just disable the negotiate tests for now, since everybody's PRs will fail unless they're opening them from the main repository. Long term we should test whether the build is coming from a fork or the main repository, and only run the negotiate tests on the latter. But we can follow up with that in a different PR.

@pks-t
Copy link
Member Author

pks-t commented Jan 31, 2020

I think that we should just disable the negotiate tests for now, since everybody's PRs will fail unless they're opening them from the main repository. Long term we should test whether the build is coming from a fork or the main repository, and only run the negotiate tests on the latter. But we can follow up with that in a different PR.

Well, yeah. The root cause though is that variable expansion in azure-pipelines.yml doesn't work as we think it does. Because of that, GITTEST_NEGOTIATE_PASSWORD always equals "$(GITTEST_NEGOTIATE_PASSWORD)" (yup, not expanded), which my PR should fix now. If we use the "correct" variable expansion, then we automatically disable the SPNEGO tests as the variable is empty, which we check for.

@pks-t pks-t changed the title Test for Pipeline azure-pipelines: properly expand negotiate passwords Jan 31, 2020
@pks-t
Copy link
Member Author

pks-t commented Jan 31, 2020

Green now. I've updated title and description.

@ethomson
Copy link
Member

Now that I'm on my computer, I see what you're saying.

@ethomson ethomson merged commit a1bff63 into libgit2:master Jan 31, 2020
@pks-t pks-t deleted the pks/test-ci branch January 31, 2020 14:22
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.

2 participants