Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,9 @@ jobs:
TEST_LOG_PATH: ${{ github.workspace }}/artifacts/log/test-logs
TestsRunningOutsideOfRepo: true
TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX: 'netaspireci.azurecr.io'
# CLI E2E Dockerfiles consume this as a build arg to avoid overloaded default Ubuntu package servers.
# azure.archive.ubuntu.com does not serve HTTPS; HTTP is intentional and matches the GitHub-hosted Ubuntu runner fallback mirror.
ASPIRE_E2E_UBUNTU_APT_MIRROR: ${{ runner.os == 'Linux' && (runner.arch == 'ARM64' && 'https://azure.ports.ubuntu.com/ubuntu-ports/' || 'http://azure.archive.ubuntu.com/ubuntu/') || '' }}
# CLI E2E Dockerfiles consume this as a build arg. ARM64 images need the Ubuntu ports archive;
# x64 images use their default Ubuntu sources to avoid pinning to a transiently unavailable mirror.
ASPIRE_E2E_UBUNTU_APT_MIRROR: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' && 'https://azure.ports.ubuntu.com/ubuntu-ports/' || '' }}
# PR metadata for CLI E2E tests that download artifacts from a PR
GITHUB_PR_NUMBER: ${{ fromJson(inputs.properties).requiresCliArchive == true && github.event.pull_request.number || '' }}
GITHUB_PR_HEAD_SHA: ${{ fromJson(inputs.properties).requiresCliArchive == true && github.event.pull_request.head.sha || '' }}
Expand Down Expand Up @@ -431,9 +431,9 @@ jobs:
NUGET_PACKAGES: ${{ github.workspace }}/.packages
PLAYWRIGHT_INSTALLED: ${{ fromJson(inputs.properties).enablePlaywrightInstall != true && 'false' || 'true' }}
TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX: 'netaspireci.azurecr.io'
# CLI E2E Dockerfiles consume this as a build arg to avoid overloaded default Ubuntu package servers.
# azure.archive.ubuntu.com does not serve HTTPS; HTTP is intentional and matches the GitHub-hosted Ubuntu runner fallback mirror.
ASPIRE_E2E_UBUNTU_APT_MIRROR: ${{ runner.os == 'Linux' && (runner.arch == 'ARM64' && 'https://azure.ports.ubuntu.com/ubuntu-ports/' || 'http://azure.archive.ubuntu.com/ubuntu/') || '' }}
# CLI E2E Dockerfiles consume this as a build arg. ARM64 images need the Ubuntu ports archive;
# x64 images use their default Ubuntu sources to avoid pinning to a transiently unavailable mirror.
ASPIRE_E2E_UBUNTU_APT_MIRROR: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' && 'https://azure.ports.ubuntu.com/ubuntu-ports/' || '' }}
# PR metadata for CLI E2E tests that download artifacts from a PR
GITHUB_PR_NUMBER: ${{ fromJson(inputs.properties).requiresCliArchive == true && github.event.pull_request.number || '' }}
GITHUB_PR_HEAD_SHA: ${{ fromJson(inputs.properties).requiresCliArchive == true && github.event.pull_request.head.sha || '' }}
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ jobs:
extension_tests_win:
name: Run VS Code extension tests (Windows)
runs-on: windows-latest
env:
YARN_NPM_ALWAYS_AUTH: 'false'
YARN_NPM_REGISTRY_SERVER: https://registry.npmjs.org
defaults:
run:
working-directory: ./extension
Expand All @@ -286,8 +289,14 @@ jobs:
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: '20.x'
- name: Setup Yarn
run: |
npm install -g corepack@0.34.7 --force
corepack enable yarn
corepack prepare yarn@4.14.1 --activate
yarn --version
- name: Install dependencies
run: npm install
run: yarn install --immutable
- name: Run tests
run: npm test
- name: Override extension version for PR builds
Expand All @@ -296,7 +305,7 @@ jobs:
EXTENSION_VERSION: ${{ inputs.extensionVersionOverride }}
run: npm version "$EXTENSION_VERSION" --no-git-tag-version
- name: Package VSIX
run: npm exec @vscode/vsce -- package --pre-release -o out/aspire-extension.vsix
run: npm exec @vscode/vsce -- package --pre-release --no-dependencies -o out/aspire-extension.vsix
- name: Upload VSIX
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ config.ps1

# Node.js modules
node_modules/
.pnp.*
.yarn/

