Skip to content

Commit e6a15a1

Browse files
authored
NuGetAuthenticateV1 - Enable WIF for internal and external feeds (#20592)
* Adding task changes * Adding generated tasks * removing unused string * bumping common package version * Removing commented out bit
1 parent 35eb640 commit e6a15a1

25 files changed

+643
-617
lines changed

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

+96-93
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/NuGetAuthenticateV1/_buildConfigs/Node20/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"dependencies": {
2626
"@types/node": "^20.3.1",
2727
"azure-pipelines-task-lib": "^4.13.0",
28-
"azure-pipelines-tasks-artifacts-common": "^2.244.4"
28+
"azure-pipelines-tasks-artifacts-common": "^2.247.0"
2929
},
3030
"devDependencies": {
3131
"typescript": "5.1.6"

Tasks/NuGetAuthenticateV1/_buildConfigs/Wif/package-lock.json

+154-151
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/NuGetAuthenticateV1/_buildConfigs/Wif/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"dependencies": {
2626
"@types/node": "^20.3.1",
2727
"azure-pipelines-task-lib": "^4.13.0",
28-
"azure-pipelines-tasks-artifacts-common": "^2.244.4"
28+
"azure-pipelines-tasks-artifacts-common": "^2.247.0"
2929
},
3030
"devDependencies": {
3131
"typescript": "5.1.6"

Tasks/NuGetAuthenticateV1/main.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as tl from 'azure-pipelines-task-lib/task';
33
#if WIF
44
import { configureEntraCredProvider } from "azure-pipelines-tasks-artifacts-common/credentialProviderUtils";
55
#endif
6-
import { installCredProviderToUserProfile, configureCredProvider} from 'azure-pipelines-tasks-artifacts-common/credentialProviderUtils'
6+
import { installCredProviderToUserProfile, configureCredProvider, configureCredProviderForSameOrganizationFeeds} from 'azure-pipelines-tasks-artifacts-common/credentialProviderUtils'
77
import { ProtocolType } from 'azure-pipelines-tasks-artifacts-common/protocols';
88
import { getPackagingServiceConnections } from 'azure-pipelines-tasks-artifacts-common/serviceConnectionUtils'
99
import { emitTelemetry } from 'azure-pipelines-tasks-artifacts-common/telemetry'
@@ -23,14 +23,21 @@ async function main(): Promise<void> {
2323
const feedUrl = tl.getInput("feedUrl");
2424
const entraWifServiceConnectionName = tl.getInput("workloadIdentityServiceConnection");
2525

26+
// Only cross-org feedUrls are supported with Azure Devops service connections. If feedUrl is internal, the task will fail.
2627
if (feedUrl && entraWifServiceConnectionName) {
2728
tl.debug(tl.loc("Info_AddingFederatedFeedAuth", entraWifServiceConnectionName, feedUrl));
28-
await configureEntraCredProvider(ProtocolType.NuGet, feedUrl, entraWifServiceConnectionName);
29+
await configureEntraCredProvider(ProtocolType.NuGet, entraWifServiceConnectionName, feedUrl);
30+
federatedFeedAuthSuccessCount++;
2931
console.log(tl.loc("Info_SuccessAddingFederatedFeedAuth", feedUrl));
30-
federatedFeedAuthSuccessCount++;
3132

3233
return;
33-
} else if (feedUrl || entraWifServiceConnectionName) {
34+
}
35+
// If the user doesn't provide a feedUrl, use the Azure Devops service connection to replace the Build Service
36+
else if (!feedUrl && entraWifServiceConnectionName) {
37+
configureCredProviderForSameOrganizationFeeds(ProtocolType.NuGet, entraWifServiceConnectionName);
38+
return;
39+
}
40+
else if (feedUrl) {
3441
throw new Error(tl.loc("Error_MissingFeedUrlOrServiceConnection"));
3542
}
3643
#endif

Tasks/NuGetAuthenticateV1/package-lock.json

+42-42
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/NuGetAuthenticateV1/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"dependencies": {
2626
"@types/node": "10.17.0",
2727
"azure-pipelines-task-lib": "^4.13.0",
28-
"azure-pipelines-tasks-artifacts-common": "^2.244.4"
28+
"azure-pipelines-tasks-artifacts-common": "^2.247.0"
2929
},
3030
"devDependencies": {
3131
"typescript": "4.0.2"

Tasks/NuGetAuthenticateV1/task.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 1,
1616
"Minor": 247,
17-
"Patch": 0
17+
"Patch": 3
1818
},
1919
"minimumAgentVersion": "2.144.0",
2020
"instanceNameFormat": "NuGet Authenticate",

Tasks/NuGetAuthenticateV1/task.loc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 1,
1616
"Minor": 247,
17-
"Patch": 0
17+
"Patch": 3
1818
},
1919
"minimumAgentVersion": "2.144.0",
2020
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Default|1.247.0
2-
Node20_229_1|1.247.1
3-
wif_242|1.247.2
1+
Default|1.247.3
2+
Node20_229_1|1.247.4
3+
wif_242|1.247.5

_generated/NuGetAuthenticateV1/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as path from 'path';
22
import * as tl from 'azure-pipelines-task-lib/task';
3-
import { installCredProviderToUserProfile, configureCredProvider} from 'azure-pipelines-tasks-artifacts-common/credentialProviderUtils'
3+
import { installCredProviderToUserProfile, configureCredProvider, configureCredProviderForSameOrganizationFeeds} from 'azure-pipelines-tasks-artifacts-common/credentialProviderUtils'
44
import { ProtocolType } from 'azure-pipelines-tasks-artifacts-common/protocols';
55
import { getPackagingServiceConnections } from 'azure-pipelines-tasks-artifacts-common/serviceConnectionUtils'
66
import { emitTelemetry } from 'azure-pipelines-tasks-artifacts-common/telemetry'

_generated/NuGetAuthenticateV1/package-lock.json

+42-42
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_generated/NuGetAuthenticateV1/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"dependencies": {
2626
"@types/node": "10.17.0",
2727
"azure-pipelines-task-lib": "^4.13.0",
28-
"azure-pipelines-tasks-artifacts-common": "^2.244.4"
28+
"azure-pipelines-tasks-artifacts-common": "^2.247.0"
2929
},
3030
"devDependencies": {
3131
"typescript": "4.0.2"

_generated/NuGetAuthenticateV1/task.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 1,
1616
"Minor": 247,
17-
"Patch": 0
17+
"Patch": 3
1818
},
1919
"minimumAgentVersion": "2.144.0",
2020
"instanceNameFormat": "NuGet Authenticate",
@@ -56,8 +56,8 @@
5656
"Info_SuccessAddingFederatedFeedAuth": "Successfully added auth for feed %s."
5757
},
5858
"_buildConfigMapping": {
59-
"Default": "1.247.0",
60-
"Node20_229_1": "1.247.1",
61-
"wif_242": "1.247.2"
59+
"Default": "1.247.3",
60+
"Node20_229_1": "1.247.4",
61+
"wif_242": "1.247.5"
6262
}
6363
}

_generated/NuGetAuthenticateV1/task.loc.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 1,
1616
"Minor": 247,
17-
"Patch": 0
17+
"Patch": 3
1818
},
1919
"minimumAgentVersion": "2.144.0",
2020
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
@@ -56,8 +56,8 @@
5656
"Info_SuccessAddingFederatedFeedAuth": "ms-resource:loc.messages.Info_SuccessAddingFederatedFeedAuth"
5757
},
5858
"_buildConfigMapping": {
59-
"Default": "1.247.0",
60-
"Node20_229_1": "1.247.1",
61-
"wif_242": "1.247.2"
59+
"Default": "1.247.3",
60+
"Node20_229_1": "1.247.4",
61+
"wif_242": "1.247.5"
6262
}
6363
}

_generated/NuGetAuthenticateV1_Node20/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as path from 'path';
22
import * as tl from 'azure-pipelines-task-lib/task';
3-
import { installCredProviderToUserProfile, configureCredProvider} from 'azure-pipelines-tasks-artifacts-common/credentialProviderUtils'
3+
import { installCredProviderToUserProfile, configureCredProvider, configureCredProviderForSameOrganizationFeeds} from 'azure-pipelines-tasks-artifacts-common/credentialProviderUtils'
44
import { ProtocolType } from 'azure-pipelines-tasks-artifacts-common/protocols';
55
import { getPackagingServiceConnections } from 'azure-pipelines-tasks-artifacts-common/serviceConnectionUtils'
66
import { emitTelemetry } from 'azure-pipelines-tasks-artifacts-common/telemetry'

0 commit comments

Comments
 (0)