-
Notifications
You must be signed in to change notification settings - Fork 14
Fix for wrapper scripts not being applied in non-interactive environments #85
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
base: main
Are you sure you want to change the base?
Changes from all commits
c298b99
12248b7
e34adf2
47b524b
16c0297
f959bcc
69a5174
0507d68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| { | ||
| "name": "Azure Artifacts Credential Helper", | ||
| "id": "artifacts-helper", | ||
| "version": "2.0.3", | ||
| "version": "3.0.0", | ||
| "description": "Configures Codespace to authenticate with Azure Artifact feeds", | ||
| "options": { | ||
| "nugetURIPrefixes": { | ||
|
|
@@ -49,6 +49,11 @@ | |
| "default": true, | ||
| "description": "Create alias for pnpm" | ||
| }, | ||
| "shimDirectory": { | ||
| "type": "string", | ||
| "default": "/usr/local/share/codespace-shims", | ||
| "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." | ||
| }, | ||
| "targetFiles": { | ||
| "type": "string", | ||
| "default": "DEFAULT", | ||
|
|
@@ -60,9 +65,13 @@ | |
| "description": "Install Python keyring helper for pip" | ||
| } | ||
| }, | ||
| "containerEnv": { | ||
| "PATH": "/usr/local/share/codespace-shims:${PATH}" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This had to be hard-coded, since using something like |
||
| }, | ||
| "installsAfter": [ | ||
| "ghcr.io/devcontainers/features/common-utils", | ||
| "ghcr.io/devcontainers/features/python" | ||
| "ghcr.io/devcontainers/features/python", | ||
| "ghcr.io/devcontainers/features/node" | ||
| ], | ||
| "customizations": { | ||
| "vscode": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/bin/bash | ||
|
|
||
| echo "::step::Waiting for AzDO Authentication Helper..." | ||
|
|
||
| # Wait up to 3 minutes for the ado-auth-helper to be installed | ||
| # Can be overridden via environment variable for testing | ||
| MAX_WAIT=${MAX_WAIT:-180} | ||
| ELAPSED=0 | ||
|
|
||
| while [ $ELAPSED -lt $MAX_WAIT ]; do | ||
| if [ -f "${HOME}/ado-auth-helper" ]; then | ||
| echo "::step::Running ado-auth-helper get-access-token..." | ||
| ARTIFACTS_ACCESSTOKEN=$(${HOME}/ado-auth-helper get-access-token) | ||
| echo "::step::✓ Access token retrieved successfully" | ||
| return 0 | ||
| fi | ||
| sleep 2 | ||
| ELAPSED=$((ELAPSED + 2)) | ||
|
|
||
| # Progress indicator every 20 seconds | ||
| if [ $((ELAPSED % 20)) -eq 0 ]; then | ||
| echo " Still waiting... (${ELAPSED}s elapsed)" | ||
| fi | ||
| done | ||
|
|
||
| # Timeout reached - continue without authentication | ||
| echo "::warning::AzDO Authentication Helper not found after ${MAX_WAIT} seconds" | ||
| echo "Expected location: ${HOME}/ado-auth-helper" | ||
| echo "Continuing without Azure Artifacts authentication..." | ||
| return 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/bash | ||
| source "$(dirname $0)"/auth-ado.sh | ||
| source "$(dirname $0)"/resolve-shim.sh | ||
|
|
||
| # Install artifact credential provider if it is not already installed | ||
| if [ ! -d "${HOME}/.nuget/plugins/netcore" ]; then | ||
| wget -qO- https://aka.ms/install-artifacts-credprovider.sh | bash | ||
| fi | ||
markphip marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| DOTNET_EXE="$(resolve_shim)" | ||
| VSS_NUGET_ACCESSTOKEN="${ARTIFACTS_ACCESSTOKEN:-}" VSS_NUGET_URI_PREFIXES=REPLACE_WITH_AZURE_DEVOPS_NUGET_FEED_URL_PREFIX ${DOTNET_EXE} "$@" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #!/bin/bash | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These all (apart from dotnet + nuget) could be auto-generated, since they are identical except in naming. |
||
| source "$(dirname $0)"/auth-ado.sh | ||
| source "$(dirname $0)"/resolve-shim.sh | ||
|
|
||
| NPM_EXE="$(resolve_shim)" | ||
| ARTIFACTS_ACCESSTOKEN="${ARTIFACTS_ACCESSTOKEN:-}" ${NPM_EXE} "$@" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #!/bin/bash | ||
| source "$(dirname $0)"/auth-ado.sh | ||
| source "$(dirname $0)"/resolve-shim.sh | ||
|
|
||
| NPX_EXE="$(resolve_shim)" | ||
| ARTIFACTS_ACCESSTOKEN="${ARTIFACTS_ACCESSTOKEN:-}" ${NPX_EXE} "$@" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/bash | ||
| source "$(dirname $0)"/auth-ado.sh | ||
| source "$(dirname $0)"/resolve-shim.sh | ||
|
|
||
| # Install artifact credential provider if it is not already installed | ||
| if [ ! -d "${HOME}/.nuget/plugins/netcore" ]; then | ||
| wget -qO- https://aka.ms/install-artifacts-credprovider.sh | bash | ||
| fi | ||
|
|
||
| NUGET_EXE="$(resolve_shim)" | ||
| VSS_NUGET_ACCESSTOKEN="${ARTIFACTS_ACCESSTOKEN:-}" VSS_NUGET_URI_PREFIXES=REPLACE_WITH_AZURE_DEVOPS_NUGET_FEED_URL_PREFIX ${NUGET_EXE} "$@" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #!/bin/bash | ||
| source "$(dirname $0)"/auth-ado.sh | ||
| source "$(dirname $0)"/resolve-shim.sh | ||
|
|
||
| PNPM_EXE="$(resolve_shim)" | ||
| ARTIFACTS_ACCESSTOKEN="${ARTIFACTS_ACCESSTOKEN:-}" ${PNPM_EXE} "$@" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #!/bin/bash | ||
| source "$(dirname $0)"/auth-ado.sh | ||
| source "$(dirname $0)"/resolve-shim.sh | ||
|
|
||
| PNPX_EXE="$(resolve_shim)" | ||
| ARTIFACTS_ACCESSTOKEN="${ARTIFACTS_ACCESSTOKEN:-}" ${PNPX_EXE} "$@" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/bin/bash | ||
| [[ ${RESOLVE_SHIMS_IMPORTED} == "true" ]] && return | ||
| RESOLVE_SHIMS_IMPORTED=true | ||
|
Comment on lines
+2
to
+3
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Useful to avoid the function being redefined according to Copilot. Probably unnecessary. |
||
|
|
||
| resolve_shim() { | ||
| # Find the next non-shim executable in PATH so we do not run the shim again | ||
| shim_file="$(readlink -f "${BASH_SOURCE[1]}")" | ||
| executable="$(basename "$shim_file")" | ||
|
|
||
| # Read into array first to handle spaces properly | ||
| readarray -t candidates < <(which -a "$executable" 2>/dev/null) | ||
|
|
||
| for candidate in "${candidates[@]}"; do | ||
| # Skip any candidate which is a symlink to the shim file | ||
| [[ "$(readlink -f "$candidate")" != "$shim_file" ]] && { | ||
| echo "$candidate" | ||
| return 0 | ||
| } | ||
| done | ||
|
|
||
| return 1 | ||
| } | ||
This file was deleted.
This file was deleted.
This file was deleted.
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.
This file cannot be edited. It is generated by the release process so this will all be lost. This content needs to go into NOTES.md and that will cause it to be added to README.md when the release is created