Skip to content

Commit 087573c

Browse files
authored
Consume nuget.config in azure for CLI and VS builds and npmrc and nuget.config for vscode build (#694)
* Consume nuget.config in azure for CLI and VS builds * Update Changelog.md * Add new scripts/tasks to authenticate npm packages for vs code build * Add nuget authenticate for building language server * Move task to right spot * Change to pipeline-pack in pipeline
1 parent 7cd3d84 commit 087573c

11 files changed

+137
-9
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.0.61] - 2025-07-11
8+
## Pipelines
9+
Pipeline updates
10+
711
## [1.0.60] - 2025-06-36
812
## Pipelines
913
Pipeline updates

DevSkim-VSCode-Plugin/.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
registry=https://twcsecurityassurance.pkgs.visualstudio.com/SecurityEngineering/_packaging/PublicRegistriesFeed/npm/registry/
2+
3+
always-auth=true

DevSkim-VSCode-Plugin/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,11 @@
314314
"reset-version": "node ./scripts/resetPackageVersion.js",
315315
"check-pre-release": "node ./scripts/checkPreReleaseFlag.js",
316316
"vsce-pack-pre": "vsce package --pre-release || echo 'Pre-Release build failed'",
317-
"vsce-pack": "vsce package || echo 'Release build failed'"
317+
"vsce-pack": "vsce package || echo 'Release build failed'",
318+
"pipeline-pack":"npm install --global @microsoft/artifacts-npm-credprovider --registry https://pkgs.dev.azure.com/artifacts-public/23934c1b-a3b5-4b70-9dd3-d1bef4cc72a0/_packaging/AzureArtifacts/npm/registry/ && artifacts-npm-credprovider && npm run restore-net && npm run rewrite-registry:root && npm run rewrite-registry:client && npm run pack-ext",
319+
"restore-net":"dotnet restore --configfile ../nuget.config.azure ../DevSkim-Dotnet/Microsoft.DevSkim.LanguageServer",
320+
"rewrite-registry:root": "node scripts/updatePackageLock.js ../package-lock.json",
321+
"rewrite-registry:client": "node scripts/updatePackageLock.js ../client/package-lock.json"
318322
},
319323
"devDependencies": {
320324
"@types/node": "^14.x",
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// rewrite-registry.mjs
2+
import { readFile, writeFile } from 'fs/promises';
3+
import path from 'path';
4+
import { fileURLToPath } from 'url';
5+
6+
// Support __dirname in ES modules
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
10+
const filePath = process.argv[2];
11+
12+
if (!filePath) {
13+
console.error('❌ Please provide the path to the package-lock.json file.');
14+
process.exit(1);
15+
}
16+
17+
const registryBase = 'https://registry.npmjs.org/';
18+
const newRegistryBase = 'https://twcsecurityassurance.pkgs.visualstudio.com/SecurityEngineering/_packaging/PublicRegistriesFeed/npm/registry/';
19+
20+
try {
21+
const fullPath = path.resolve(__dirname, filePath);
22+
const content = await readFile(fullPath, 'utf8');
23+
const lock = JSON.parse(content);
24+
25+
if (lock.packages) {
26+
for (const [pkg, data] of Object.entries(lock.packages)) {
27+
if (data.resolved?.startsWith(registryBase)) {
28+
data.resolved = newRegistryBase + data.resolved.slice(registryBase.length);
29+
}
30+
}
31+
await writeFile(fullPath, JSON.stringify(lock, null, 2));
32+
console.log(`✅ Updated resolved URLs in ${filePath}`);
33+
} else {
34+
console.error('⚠️ No "packages" field found in the file.');
35+
}
36+
} catch (err) {
37+
console.error(`❌ Failed to process ${filePath}:`, err.message);
38+
}

Pipelines/cli/devskim-cli-pr.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resources:
1313
- repository: templates
1414
type: git
1515
name: SecurityEngineering/OSS-Tools-Pipeline-Templates
16-
ref: refs/tags/v2.0.1
16+
ref: refs/tags/v2.0.4
1717
- repository: 1esPipelines
1818
type: git
1919
name: 1ESPipelineTemplates/1ESPipelineTemplates
@@ -42,6 +42,11 @@ extends:
4242
poolImage: MSSecurity-1ES-Windows-2022
4343
poolOs: windows
4444
dotnetTestArgs: '-- --coverage --report-trx'
45+
includeNuGetOrg: false
46+
nugetFeedsToUse: 'config'
47+
nugetConfigPath: 'nuget.config.azure'
48+
onInit:
49+
- task: NuGetAuthenticate@1
4550
- template: dotnet-test-job.yml@templates
4651
parameters:
4752
jobName: 'dotnet_test_ubuntu'
@@ -51,6 +56,11 @@ extends:
5156
poolOs: linux
5257
projectPath: 'DevSkim-DotNet/Microsoft.DevSkim.Tests/Microsoft.DevSkim.Tests.csproj'
5358
dotnetTestArgs: '-- --coverage --report-trx'
59+
includeNuGetOrg: false
60+
nugetFeedsToUse: 'config'
61+
nugetConfigPath: 'nuget.config.azure'
62+
onInit:
63+
- task: NuGetAuthenticate@1
5464
- stage: Build
5565
dependsOn:
5666
- Test
@@ -63,6 +73,11 @@ extends:
6373
projectName: 'DevSkim_CLI'
6474
exePath: 'devskim'
6575
artifactName: 'linux-mac-archive'
76+
includeNuGetOrg: false
77+
nugetFeedsToUse: 'config'
78+
nugetConfigPath: 'nuget.config.azure'
79+
onInit:
80+
- task: NuGetAuthenticate@1
6681
preBuild:
6782
- template: nbgv-set-version-steps.yml@templates
6883
- template: dotnet-publish-win-netcore-job.yml@templates
@@ -72,6 +87,11 @@ extends:
7287
projectPath: 'DevSkim-DotNet/Microsoft.DevSkim.CLI/Microsoft.DevSkim.CLI.csproj'
7388
projectName: 'DevSkim_CLI'
7489
artifactName: 'win-netcore-archive'
90+
includeNuGetOrg: false
91+
nugetFeedsToUse: 'config'
92+
nugetConfigPath: 'nuget.config.azure'
93+
onInit:
94+
- task: NuGetAuthenticate@1
7595
preBuild:
7696
- template: nbgv-set-version-steps.yml@templates
7797
- template: nuget-build-job.yml@templates
@@ -82,6 +102,11 @@ extends:
82102
projectPath: 'DevSkim-DotNet/Microsoft.DevSkim/Microsoft.DevSkim.csproj'
83103
projectName: 'DevSkim_Lib'
84104
artifactName: 'nuget-lib-archive'
105+
includeNuGetOrg: false
106+
nugetFeedsToUse: 'config'
107+
nugetConfigPath: 'nuget.config.azure'
108+
onInit:
109+
- task: NuGetAuthenticate@1
85110
preBuild:
86111
- template: nbgv-set-version-steps.yml@templates
87112
- template: nuget-build-job.yml@templates
@@ -92,5 +117,10 @@ extends:
92117
projectPath: 'DevSkim-DotNet/Microsoft.DevSkim.CLI/Microsoft.DevSkim.CLI.csproj'
93118
projectName: 'DevSkim_CLI'
94119
artifactName: 'nuget-cli-archive'
120+
includeNuGetOrg: false
121+
nugetFeedsToUse: 'config'
122+
nugetConfigPath: 'nuget.config.azure'
123+
onInit:
124+
- task: NuGetAuthenticate@1
95125
preBuild:
96126
- template: nbgv-set-version-steps.yml@templates

Pipelines/cli/devskim-cli-release.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ resources:
77
- repository: templates
88
type: git
99
name: Data/OSS-Tools-Pipeline-Templates
10-
ref: refs/tags/v2.0.1
10+
ref: refs/tags/v2.0.4
1111
- repository: 1esPipelines
1212
type: git
1313
name: 1ESPipelineTemplates/1ESPipelineTemplates
@@ -41,6 +41,11 @@ extends:
4141
poolImage: MSSecurity-1ES-Windows-2022
4242
poolOs: windows
4343
dotnetTestArgs: '-- --coverage --report-trx'
44+
includeNuGetOrg: false
45+
nugetFeedsToUse: 'config'
46+
nugetConfigPath: 'nuget.config.azure'
47+
onInit:
48+
- task: NuGetAuthenticate@1
4449
- template: dotnet-test-job.yml@templates
4550
parameters:
4651
jobName: 'dotnet_test_ubuntu'
@@ -50,6 +55,11 @@ extends:
5055
poolOs: linux
5156
projectPath: 'DevSkim-DotNet/Microsoft.DevSkim.Tests/Microsoft.DevSkim.Tests.csproj'
5257
dotnetTestArgs: '-- --coverage --report-trx'
58+
includeNuGetOrg: false
59+
nugetFeedsToUse: 'config'
60+
nugetConfigPath: 'nuget.config.azure'
61+
onInit:
62+
- task: NuGetAuthenticate@1
5363

5464
- stage: Build
5565
dependsOn:
@@ -63,6 +73,11 @@ extends:
6373
projectName: 'DevSkim_CLI'
6474
exePath: 'devskim'
6575
artifactName: 'linux-mac-archive'
76+
includeNuGetOrg: false
77+
nugetFeedsToUse: 'config'
78+
nugetConfigPath: 'nuget.config.azure'
79+
onInit:
80+
- task: NuGetAuthenticate@1
6681
preBuild:
6782
- template: nbgv-set-version-steps.yml@templates
6883
- template: dotnet-publish-win-netcore-job.yml@templates
@@ -72,6 +87,11 @@ extends:
7287
projectPath: 'DevSkim-DotNet/Microsoft.DevSkim.CLI/Microsoft.DevSkim.CLI.csproj'
7388
projectName: 'DevSkim_CLI'
7489
artifactName: 'win-netcore-archive'
90+
includeNuGetOrg: false
91+
nugetFeedsToUse: 'config'
92+
nugetConfigPath: 'nuget.config.azure'
93+
onInit:
94+
- task: NuGetAuthenticate@1
7595
preBuild:
7696
- template: nbgv-set-version-steps.yml@templates
7797
- template: nuget-build-job.yml@templates
@@ -82,6 +102,11 @@ extends:
82102
projectPath: 'DevSkim-DotNet/Microsoft.DevSkim/Microsoft.DevSkim.csproj'
83103
projectName: 'DevSkim_Lib'
84104
artifactName: 'nuget-lib-archive'
105+
includeNuGetOrg: false
106+
nugetFeedsToUse: 'config'
107+
nugetConfigPath: 'nuget.config.azure'
108+
onInit:
109+
- task: NuGetAuthenticate@1
85110
preBuild:
86111
- template: nbgv-set-version-steps.yml@templates
87112
- template: nuget-build-job.yml@templates
@@ -92,6 +117,11 @@ extends:
92117
projectPath: 'DevSkim-DotNet/Microsoft.DevSkim.CLI/Microsoft.DevSkim.CLI.csproj'
93118
projectName: 'DevSkim_CLI'
94119
artifactName: 'nuget-cli-archive'
120+
includeNuGetOrg: false
121+
nugetFeedsToUse: 'config'
122+
nugetConfigPath: 'nuget.config.azure'
123+
onInit:
124+
- task: NuGetAuthenticate@1
95125
preBuild:
96126
- template: nbgv-set-version-steps.yml@templates
97127

Pipelines/vs/devskim-visualstudio-pr.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resources:
1313
- repository: templates
1414
type: git
1515
name: SecurityEngineering/OSS-Tools-Pipeline-Templates
16-
ref: refs/tags/v2.0.1
16+
ref: refs/tags/v2.0.4
1717
- repository: 1esPipelines
1818
type: git
1919
name: 1ESPipelineTemplates/1ESPipelineTemplates
@@ -44,6 +44,11 @@ extends:
4444
artifactName: 'vs-archive'
4545
extraArtifactName: 'Unsigned_Extension'
4646
extraArtifactLocation: 'extension'
47+
includeNuGetOrg: false
48+
nugetFeedsToUse: 'config'
49+
nugetConfigPath: 'nuget.config.azure'
50+
onInit:
51+
- task: NuGetAuthenticate@1
4752
preBuild:
4853
- template: nbgv-set-version-steps.yml@templates
4954
- task: UseDotNet@2

Pipelines/vs/devskim-visualstudio-release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ resources:
77
- repository: templates
88
type: git
99
name: Data/OSS-Tools-Pipeline-Templates
10-
ref: refs/tags/v2.0.1
10+
ref: refs/tags/v2.0.4
1111
- repository: 1esPipelines
1212
type: git
1313
name: 1ESPipelineTemplates/1ESPipelineTemplates
@@ -43,6 +43,11 @@ extends:
4343
artifactName: 'vs-archive'
4444
extraArtifactName: 'Unsigned_Extension'
4545
extraArtifactLocation: 'extension'
46+
includeNuGetOrg: false
47+
nugetFeedsToUse: 'config'
48+
nugetConfigPath: 'nuget.config.azure'
49+
onInit:
50+
- task: NuGetAuthenticate@1
4651
preBuild:
4752
- template: nbgv-set-version-steps.yml@templates
4853
- task: UseDotNet@2

Pipelines/vscode/devskim-vscode-pr.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resources:
1313
- repository: templates
1414
type: git
1515
name: SecurityEngineering/OSS-Tools-Pipeline-Templates
16-
ref: refs/tags/v2.0.0
16+
ref: refs/tags/v2.0.4
1717
- repository: 1esPipelines
1818
type: git
1919
name: 1ESPipelineTemplates/1ESPipelineTemplates
@@ -38,6 +38,7 @@ extends:
3838
targetPath: $(Build.StagingDirectory)/packages
3939
artifactName: 'Unsigned_Plugin'
4040
steps:
41+
- task: NuGetAuthenticate@1
4142
- task: UseDotNet@2
4243
displayName: Install Dotnet SDK
4344
inputs:
@@ -66,7 +67,7 @@ extends:
6667
inputs:
6768
command: 'custom'
6869
workingDir: 'DevSkim-VSCode-Plugin/'
69-
customCommand: 'run pack-ext'
70+
customCommand: 'run pipeline-pack'
7071
- task: PowerShell@2
7172
displayName: Move Plugin File
7273
inputs:

Pipelines/vscode/devskim-vscode-release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ resources:
77
- repository: templates
88
type: git
99
name: Data/OSS-Tools-Pipeline-Templates
10-
ref: refs/tags/v2.0.1
10+
ref: refs/tags/v2.0.4
1111
- repository: 1esPipelines
1212
type: git
1313
name: 1ESPipelineTemplates/1ESPipelineTemplates
@@ -37,6 +37,7 @@ extends:
3737
targetPath: $(Build.StagingDirectory)/packages
3838
artifactName: 'Unsigned_Plugin'
3939
steps:
40+
- task: NuGetAuthenticate@1
4041
- task: UseDotNet@2
4142
displayName: Install Dotnet SDK
4243
inputs:
@@ -65,7 +66,7 @@ extends:
6566
inputs:
6667
command: 'custom'
6768
workingDir: 'DevSkim-VSCode-Plugin/'
68-
customCommand: 'run pack-ext'
69+
customCommand: 'run pipeline-pack'
6970
- task: PowerShell@2
7071
displayName: Move Plugin File
7172
inputs:

0 commit comments

Comments
 (0)