Skip to content

Commit

Permalink
Fixing download build artifact for accidental repeated download from …
Browse files Browse the repository at this point in the history
…container (#7715)
  • Loading branch information
Kalyan-microsoft authored Jul 13, 2018
1 parent fea9922 commit 896052c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
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 @@ -225,13 +225,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
5 changes: 3 additions & 2 deletions Tasks/DownloadBuildArtifactsV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"version": {
"Major": 0,
"Minor": 136,
"Patch": 4
"Patch": 5
},
"groups": [
{
Expand Down 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"
}
}
5 changes: 3 additions & 2 deletions Tasks/DownloadBuildArtifactsV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"version": {
"Major": 0,
"Minor": 136,
"Patch": 4
"Patch": 5
},
"groups": [
{
Expand Down Expand Up @@ -228,6 +228,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"
}
}

0 comments on commit 896052c

Please sign in to comment.