Skip to content
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

Use Azure owner in URL for missing token error message #1854

Merged
merged 2 commits into from
Feb 29, 2024

Conversation

jdblischak
Copy link
Member

@jdblischak jdblischak commented Feb 29, 2024

Checklist

  • Added a news entry

Today I ran conda smithy register-ci on a new computer which didn't yet have ~/.conda-smithy/azure.token. It sent me to the URL https://dev.azure.com/conda-forge/_usersSettings/tokens, which I don't have access to. I need to use my Azure account name, ie https://dev.azure.com/jdblischak/_usersSettings/tokens

export AZURE_ORG_OR_USER="jdblischak"
conda smithy register-ci --user "jdblischak" --feedstock_directory . --without-all --with-azure
## No azure token. Create a token at https://dev.azure.com/conda-forge/_usersSettings/tokens and
## put it in ~/.conda-smithy/azure.token

The owner is defined earlier in cli.py, so I inserted it into the error message

owner = args.user or args.organization

Then I confirmed it works as expected

mamba env create --file environment.yml
conda activate conda-smithy
which conda-smithy
python -m pip install -v --no-build-isolation -e .
which conda-smithy
## /home/wsl/mambaforge/envs/conda-smithy/bin/conda-smithy

conda-smithy register-ci --user "custom" --feedstock_directory . --without-all --with-azure
## No azure token. Create a token and
## put it in ~/.conda-smithy/azure.token
## No azure token. Create a token at https://dev.azure.com/custom/_usersSettings/tokens and
## put it in ~/.conda-smithy/azure.token

conda-smithy register-ci --organization "custom" --feedstock_directory . --without-all --with-azure
## No azure token. Create a token and
## put it in ~/.conda-smithy/azure.token
## No azure token. Create a token at https://dev.azure.com/custom/_usersSettings/tokens and
## put it in ~/.conda-smithy/azure.token

There is an earlier error message without the helpful URL in azure_ci_utils.py

print(
"No azure token. Create a token and\n"
"put it in ~/.conda-smithy/azure.token"
)

I was going to update that error message to also include the URL, but then I saw that the URL was purposefully omitted in the original commit (1f6dabe) that added both of these error messages, so I left it alone

Also I confirmed that AZURE_ORG_OR_USER has no effect on this error message. It only determines whether or not it can successfully query Azure Devops

Also I looked at the other URLs to create tokens for the other CI services, but none of them include the user/org

@jdblischak jdblischak requested a review from a team as a code owner February 29, 2024 19:05
@jdblischak
Copy link
Member Author

@conda-forge/core ready for review

@beckermr beckermr merged commit 63ae412 into conda-forge:main Feb 29, 2024
2 checks passed
@jakirkham
Copy link
Member

Just to confirm, this is for feedstocks outside of conda-forge?

@beckermr
Copy link
Member

Yes

@jdblischak jdblischak deleted the azure-token-url branch February 29, 2024 20:11
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.

3 participants