Skip to content

Commit

Permalink
Add workloadidentityuser service connection support to NpmAuthenticat…
Browse files Browse the repository at this point in the history
…eV0 (#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
  • Loading branch information
zhenghao104 authored Aug 19, 2024
1 parent e0693ba commit dc31ed0
Show file tree
Hide file tree
Showing 59 changed files with 5,547 additions and 200 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
"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.",
"loc.instanceNameFormat": "npm Authenticate $(workingFile)",
"loc.input.label.workingFile": ".npmrc file to authenticate",
"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\".",
"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.",
"loc.input.label.customEndpoint": "Credentials for registries outside this organization/collection",
"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.",
"loc.input.label.workloadIdentityServiceConnection": "'Entra Workload ID-backed Azure DevOps user' Service Connection",
"loc.input.help.workloadIdentityServiceConnection": "If this is set, feedUrl is required. Service Connections for external organizations/collection and custom endpoints are not compatible.",
"loc.input.label.feedUrl": "Azure Artifacts URL",
"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/",
"loc.messages.FoundBuildCredentials": "Found build credentials",
"loc.messages.NoBuildCredentials": "Could not find build credentials",
"loc.messages.ServiceEndpointNotDefined": "Couldn't find the service connection. Make sure the selected service connection still exists.",
Expand All @@ -19,12 +23,19 @@
"loc.messages.AddingLocalCredentials": "Adding credentials for a local registry",
"loc.messages.AddingEndpointCredentials": "Adding credentials for the %s service connection",
"loc.messages.AuthenticatingThisNpmrc": "Adding authentication to the .npmrc file at %s",
"loc.messages.IgnoringRegistry": "No service connections that matched %s were found",
"loc.messages.IgnoringRegistry": "No new service connections that matched %s were found",
"loc.messages.ForcePackagingUrl": "Packaging collection URL forced to: %s",
"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.",
"loc.messages.NoIndexJsonFile": "No index.json file was found and no files were restored",
"loc.messages.RevertedChangesToNpmrc": "Reverted changes made to %s.",
"loc.messages.NpmrcDoesNotExist": "The .npmrc file you selected at %s does not currently exist.",
"loc.messages.SuccessfulPush": "Successfully pushed .npmrc",
"loc.messages.SuccessfulAppend": "Successfully appended .npmrc"
"loc.messages.SuccessfulAppend": "Successfully appended .npmrc",
"loc.messages.Info_AddingFederatedFeedAuth": "Adding auth information from service connection %s for feed %s",
"loc.messages.Info_SuccessAddingFederatedFeedAuth": "Successfully added auth for feed %s.",
"loc.messages.FailedToGetServiceConnectionAuth": "Unable to get federated credentials from service connection: %s.",
"loc.messages.MissingFeedUrlOrServiceConnection": "Both feed url and service connection need to be set and cannot be empty.",
"loc.messages.SkippingParsingNpmrc": "Skipping parsing npmrc",
"loc.messages.DuplicateCredentials": "Auth for the registry '%s' was previously set. Overwriting with new configuration.",
"loc.messages.FoundEndpointCredentials": "Found set credentials for the '%s' service connection."
}
161 changes: 158 additions & 3 deletions Tasks/NpmAuthenticateV0/_buildConfigs/Node20/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Tasks/NpmAuthenticateV0/_buildConfigs/Node20/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dependencies": {
"azure-pipelines-task-lib": "^4.13.0",
"azure-pipelines-tasks-packaging-common": "^3.242.0",
"azure-pipelines-tasks-artifacts-common": "^2.243.0",
"@types/mocha": "^5.2.7",
"@types/node": "^20.3.1",
"@types/uuid": "^8.3.0"
Expand Down
13 changes: 13 additions & 0 deletions Tasks/NpmAuthenticateV0/_buildConfigs/Wif/Tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions Tasks/NpmAuthenticateV0/_buildConfigs/Wif/Tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "npm-authenticate-tests",
"version": "1.0.0",
"description": "Azure Pipelines Npm Authenticate V0 Task Tests",
"main": "L0.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/Microsoft/azure-pipelines-tasks.git"
},
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Microsoft/azure-pipelines-tasks/issues"
},
"homepage": "https://github.com/Microsoft/azure-pipelines-tasks#readme"
}
Loading

0 comments on commit dc31ed0

Please sign in to comment.