# Generated Aspire polyglot modules
.modules/
Expand Down
38 changes: 37 additions & 1 deletion eng/pipelines/azure-pipelines-codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,48 @@ jobs:
inputs:
versionSpec: '20.x'

- task: npmAuthenticate@0
displayName: NPM authenticate
inputs:
workingFile: $(Build.SourcesDirectory)\.npmrc

- task: PowerShell@2
displayName: Set npm/yarn auth environment
inputs:
targetType: 'inline'
script: |
$ErrorActionPreference = 'Stop'
$npmrcPath = "$(Build.SourcesDirectory)\.npmrc"
Write-Host "##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$npmrcPath"

$npmrc = Get-Content $npmrcPath
$tokenLine = $npmrc | Where-Object { $_ -match ':_authToken=' } | Select-Object -First 1
if ($tokenLine) {
$token = ($tokenLine -split '=', 2)[1]
Write-Host "##vso[task.setvariable variable=YARN_NPM_AUTH_TOKEN;issecret=true]$token"
exit 0
}

$usernameLine = $npmrc | Where-Object { $_ -match ':username=' } | Select-Object -First 1
$passwordLine = $npmrc | Where-Object { $_ -match ':_password=' } | Select-Object -First 1
if ($usernameLine -and $passwordLine) {
$username = ($usernameLine -split '=', 2)[1]
$encodedPassword = ($passwordLine -split '=', 2)[1]
$password = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encodedPassword))
Write-Host "##vso[task.setvariable variable=YARN_NPM_AUTH_IDENT;issecret=true]$username`:$password"
exit 0
}

Write-Error "Could not find npm auth credentials in $npmrcPath."

- task: PowerShell@2
displayName: Install yarn
inputs:
targetType: 'inline'
script: |
npm install -g yarn@1.22.22
npm install -g corepack@0.34.7 --force
corepack enable yarn
corepack prepare yarn@4.14.1 --activate
yarn --version
workingDirectory: '$(Build.SourcesDirectory)'

Expand Down
31 changes: 28 additions & 3 deletions eng/pipelines/azure-pipelines-unofficial.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,42 @@ extends:
workingFile: $(Build.SourcesDirectory)\.npmrc

- task: PowerShell@2
displayName: 🟣Set .npmrc environment
displayName: 🟣Set npm/yarn auth environment
inputs:
targetType: 'inline'
script: Write-Host "##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(Build.SourcesDirectory)\.npmrc"
script: |
$ErrorActionPreference = 'Stop'
$npmrcPath = "$(Build.SourcesDirectory)\.npmrc"
Write-Host "##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$npmrcPath"

$npmrc = Get-Content $npmrcPath
$tokenLine = $npmrc | Where-Object { $_ -match ':_authToken=' } | Select-Object -First 1
if ($tokenLine) {
$token = ($tokenLine -split '=', 2)[1]
Write-Host "##vso[task.setvariable variable=YARN_NPM_AUTH_TOKEN;issecret=true]$token"
exit 0
}

$usernameLine = $npmrc | Where-Object { $_ -match ':username=' } | Select-Object -First 1
$passwordLine = $npmrc | Where-Object { $_ -match ':_password=' } | Select-Object -First 1
if ($usernameLine -and $passwordLine) {
$username = ($usernameLine -split '=', 2)[1]
$encodedPassword = ($passwordLine -split '=', 2)[1]
$password = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encodedPassword))
Write-Host "##vso[task.setvariable variable=YARN_NPM_AUTH_IDENT;issecret=true]$username`:$password"
exit 0
}

Write-Error "Could not find npm auth credentials in $npmrcPath."

- task: PowerShell@2
displayName: 🟣Install yarn
inputs:
targetType: 'inline'
script: |
npm install -g yarn@1.22.22
npm install -g corepack@0.34.7 --force
corepack enable yarn
corepack prepare yarn@4.14.1 --activate
yarn --version
workingDirectory: '$(Build.SourcesDirectory)'

Expand Down
31 changes: 28 additions & 3 deletions eng/pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,42 @@ extends:
workingFile: $(Build.SourcesDirectory)\.npmrc

- task: PowerShell@2
displayName: 🟣Set .npmrc environment
displayName: 🟣Set npm/yarn auth environment
inputs:
targetType: 'inline'
script: Write-Host "##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(Build.SourcesDirectory)\.npmrc"
script: |
$ErrorActionPreference = 'Stop'
$npmrcPath = "$(Build.SourcesDirectory)\.npmrc"
Write-Host "##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$npmrcPath"

