diff --git a/Tasks/JenkinsDownloadArtifacts/jenkinsdownloadartifacts.ts b/Tasks/JenkinsDownloadArtifacts/jenkinsdownloadartifacts.ts index c04536da45fb..c7657310beda 100644 --- a/Tasks/JenkinsDownloadArtifacts/jenkinsdownloadartifacts.ts +++ b/Tasks/JenkinsDownloadArtifacts/jenkinsdownloadartifacts.ts @@ -19,6 +19,7 @@ import { JenkinsRestClient, JenkinsJobDetails } from "./ArtifactDetails/JenkinsR var DecompressZip = require('decompress-zip'); var fsExtra = require('fs-extra'); var taskJson = require('./task.json'); +var uuidv4 = require('uuid/v4'); const area: string = 'JenkinsDownloadArtifacts'; @@ -171,9 +172,23 @@ async function doWork() { tl.rmRF(zipLocation); } - fsExtra.move(path.join(localPathRoot, "archive"), localPathRoot).catch((error) => { - throw error; - }); + var archivePath = path.join(localPathRoot, "archive"); + var tempPath = path.join(localPathRoot, uuidv4()); + fsExtra.move(archivePath, tempPath) + .then(() => { + fsExtra.copy(tempPath, localPathRoot) + .then(() => { + fsExtra.remove(tempPath).catch((error) => { + throw error; + }); + }) + .catch((error) => { + throw error; + }); + }) + .catch((error) => { + throw error; + }); } else { await getArtifactsFromUrl(artifactQueryUrl, strictSSL, localPathRoot, itemPattern, handler, variables); diff --git a/Tasks/JenkinsDownloadArtifacts/task.json b/Tasks/JenkinsDownloadArtifacts/task.json index 209f5a39afd0..5af5043fd0d1 100644 --- a/Tasks/JenkinsDownloadArtifacts/task.json +++ b/Tasks/JenkinsDownloadArtifacts/task.json @@ -18,7 +18,7 @@ "version": { "Major": 1, "Minor": 133, - "Patch": 1 + "Patch": 2 }, "groups": [ { diff --git a/Tasks/JenkinsDownloadArtifacts/task.loc.json b/Tasks/JenkinsDownloadArtifacts/task.loc.json index 36ca5b5b7770..bc2f971da072 100644 --- a/Tasks/JenkinsDownloadArtifacts/task.loc.json +++ b/Tasks/JenkinsDownloadArtifacts/task.loc.json @@ -18,7 +18,7 @@ "version": { "Major": 1, "Minor": 133, - "Patch": 1 + "Patch": 2 }, "groups": [ {