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

Fixing download build artifact for accidental repeated download from … #7605

Merged
merged 1 commit into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@
"loc.messages.ArtifactNameDirectoryNotFound": "Directory '%s' does not exist. Falling back to parent directory: %s",
"loc.messages.LatestBuildFound": "Latest build found: %s",
"loc.messages.LatestBuildNotFound": "Latest build not found",
"loc.messages.LatestBuildFromBranchNotFound": "Latest build from branch %s not found"
"loc.messages.LatestBuildFromBranchNotFound": "Latest build from branch %s not found",
"loc.messages.DownloadingContainerResource": "Downloading items from container resource %s"
}
13 changes: 8 additions & 5 deletions Tasks/DownloadBuildArtifactsV0/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,16 @@ async function main(): Promise<void> {

if (artifact.resource.type.toLowerCase() === "container") {
let downloader = new engine.ArtifactEngine();
var containerParts: string[] = artifact.resource.data.split('/', 3);
if (containerParts.length !== 3) {

console.log(tl.loc("DownloadingContainerResource", artifact.resource.data));
var containerParts = artifact.resource.data.split('/');

if (containerParts.length < 3) {
throw new Error(tl.loc("FileContainerInvalidArtifactData"));
}

var containerId: number = parseInt(containerParts[1]);
var containerPath: string = containerParts[2];
var containerId = parseInt(containerParts[1]);
var containerPath = containerParts.slice(2,containerParts.length).join('/');

var itemsUrl = endpointUrl + "/_apis/resources/Containers/" + containerId + "?itemPath=" + encodeURIComponent(containerPath) + "&isShallow=true&api-version=4.1-preview.4";
console.log(tl.loc("DownloadArtifacts", artifact.name, itemsUrl));
Expand Down
3 changes: 2 additions & 1 deletion Tasks/DownloadBuildArtifactsV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
"ArtifactNameDirectoryNotFound": "Directory '%s' does not exist. Falling back to parent directory: %s",
"LatestBuildFound": "Latest build found: %s",
"LatestBuildNotFound":"Latest build not found",
"LatestBuildFromBranchNotFound":"Latest build from branch %s not found"
"LatestBuildFromBranchNotFound":"Latest build from branch %s not found",
"DownloadingContainerResource": "Downloading items from container resource %s"
}
}
3 changes: 2 additions & 1 deletion Tasks/DownloadBuildArtifactsV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
"ArtifactNameDirectoryNotFound": "ms-resource:loc.messages.ArtifactNameDirectoryNotFound",
"LatestBuildFound": "ms-resource:loc.messages.LatestBuildFound",
"LatestBuildNotFound": "ms-resource:loc.messages.LatestBuildNotFound",
"LatestBuildFromBranchNotFound": "ms-resource:loc.messages.LatestBuildFromBranchNotFound"
"LatestBuildFromBranchNotFound": "ms-resource:loc.messages.LatestBuildFromBranchNotFound",
"DownloadingContainerResource": "ms-resource:loc.messages.DownloadingContainerResource"
}
}