Skip to content

Commit 838d2cd

Browse files
Merge branch 'main' into feature/allow-exact-match
2 parents 30490b4 + 6379b6d commit 838d2cd

23 files changed

Lines changed: 1473 additions & 456 deletions

.azure-pipelines/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: $(Date:yyyyMMdd).$(Rev:r)
22
variables:
33
- name: Codeql.Enabled
44
value: true
5+
- template: /.azure-pipelines/npm-cfs-variables.yml@self
56
resources:
67
repositories:
78
- repository: self
@@ -53,10 +54,9 @@ extends:
5354
displayName: Use Node 20.x
5455
inputs:
5556
versionSpec: 20.x
56-
- task: Npm@1
57+
- template: /.azure-pipelines/npm-cfs.yml@self
58+
- script: npm install
5759
displayName: npm install
58-
inputs:
59-
verbose: false
6060
- task: CmdLine@2
6161
displayName: build server
6262
inputs:

.azure-pipelines/nightly.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: $(Date:yyyyMMdd).$(Rev:r)
22
variables:
33
- name: Codeql.Enabled
44
value: true
5+
- template: /.azure-pipelines/npm-cfs-variables.yml@self
56
schedules:
67
- cron: 0 7 * * 1,2,3,4,5
78
branches:
@@ -70,10 +71,9 @@ extends:
7071
SourceFolder: '$(System.ArtifactsDirectory)/plugin/jars'
7172
Contents: 'com.microsoft.java.debug.plugin-*.jar'
7273
TargetFolder: $(Build.SourcesDirectory)/server
73-
- task: Npm@1
74+
- template: /.azure-pipelines/npm-cfs.yml@self
75+
- script: npm install
7476
displayName: npm install
75-
inputs:
76-
verbose: false
7777
- task: CmdLine@2
7878
displayName: Update nightly vsix version
7979
inputs:
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Variables required to route npm package restore through the Central Feed Service
2+
# (CFS). Consumed by every pipeline in this directory alongside the npm-cfs.yml steps
3+
# template, which is where these values are actually applied.
4+
#
5+
# Both are declared here rather than in each pipeline so the feed URL exists in
6+
# exactly one place.
7+
#
8+
# npm_config_registry is not redundant with the registry written into the generated
9+
# .npmrc. npm resolves configuration in the order cli > environment > project .npmrc
10+
# > user .npmrc, so a registry supplied only through the user config is outranked by
11+
# anything the agent image already configures -- Microsoft hosted images ship a user
12+
# level .npmrc pointing at an internal proxy, and a pool that exports
13+
# npm_config_registry would win outright. Restore would then quietly resolve from
14+
# somewhere other than CFS while the build still reported success. Declaring the
15+
# variable here puts the redirect at environment precedence, where only an explicit
16+
# command line flag can override it.
17+
#
18+
# npm matches npm_config_* environment variables case insensitively, so the
19+
# uppercased form that Azure Pipelines exports applies to every step on every OS.
20+
# That matters because package restore here is not driven by a single task: the Npm
21+
# tasks, `npx json`, `npx @vscode/vsce` and the vsce invocation inside AzureCLI@2
22+
# all inherit the agent environment rather than reading a task input.
23+
24+
variables:
25+
- name: npm_config_registry
26+
value: https://pkgs.dev.azure.com/mseng/VSJava/_packaging/vscjava/npm/registry/
27+
- name: npm_config_userconfig
28+
value: $(Agent.TempDirectory)/.npmrc