$npmrc = Get-Content $npmrcPath
$tokenLine = $npmrc | Where-Object { $_ -match ':_authToken=' } | Select-Object -First 1
if ($tokenLine) {
$token = ($tokenLine -split '=', 2)[1]
Write-Host "##vso[task.setvariable variable=YARN_NPM_AUTH_TOKEN;issecret=true]$token"
exit 0
}

$usernameLine = $npmrc | Where-Object { $_ -match ':username=' } | Select-Object -First 1
$passwordLine = $npmrc | Where-Object { $_ -match ':_password=' } | Select-Object -First 1
if ($usernameLine -and $passwordLine) {
$username = ($usernameLine -split '=', 2)[1]
$encodedPassword = ($passwordLine -split '=', 2)[1]
$password = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encodedPassword))
Write-Host "##vso[task.setvariable variable=YARN_NPM_AUTH_IDENT;issecret=true]$username`:$password"
exit 0
}

Write-Error "Could not find npm auth credentials in $npmrcPath."

- task: PowerShell@2
displayName: 🟣Install yarn
inputs:
targetType: 'inline'
script: |
npm install -g yarn@1.22.22
npm install -g corepack@0.34.7 --force
corepack enable yarn
corepack prepare yarn@4.14.1 --activate
yarn --version
workingDirectory: '$(Build.SourcesDirectory)'

Expand Down
6 changes: 6 additions & 0 deletions extension/.vscodeignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
.vscode/**
.vscode-test
.vscode-test/**
out
out/**
node_modules
node_modules/**
src/**
.gitignore
.yarnrc
.yarnrc.yml
.yarn
.yarn/**
webpack.config.js
vsc-extension-quickstart.md
**/tsconfig.json
Expand Down
2 changes: 0 additions & 2 deletions extension/.yarnrc

This file was deleted.

7 changes: 7 additions & 0 deletions extension/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
enableScripts: true

nodeLinker: node-modules

npmAlwaysAuth: true

npmRegistryServer: "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/"
2 changes: 1 addition & 1 deletion extension/CONTRIBUTING.MD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Install Prerequisites

