GuillaumeRobinInarix
GuillaumeRobinInarix•10mo ago

Import package from Azure DevOps repository

Hi ! 👋 I'm trying to import a private package from Azure DevOps Git repository. I can't make it work. Anyone has tried that before? I've seen the Github example with PAT and Azure DevOps is using a PAT as well.
7 Replies
Deno AI Helper
Deno AI Helper•10mo ago
Hello! 👋 To import a private package from an Azure DevOps Git repository, you can use a Personal Access Token (PAT) similar to how you would with GitHub. The documentation mentions that Deno supports sending bearer tokens when requesting remote modules, which are broadly supported by hosting services like GitHub, GitLab, Bitbucket, and others. Although Azure DevOps is not explicitly mentioned, the process should be similar. Here's what you need to do: 1. Generate a Personal Access Token (PAT) in Azure DevOps with the appropriate permissions to access the repository. 2. Set the DENO_AUTH_TOKENS environment variable with your PAT and the Azure DevOps repository URL. The format for the DENO_AUTH_TOKENS environment variable is as follows:
DENO_AUTH_TOKENS=your_pat@dev.azure.com

DENO_AUTH_TOKENS=your_pat@dev.azure.com

Replace your_pat with the PAT you generated and adjust the hostname (dev.azure.com) if necessary to match your Azure DevOps domain. 3. When you import the package in your Deno code, use the full URL to the package in the Azure DevOps repository. Deno will use the PAT provided in the DENO_AUTH_TOKENS environment variable to authenticate the request. Remember to keep your PAT secure and do not commit it to your source code. You may want to use environment variables or secret management tools to handle the PAT securely. If you encounter any issues, make sure that the PAT has the correct scope for accessing the repository and that the URL to the package is correct. 🦕
GuillaumeRobinInarix
GuillaumeRobinInarixOP•10mo ago
It isn't possible. Wrong information here... Sad to be answered by a bot 😦
Thomas
Thomas•10mo ago
Why? It should work. See the documentation: https://docs.deno.com/runtime/manual/basics/modules/private
Private Modules and Repositories | Deno Docs
There may be instances where you want to load a remote module that is located in
Thomas
Thomas•10mo ago
Okay, I was curious and tried it with Gitlab (don't have access to an Azure DevOps) and also failed.
GDream Studio
GDream Studio•9mo ago
I could only make it work with Github. I think it's linked to how Azure DevOps manages raw content. Unlike Github, which uses https://raw.githubusercontent.com/username/repository/branch/filename, Azure DevOps uses URL query parameters to point to the right file. @rbetts Sorry to ping you. Do you have any information about this subject?
MariusVatasoiu
MariusVatasoiu•9mo ago
I had recently the same issue. Couldn't find a solution. I was expecting that by setting the npm registry and the PAT with DENO_AUTH_TOKENS to work. No luck! Might be related with the URL generated by Deno to download the package vs. the URL npm is using. As a work around, I had to use npm install for npm packages, which is not ideal.
lucsoft
lucsoft•9mo ago
why would it be wrong? this is the the way we are using BitBucket's api just to pull everything we need using the what the bot posted

Did you find this page helpful?