Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed functionality from deprecated tasks DownloadPackageV0, NuGetInstallerV0, and NuGetRestoreV1 #19908

Merged

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

953 changes: 576 additions & 377 deletions Tasks/DownloadPackageV0/_buildConfigs/Node20/package-lock.json

Large diffs are not rendered by default.

46 changes: 1 addition & 45 deletions Tasks/DownloadPackageV0/download.ts
MicroTuld marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,7 @@ import { WebApi } from 'azure-devops-node-api';
tl.setResourcePath(path.join(__dirname, 'task.json'));

async function main(): Promise<void> {
tl.warning(tl.loc("DeprecatedTask"));
var feed = getProjectAndFeedIdFromInputParam("feed");
if(feed.projectId) {
throw new Error(tl.loc("UnsupportedProjectScopedFeeds"));
}
let feedId = feed.feedId;
let regexGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
let packageId = tl.getInput("definition");

if(!regexGuid.test(packageId)){
packageId = "Nuget_" + tl.getInput("definition");
}

let version = tl.getInput("version");
let downloadPath = tl.getInput("downloadPath");
let collectionUrl = tl.getVariable("System.TeamFoundationCollectionUri");

var accessToken = getAuthToken();

const feedConnection = await getConnection("7AB4E64E-C4D8-4F50-AE73-5EF2E21642A5", collectionUrl, accessToken);
const pkgsConnection = await getConnection("B3BE7473-68EA-4A81-BFC7-9530BAAA19AD", collectionUrl, accessToken);

const retryLimitValue: string = tl.getVariable("VSTS_HTTP_RETRY");
const retryLimit: number = (!!retryLimitValue && !isNaN(parseInt(retryLimitValue))) ? parseInt(retryLimitValue) : 4;
tl.debug(`RetryLimit set to ${retryLimit}`);

await executeWithRetries("downloadPackage", () => downloadPackage(feedConnection, pkgsConnection, feedId, packageId, version, downloadPath).catch((reason) => {
throw reason;
}), retryLimit);

let shouldFail = tl.getVariable('FAIL_DEPRECATED_TASK');

if (shouldFail != null && shouldFail.toLowerCase() === 'true') {
throw new Error(tl.loc("DeprecatedTask"));
}
}

function getAuthToken() {
var auth = tl.getEndpointAuthorization('SYSTEMVSSCONNECTION', false);
if (auth.scheme.toLowerCase() === 'oauth') {
return auth.parameters['AccessToken'];
}
else {
throw new Error(tl.loc("CredentialsNotFound"))
}
throw new Error(tl.loc("DeprecatedTask"));
MicroTuld marked this conversation as resolved.
Show resolved Hide resolved
}

export async function downloadPackage(feedConnection: WebApi, pkgsConnection: WebApi, feedId: string, packageId: string, version: string, downloadPath: string) {
amp-powell marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
40 changes: 20 additions & 20 deletions Tasks/DownloadPackageV0/package-lock.json

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

2 changes: 1 addition & 1 deletion Tasks/DownloadPackageV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "ms-vscs-rm",
"version": {
"Major": 0,
"Minor": 238,
"Minor": 240,
"Patch": 0
},
"demands": [],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DownloadPackageV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "ms-vscs-rm",
"version": {
"Major": 0,
"Minor": 238,
"Minor": 240,
"Patch": 0
},
"demands": [],
Expand Down
Loading
Loading