.azure-pipelines/npm-cfs.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Routes npm package restore through the Central Feed Service (CFS), as required by
2+
# SFI Network Isolation. Consumed by every build pipeline in this directory.
3+
#
4+
# Pipelines must also include the companion variables template:
5+
# variables:
6+
# - template: /.azure-pipelines/npm-cfs-variables.yml@self
7+
# which declares the feed URL and the generated .npmrc path. The redirect itself is
8+
# carried by the npm_config_registry environment variable that template exports; see
9+
# its header for why the generated .npmrc alone is not enough.
10+
#
11+
# The .npmrc is generated at build time into the agent temp directory rather than
12+
# being committed to the repository, so that:
13+
# * open source contributors and the GitHub Actions workflows keep restoring from
14+
# the public npm registry -- npm rewrites the host of every `resolved` URL in
15+
# package-lock.json to the configured registry, so a single lockfile serves both;
16+
# * the credential that NpmAuthenticate injects never lands inside the workspace;
17+
# * the configuration does not depend on the repository being checked out, so
18+
# release jobs consuming a prebuilt artifact work the same way as build jobs.
19+
#
20+
# The registry is still written into that file because NpmAuthenticate discovers the
21+
# registries to authenticate by reading it. npm then takes the URL from the
22+
# environment and the matching credential from this file.
23+
#
24+
# The file is written with `npm config set` rather than a shell redirect because
25+
# these pipelines span both Linux and Windows pools. `script:` maps to CmdLine@2,
26+
# which runs on both, and the npm invocation itself is shell agnostic. PowerShell@2
27+
# is avoided because it resolves `pwsh` before `powershell` and hard fails when
28+
# neither is on PATH, which is not guaranteed on a custom Linux image.
29+
#
30+
# This template must run after the Node install task, and before any step that
31+
# restores packages -- including `npx`, which resolves downloads through the
32+
# configured registry.
33+
#
34+
# Consumers must reference this file as `/.azure-pipelines/npm-cfs.yml@self`. A
35+
# relative path is resolved against the file doing the including, which for these
36+
# pipelines is the 1ES extends template in another repository, so the unqualified
37+
# form is looked up in 1ESPipelineTemplates and fails YAML compilation.
38+
39+
steps:
40+
- script: npm config set registry $(npm_config_registry) --location=user --userconfig="$(npm_config_userconfig)"
41+
displayName: Configure CFS npm registry
42+
43+
# Appends `//pkgs.dev.azure.com/.../registry/:_authToken=<token>` for every
44+
# registry it finds in the file above. `always-auth` is deliberately not written:
45+
# it is not read by this task and is rejected outright by the npm 10 shipped with
46+
# Node 20.
47+
- task: NpmAuthenticate@0
48+
displayName: Authenticate to CFS feed
49+
inputs:
50+
workingFile: $(npm_config_userconfig)
51+
52+
# Restore silently falling back to the public registry is the failure mode this
53+
# whole template exists to prevent, and it leaves no trace in the build log, so it
54+
# is asserted rather than assumed. Written in node, which the agent already
55+
# provides, to avoid shell differences between the Linux and Windows pools.
56+
- script: >-
57+
node -e "const cp=require('child_process');const r=cp.execSync('npm config get registry').toString().trim();console.log('npm registry -> '+r);if(!r.startsWith('https://pkgs.dev.azure.com/')){console.error('##vso[task.logissue type=error]npm is not configured against the CFS feed');process.exit(1);}"
58+
displayName: Verify CFS npm registry

.azure-pipelines/rc.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: $(Date:yyyyMMdd).$(Rev:r)
22
variables:
33
- name: Codeql.Enabled
44
value: true
5+
- template: /.azure-pipelines/npm-cfs-variables.yml@self
56
resources:
67
pipelines:
78
- pipeline: microsoft.java-debug.signjars.rc
@@ -72,10 +73,9 @@ extends:
7273
script: |
7374
del server\com.microsoft.java.debug.plugin-*-sources.jar
7475
del server\com.microsoft.java.debug.plugin-*-javadoc.jar
75-
- task: Npm@1
76+
- template: /.azure-pipelines/npm-cfs.yml@self
77+
- script: npm install
7678
displayName: npm install
77-
inputs:
78-
verbose: false
7979
- task: CmdLine@2
8080
displayName: Replace AI key
8181
inputs:

