You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/artifacts-helper/NOTES.md
+3-27Lines changed: 3 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
This installs [Azure Artifacts Credential Provider](https://github.com/microsoft/artifacts-credprovider)
2
-
and optionally configures functions which shadow `dotnet`, `nuget`, `npm`, `yarn`, `rush`, and `pnpm` which dynamically sets an authentication token
3
-
for pulling artifacts from a feed before running the command.
2
+
and optionally configures shims which shadow `dotnet`, `nuget`, `npm`, `yarn`, `rush`, and `pnpm`.
3
+
These dynamically sets an authentication token for pulling artifacts from a feed before running the command.
4
4
5
5
For `npm`, `yarn`, `rush`, and `pnpm` this requires that your `~/.npmrc` file is configured to use the ${ARTIFACTS_ACCESSTOKEN}
6
6
environment variable for the `authToken`. A helper script has been added that you can use to write your `~/.npmrc`
@@ -40,28 +40,4 @@ to download the package.
40
40
41
41
## OS Support
42
42
43
-
This feature is tested to work on Debian/Ubuntu and Mariner CBL 2.0
44
-
45
-
## Changing where functions are configured
46
-
47
-
By default, the functions are defined in `/etc/bash.bashrc` and `/etc/zsh/zshrc` if the container user is `root`, otherwise `~/.bashrc` and `~/.zshrc`.
48
-
This default configuration ensures that the functions are always available for any interactive shells.
49
-
50
-
In some cases it can be useful to have the functions written to a non-default location. For example:
51
-
- the configuration file of a shell other than `bash` and `zsh`
52
-
- a custom file which is not a shell configuration script (so that it can be `source`d in non-interactive shells and scripts)
53
-
54
-
To do this, set the `targetFiles` option to the path script path where the functions should be written. Note that the default paths WILL NOT be used
55
-
if the `targetFiles` option is provided, so you may want to include them in the overridden value, or add `source` the custom script in those configurations:
56
-
57
-
```bash
58
-
# .devcontainer/devcontainer.json
59
-
{
60
-
// ...
61
-
"targetFiles": "/custom/path/to/auth-helper.sh"
62
-
}
63
-
64
-
# ~/.bashrc
65
-
66
-
source /custom/path/to/auth-helper.sh
67
-
```
43
+
This feature is tested to work on Debian/Ubuntu and Mariner CBL 2.0
When the feed URL is an Azure Artifacts feed pip will use the keyring helper to provide the credentials needed
74
74
to download the package.
75
75
76
+
## Authentication Helper Wait Behavior
77
+
78
+
The shim scripts (e.g., `dotnet`, `npm`, `nuget`) now include a wait mechanism for the Azure DevOps authentication helper. When invoked, these scripts will:
79
+
80
+
1. Wait up to 3 minutes for the `ado-auth-helper` to become available (configurable via `MAX_WAIT` environment variable)
81
+
2. Display progress indicators every 20 seconds while waiting
82
+
3. Continue execution once authentication is successful
83
+
4.**Continue with the underlying command even if authentication is not available** after the timeout
84
+
85
+
This ensures that package restore operations can proceed even if there's a slight delay in the authentication helper installation, which can occur in some codespace initialization scenarios. Commands will still execute without authentication, though they may fail to access private Azure Artifacts feeds.
86
+
87
+
The scripts are designed to be sourced safely, meaning they won't terminate the calling shell if authentication fails - they will simply return an error code and allow the underlying tool to execute. This allows you to work with public packages or other package sources even when Azure Artifacts authentication is unavailable.
88
+
76
89
## OS Support
77
90
78
91
This feature is tested to work on Debian/Ubuntu and Mariner CBL 2.0
79
92
93
+
## Testing
94
+
95
+
To test this feature locally, you can use the devcontainer CLI:
96
+
97
+
```bash
98
+
# Test all scenarios
99
+
devcontainer features test -f artifacts-helper
100
+
101
+
# Test specific scenario
102
+
devcontainer features test -f artifacts-helper --scenario test_auth_wait
103
+
```
104
+
80
105
## Changing where functions are configured
81
106
82
107
By default, the functions are defined in `/etc/bash.bashrc` and `/etc/zsh/zshrc` if the container user is `root`, otherwise `~/.bashrc` and `~/.zshrc`.
Copy file name to clipboardExpand all lines: src/artifacts-helper/devcontainer-feature.json
+11-2Lines changed: 11 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
{
2
2
"name": "Azure Artifacts Credential Helper",
3
3
"id": "artifacts-helper",
4
-
"version": "2.0.3",
4
+
"version": "3.0.0",
5
5
"description": "Configures Codespace to authenticate with Azure Artifact feeds",
6
6
"options": {
7
7
"nugetURIPrefixes": {
@@ -49,6 +49,11 @@
49
49
"default": true,
50
50
"description": "Create alias for pnpm"
51
51
},
52
+
"shimDirectory": {
53
+
"type": "string",
54
+
"default": "/usr/local/share/codespace-shims",
55
+
"description": "Directory where the shims will be installed. This must be in $PATH, and needs to be as early as possible in priority for the scripts to override the base executables."
56
+
},
52
57
"targetFiles": {
53
58
"type": "string",
54
59
"default": "DEFAULT",
@@ -60,9 +65,13 @@
60
65
"description": "Install Python keyring helper for pip"
0 commit comments