- Node.js (LTS version)
- NPM and yarn accessible in the PATH
- NPM and Corepack accessible in the PATH. Use Corepack to enable the Yarn version pinned in `package.json`.
- Visual Studio Code (latest) or Visual Studio Code Insiders
- [Aspire CLI](https://aspire.dev/get-started/install-cli/) must be installed and available in the PATH

Expand Down
9 changes: 7 additions & 2 deletions extension/Extension.proj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>$(DefaultTargetFramework)</TargetFramework>
<ExtensionSrcDir>$(MSBuildThisFileDirectory)</ExtensionSrcDir>
<RequiredYarnVersion>4.14.1</RequiredYarnVersion>
</PropertyGroup>

<Target Name="BuildAndPackageExtension" BeforeTargets="Build" DependsOnTargets="CheckYarnInstalled;CheckVsceInstalled">
Expand Down Expand Up @@ -43,7 +44,7 @@
<MakeDir Directories="$(_VscodeOutputDir)" />

<!-- Package extension -->
<Exec Command="vsce package --out $(_VsixPath)"
<Exec Command="vsce package --no-dependencies --out $(_VsixPath)"
IgnoreStandardErrorWarningFormat="true"
WorkingDirectory="$(ExtensionSrcDir)" />

Expand All @@ -68,12 +69,16 @@
</Target>

<Target Name="CheckYarnInstalled">
<Exec Command="corepack enable yarn" ContinueOnError="true" IgnoreStandardErrorWarningFormat="true" />
<Exec Command="corepack prepare yarn@$(RequiredYarnVersion) --activate" ContinueOnError="true" IgnoreStandardErrorWarningFormat="true" />

<Exec Command="yarn --version" ContinueOnError="true" ConsoleToMSBuild="true" IgnoreStandardErrorWarningFormat="true">
<Output TaskParameter="ExitCode" PropertyName="YarnExitCode" />
<Output TaskParameter="ConsoleOutput" PropertyName="YarnVersion" />
</Exec>

<Error Condition="'$(YarnExitCode)' != '0'" Text="yarn is not installed or not available in PATH. To build the extension, install yarn: https://yarnpkg.com/getting-started/install" />
<Error Condition="'$(YarnExitCode)' != '0'" Text="yarn is not installed or not available in PATH. To build the extension, install Corepack and activate yarn $(RequiredYarnVersion): https://yarnpkg.com/getting-started/install" />
<Error Condition="'$(YarnExitCode)' == '0' and '$(YarnVersion)' != '$(RequiredYarnVersion)'" Text="yarn $(RequiredYarnVersion) is required, but found $(YarnVersion). To build the extension, use Corepack to activate yarn $(RequiredYarnVersion): corepack prepare yarn@$(RequiredYarnVersion) --activate" />

<Message Importance="high" Text="yarn version: $(YarnVersion)" />
Comment thread
adamint marked this conversation as resolved.
</Target>
Expand Down
34 changes: 31 additions & 3 deletions extension/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ $ErrorActionPreference = "Stop"

Write-Host "Checking prerequisites..."

$requiredYarnVersion = "4.14.1"

# Check for Node.js
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
Write-Error "Error: Node.js is not installed. Please install Node.js first."
Expand All @@ -16,10 +18,36 @@ if (-not (Get-Command npm -ErrorAction SilentlyContinue)) {
exit 1
}

# Check for yarn
# Activate the pinned yarn version through Corepack when available.
if (Get-Command corepack -ErrorAction SilentlyContinue) {
Write-Host "Activating yarn $requiredYarnVersion with corepack..."
corepack enable yarn
if ($LASTEXITCODE -ne 0) {
Write-Warning "corepack enable yarn failed with exit code $LASTEXITCODE. Continuing to validate the yarn on PATH."
}

corepack prepare "yarn@$requiredYarnVersion" --activate
if ($LASTEXITCODE -ne 0) {
Write-Error "corepack prepare yarn@$requiredYarnVersion failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
}

if (-not (Get-Command yarn -ErrorAction SilentlyContinue)) {
Write-Error "Error: yarn is not installed. Please install yarn first."
Write-Host "You can install yarn by running: npm install -g yarn"
Write-Error "Error: yarn is not available. Install Corepack and activate yarn $requiredYarnVersion."
Write-Host "You can install Corepack by running: npm install -g corepack@0.34.7; corepack prepare yarn@$requiredYarnVersion --activate"
exit 1
}

$yarnVersion = yarn --version
if ($LASTEXITCODE -ne 0) {
Write-Error "yarn --version failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}

if ($yarnVersion -ne $requiredYarnVersion) {
Write-Error "Error: yarn $requiredYarnVersion is required, but found $yarnVersion."
Write-Host "Use Corepack to activate the pinned version: corepack prepare yarn@$requiredYarnVersion --activate"
exit 1
Comment thread
adamint marked this conversation as resolved.
}

Expand Down
21 changes: 18 additions & 3 deletions extension/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ set -e

echo "Checking prerequisites..."

REQUIRED_YARN_VERSION="4.14.1"

# Check for Node.js
if ! command -v node &> /dev/null; then
echo "Error: Node.js is not installed. Please install Node.js first."
Expand All @@ -15,10 +17,23 @@ if ! command -v npm &> /dev/null; then
exit 1
fi

# Check for yarn
# Activate the pinned yarn version through Corepack when available.
if command -v corepack &> /dev/null; then
echo "Activating yarn $REQUIRED_YARN_VERSION with corepack..."
corepack enable yarn || true
corepack prepare "yarn@$REQUIRED_YARN_VERSION" --activate
fi

if ! command -v yarn &> /dev/null; then
echo "Error: yarn is not installed. Please install yarn first."
echo "You can install yarn by running: npm install -g yarn"
echo "Error: yarn is not available. Install Corepack and activate yarn $REQUIRED_YARN_VERSION."
echo "You can install Corepack by running: npm install -g corepack@0.34.7 && corepack prepare yarn@$REQUIRED_YARN_VERSION --activate"
exit 1
fi

YARN_VERSION="$(yarn --version)"
if [[ "$YARN_VERSION" != "$REQUIRED_YARN_VERSION" ]]; then
echo "Error: yarn $REQUIRED_YARN_VERSION is required, but found $YARN_VERSION."
echo "Use Corepack to activate the pinned version: corepack prepare yarn@$REQUIRED_YARN_VERSION --activate"
exit 1
Comment thread
adamint marked this conversation as resolved.
fi

Expand Down
1 change: 1 addition & 0 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"engines": {
"vscode": "^1.98.0"
},
"packageManager": "yarn@4.14.1",
"categories": [
"Programming Languages",
"Debuggers",
Expand Down
Loading
Loading