.azure-pipelines/release-nightly.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ name: $(Date:yyyyMMdd).$(Rev:r) # Use the current date and a revision number for
88
variables:
99
- name: Codeql.Enabled
1010
value: true
11+
- template: /.azure-pipelines/npm-cfs-variables.yml@self
1112
resources:
1213
repositories:
1314
- repository: self
@@ -46,6 +47,7 @@ extends:
4647
displayName: 'Use Node.js 20.x'
4748
inputs:
4849
version: '20.x'
50+
- template: /.azure-pipelines/npm-cfs.yml@self
4951
- task: AzureCLI@2
5052
displayName: 'Publish Extension'
5153
inputs:

.azure-pipelines/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ name: $(Date:yyyyMMdd).$(Rev:r) # Use the current date and a revision number for
88
variables:
99
- name: Codeql.Enabled
1010
value: true
11+
- template: /.azure-pipelines/npm-cfs-variables.yml@self
1112
resources:
1213
repositories:
1314
- repository: self
@@ -46,6 +47,7 @@ extends:
4647
displayName: 'Use Node.js 20.x'
4748
inputs:
4849
version: '20.x'
50+
- template: /.azure-pipelines/npm-cfs.yml@self
4951
- task: AzureCLI@2
5052
displayName: 'Publish Extension'
5153
inputs:

.github/dependabot.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "npm" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "daily"
12+
# CI restores packages from the Central Feed Service, which withholds
13+
# upstream versions until they are roughly a week old (measured at ~6.8
14+
# days; both the packument entry and the tarball return 404 before then).
15+
# Dependabot's built-in cooldown is only 3 days, so bumps otherwise land in
16+
# a window where the feed 404s and the build fails. 10 days leaves margin
17+
# in case the feed's ingestion lag drifts.
18+
cooldown:
19+
default-days: 10
20+
- package-ecosystem: "github-actions"
21+
directory: "/"
22+
groups:
23+
github-actions:
24+
patterns: ["*"]
25+
schedule:
26+
interval: "weekly"
27+
cooldown:
28+
default-days: 7

.github/workflows/build.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
timeout-minutes: 30
1414
steps:
15-
- uses: actions/checkout@v5
15+
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
1616

1717
- name: Setup Build Environment
1818
run: |
@@ -22,13 +22,13 @@ jobs:
2222
sleep 3
2323
2424
- name: Set up JDK 21
25-
uses: actions/setup-java@v5
25+
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
2626
with:
2727
java-version: '21'
2828
distribution: 'temurin'
2929

3030
- name: Setup Node.js environment
31-
uses: actions/setup-node@v5
31+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
3232
with:
3333
node-version: 20
3434

@@ -56,16 +56,16 @@ jobs:
5656
runs-on: windows-latest
5757
timeout-minutes: 30
5858
steps:
59-
- uses: actions/checkout@v5
59+
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
6060

6161
- name: Set up JDK 21
62-
uses: actions/setup-java@v5
62+
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
6363
with:
6464
java-version: '21'
6565
distribution: 'temurin'
6666

6767
- name: Setup Node.js environment
68-
uses: actions/setup-node@v5
68+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
6969
with:
7070
node-version: 20
7171

@@ -93,16 +93,16 @@ jobs:
9393
runs-on: macos-latest
9494
timeout-minutes: 30
9595
steps:
96-
- uses: actions/checkout@v5
96+
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
9797

9898
- name: Set up JDK 21
99-
uses: actions/setup-java@v5
99+
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
100100
with:
101101
java-version: '21'
102102
distribution: 'temurin'
103103

104104
- name: Setup Node.js environment
105-
uses: actions/setup-node@v5
105+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
106106
with:
107107
node-version: 20
108108

.github/workflows/no-response.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
permissions:
1818
issues: write
1919
steps:
20-
- uses: lee-dohm/no-response@9bb0a4b5e6a45046f00353d5de7d90fb8bd773bb #v0.5.0
20+
- uses: lee-dohm/no-response@9bb0a4b5e6a45046f00353d5de7d90fb8bd773bb # v0.5.0
2121
with:
2222
token: ${{ github.token }}
2323
daysUntilClose: 14 # Number of days of inactivity before an Issue is closed for lack of response

0 commit comments

Comments
 (0)