From df267808fe19cbda5155d79c27bc392ae66eccd8 Mon Sep 17 00:00:00 2001 From: Sunny Kumar Date: Thu, 25 May 2017 15:38:35 +0530 Subject: [PATCH 1/3] Enabling PublishBuildArtifact task in RM file share scenerio --- .../Strings/resources.resjson/en-US/resources.resjson | 2 +- Tasks/PublishBuildArtifacts/publishbuildartifacts.ts | 2 +- Tasks/PublishBuildArtifacts/task.json | 4 ++-- Tasks/PublishBuildArtifacts/task.loc.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Tasks/PublishBuildArtifacts/Strings/resources.resjson/en-US/resources.resjson b/Tasks/PublishBuildArtifacts/Strings/resources.resjson/en-US/resources.resjson index 8aa840f5586a..63a8a86fe0bd 100644 --- a/Tasks/PublishBuildArtifacts/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/PublishBuildArtifacts/Strings/resources.resjson/en-US/resources.resjson @@ -12,6 +12,6 @@ "loc.input.label.TargetPath": "Path", "loc.input.help.TargetPath": "The file share to which to copy the files", "loc.messages.ErrorFileShareLinux": "Cannot publish artifacts from an OSX or Linux agent to a file share. You can change the artifact type to server or use a Windows agent.", - "loc.messages.ErrorHostTypeNotSupported": "This task is only supported within a Build job.", + "loc.messages.ErrorHostTypeNotSupported": "This task can be used to publish to server drop only within a Build job.", "loc.messages.PublishBuildArtifactsFailed": "Publish build artifacts failed with error: %s" } \ No newline at end of file diff --git a/Tasks/PublishBuildArtifacts/publishbuildartifacts.ts b/Tasks/PublishBuildArtifacts/publishbuildartifacts.ts index 076d9c5a9c89..24eeff3e9156 100644 --- a/Tasks/PublishBuildArtifacts/publishbuildartifacts.ts +++ b/Tasks/PublishBuildArtifacts/publishbuildartifacts.ts @@ -48,7 +48,7 @@ async function run() { tl.setResourcePath(path.join(__dirname, 'task.json')); let hostType = tl.getVariable('system.hostType'); - if (hostType && hostType.toUpperCase() != 'BUILD') { + if ((hostType && hostType.toUpperCase() != 'BUILD') && (artifactType !== "filepath")) { tl.setResult(tl.TaskResult.Failed, tl.loc('ErrorHostTypeNotSupported')); return; } diff --git a/Tasks/PublishBuildArtifacts/task.json b/Tasks/PublishBuildArtifacts/task.json index ddec6ed710f3..5a7ab3c9e067 100644 --- a/Tasks/PublishBuildArtifacts/task.json +++ b/Tasks/PublishBuildArtifacts/task.json @@ -12,7 +12,7 @@ "version": { "Major": 1, "Minor": 0, - "Patch": 41 + "Patch": 42 }, "demands": [], "minimumAgentVersion": "1.91.0", @@ -64,7 +64,7 @@ }, "messages": { "ErrorFileShareLinux": "Cannot publish artifacts from an OSX or Linux agent to a file share. You can change the artifact type to server or use a Windows agent.", - "ErrorHostTypeNotSupported": "This task is only supported within a Build job.", + "ErrorHostTypeNotSupported": "This task can be used to publish to server drop only within a Build job.", "PublishBuildArtifactsFailed": "Publish build artifacts failed with error: %s" } } \ No newline at end of file diff --git a/Tasks/PublishBuildArtifacts/task.loc.json b/Tasks/PublishBuildArtifacts/task.loc.json index 85e466a6bd20..623266e0fdf8 100644 --- a/Tasks/PublishBuildArtifacts/task.loc.json +++ b/Tasks/PublishBuildArtifacts/task.loc.json @@ -12,7 +12,7 @@ "version": { "Major": 1, "Minor": 0, - "Patch": 41 + "Patch": 42 }, "demands": [], "minimumAgentVersion": "1.91.0", From 90c089c8bba643b5c8cbcc64f760db12d8b218fa Mon Sep 17 00:00:00 2001 From: SunnyKumarR Date: Fri, 26 May 2017 11:36:55 +0530 Subject: [PATCH 2/3] Fixing PR comments --- .../Strings/resources.resjson/en-US/resources.resjson | 2 +- Tasks/PublishBuildArtifacts/task.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tasks/PublishBuildArtifacts/Strings/resources.resjson/en-US/resources.resjson b/Tasks/PublishBuildArtifacts/Strings/resources.resjson/en-US/resources.resjson index 63a8a86fe0bd..c2ced6ad90b6 100644 --- a/Tasks/PublishBuildArtifacts/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/PublishBuildArtifacts/Strings/resources.resjson/en-US/resources.resjson @@ -12,6 +12,6 @@ "loc.input.label.TargetPath": "Path", "loc.input.help.TargetPath": "The file share to which to copy the files", "loc.messages.ErrorFileShareLinux": "Cannot publish artifacts from an OSX or Linux agent to a file share. You can change the artifact type to server or use a Windows agent.", - "loc.messages.ErrorHostTypeNotSupported": "This task can be used to publish to server drop only within a Build job.", + "loc.messages.ErrorHostTypeNotSupported": "This task can be used to publish to server drop within a Build job only.", "loc.messages.PublishBuildArtifactsFailed": "Publish build artifacts failed with error: %s" } \ No newline at end of file diff --git a/Tasks/PublishBuildArtifacts/task.json b/Tasks/PublishBuildArtifacts/task.json index 5a7ab3c9e067..09565d38ff2c 100644 --- a/Tasks/PublishBuildArtifacts/task.json +++ b/Tasks/PublishBuildArtifacts/task.json @@ -64,7 +64,7 @@ }, "messages": { "ErrorFileShareLinux": "Cannot publish artifacts from an OSX or Linux agent to a file share. You can change the artifact type to server or use a Windows agent.", - "ErrorHostTypeNotSupported": "This task can be used to publish to server drop only within a Build job.", + "ErrorHostTypeNotSupported": "This task can be used to publish to server drop within a Build job only.", "PublishBuildArtifactsFailed": "Publish build artifacts failed with error: %s" } } \ No newline at end of file From 5dd592aa9043050ec0b64533987089153109db0b Mon Sep 17 00:00:00 2001 From: SunnyKumarR Date: Fri, 26 May 2017 17:54:02 +0530 Subject: [PATCH 3/3] Fixing artifact type case sensitiveness issue --- Tasks/PublishBuildArtifacts/publishbuildartifacts.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Tasks/PublishBuildArtifacts/publishbuildartifacts.ts b/Tasks/PublishBuildArtifacts/publishbuildartifacts.ts index 24eeff3e9156..ae00252f9892 100644 --- a/Tasks/PublishBuildArtifacts/publishbuildartifacts.ts +++ b/Tasks/PublishBuildArtifacts/publishbuildartifacts.ts @@ -47,17 +47,17 @@ async function run() { try { tl.setResourcePath(path.join(__dirname, 'task.json')); - let hostType = tl.getVariable('system.hostType'); - if ((hostType && hostType.toUpperCase() != 'BUILD') && (artifactType !== "filepath")) { - tl.setResult(tl.TaskResult.Failed, tl.loc('ErrorHostTypeNotSupported')); - return; - } - // PathtoPublish is a folder that contains the files let pathtoPublish: string = tl.getPathInput('PathtoPublish', true, true); let artifactName: string = tl.getInput('ArtifactName', true); let artifactType: string = tl.getInput('ArtifactType', true); + let hostType = tl.getVariable('system.hostType'); + if ((hostType && hostType.toUpperCase() != 'BUILD') && (artifactType.toUpperCase() !== "FILEPATH")) { + tl.setResult(tl.TaskResult.Failed, tl.loc('ErrorHostTypeNotSupported')); + return; + } + artifactType = artifactType.toLowerCase(); let data = { artifacttype: artifactType,