From 5bce5984e302de15d2da7e6a234252d58e9ce16e Mon Sep 17 00:00:00 2001 From: Omesh Pandita Date: Tue, 10 Apr 2018 17:24:36 +0530 Subject: [PATCH 1/2] Fix move artifact files issue on linux. --- .../jenkinsdownloadartifacts.ts | 21 ++++++++++++++++--- Tasks/JenkinsDownloadArtifacts/task.json | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) 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": [ { From 63a9f28b259f0f4123c7716b5c76fb2998dcbb5e Mon Sep 17 00:00:00 2001 From: Omesh Pandita Date: Tue, 10 Apr 2018 17:36:31 +0530 Subject: [PATCH 2/2] generated changes --- Tasks/JenkinsDownloadArtifacts/task.loc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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": [ {