Skip to content

Commit dc31ed0

Browse files
authored
Add workloadidentityuser service connection support to NpmAuthenticateV0 (#20230)
* Add workloadidentityuser service connection support to NpmAuthenticateV0 * Npm auth end to end * Localize string * Version bump * Bumped task version * Update string * Generated string * Fix loc files * Remove comments * Bump version and add localization * Add telemetry and url parsing * Fix variable name * Change strings * Allow multiple reruns without overwrite * Modify strings * Refactor duplicate run checking logic * Update string and refactor * Fix service connection bug * String changes * Update make-options.json
1 parent e0693ba commit dc31ed0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+5547
-200
lines changed

Tasks/NpmAuthenticateV0/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
"loc.description": "Don't use this task if you're also using the npm task. Provides npm credentials to an .npmrc file in your repository for the scope of the build. This enables npm task runners like gulp and Grunt to authenticate with private registries.",
55
"loc.instanceNameFormat": "npm Authenticate $(workingFile)",
66
"loc.input.label.workingFile": ".npmrc file to authenticate",
7-
"loc.input.help.workingFile": "Path to the .npmrc file that specifies the registries you want to work with. Select the file, not the folder e.g. \"/packages/mypackage.npmrc\".",
7+
"loc.input.help.workingFile": "Path to the .npmrc file that specifies the registries you want to work with. Select the file, not the folder e.g. \"/packages/mypackage.npmrc\". If Azure Artifacts URL and Entra Workload ID-backed Azure DevOps user' Service Connection are set, registries in npmrc will be ignored.",
88
"loc.input.label.customEndpoint": "Credentials for registries outside this organization/collection",
99
"loc.input.help.customEndpoint": "Credentials to use for external registries located in the project's .npmrc. For registries in this organization/collection, leave this blank; the build’s credentials are used automatically.",
10+
"loc.input.label.workloadIdentityServiceConnection": "'Entra Workload ID-backed Azure DevOps user' Service Connection",
11+
"loc.input.help.workloadIdentityServiceConnection": "If this is set, feedUrl is required. Service Connections for external organizations/collection and custom endpoints are not compatible.",
12+
"loc.input.label.feedUrl": "Azure Artifacts URL",
13+
"loc.input.help.feedUrl": "If this is set, workloadIdentityServiceConnection is required. Not compatible with customEndpoint. Feed Url should be in the npm registry format, e.g. https://pkgs.dev.azure.com/{ORG_NAME}/{PROJECT}/_packaging/{FEED_NAME}/npm/registry/",
1014
"loc.messages.FoundBuildCredentials": "Found build credentials",
1115
"loc.messages.NoBuildCredentials": "Could not find build credentials",
1216
"loc.messages.ServiceEndpointNotDefined": "Couldn't find the service connection. Make sure the selected service connection still exists.",
@@ -19,12 +23,19 @@
1923
"loc.messages.AddingLocalCredentials": "Adding credentials for a local registry",
2024
"loc.messages.AddingEndpointCredentials": "Adding credentials for the %s service connection",
2125
"loc.messages.AuthenticatingThisNpmrc": "Adding authentication to the .npmrc file at %s",
22-
"loc.messages.IgnoringRegistry": "No service connections that matched %s were found",
26+
"loc.messages.IgnoringRegistry": "No new service connections that matched %s were found",
2327
"loc.messages.ForcePackagingUrl": "Packaging collection URL forced to: %s",
2428
"loc.messages.CheckedInCredentialsOverriden": "Found and overrode credentials for the %s registry in the selected .npmrc file. Remove credentials from the file and store them in an npm service connection instead (recommended), or remove the npm Authenticate task from your build to use credentials checked into an .npmrc.",
2529
"loc.messages.NoIndexJsonFile": "No index.json file was found and no files were restored",
2630
"loc.messages.RevertedChangesToNpmrc": "Reverted changes made to %s.",
2731
"loc.messages.NpmrcDoesNotExist": "The .npmrc file you selected at %s does not currently exist.",
2832
"loc.messages.SuccessfulPush": "Successfully pushed .npmrc",
29-
"loc.messages.SuccessfulAppend": "Successfully appended .npmrc"
33+
"loc.messages.SuccessfulAppend": "Successfully appended .npmrc",
34+
"loc.messages.Info_AddingFederatedFeedAuth": "Adding auth information from service connection %s for feed %s",
35+
"loc.messages.Info_SuccessAddingFederatedFeedAuth": "Successfully added auth for feed %s.",
36+
"loc.messages.FailedToGetServiceConnectionAuth": "Unable to get federated credentials from service connection: %s.",
37+
"loc.messages.MissingFeedUrlOrServiceConnection": "Both feed url and service connection need to be set and cannot be empty.",
38+
"loc.messages.SkippingParsingNpmrc": "Skipping parsing npmrc",
39+
"loc.messages.DuplicateCredentials": "Auth for the registry '%s' was previously set. Overwriting with new configuration.",
40+
"loc.messages.FoundEndpointCredentials": "Found set credentials for the '%s' service connection."
3041
}

Tasks/NpmAuthenticateV0/_buildConfigs/Node20/package-lock.json

Lines changed: 158 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/NpmAuthenticateV0/_buildConfigs/Node20/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"dependencies": {
2020
"azure-pipelines-task-lib": "^4.13.0",
2121
"azure-pipelines-tasks-packaging-common": "^3.242.0",
22+
"azure-pipelines-tasks-artifacts-common": "^2.243.0",
2223
"@types/mocha": "^5.2.7",
2324
"@types/node": "^20.3.1",
2425
"@types/uuid": "^8.3.0"

Tasks/NpmAuthenticateV0/_buildConfigs/Wif/Tests/package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "npm-authenticate-tests",
3+
"version": "1.0.0",
4+
"description": "Azure Pipelines Npm Authenticate V0 Task Tests",
5+
"main": "L0.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+ssh://[email protected]/Microsoft/azure-pipelines-tasks.git"
12+
},
13+
"author": "Microsoft Corporation",
14+
"license": "MIT",
15+
"bugs": {
16+
"url": "https://github.com/Microsoft/azure-pipelines-tasks/issues"
17+
},
18+
"homepage": "https://github.com/Microsoft/azure-pipelines-tasks#readme"
19+
}

0 commit comments

Comments
 (0)