From 592e6a3f5915f6474e8ed3f0f9b4512d8d0c5325 Mon Sep 17 00:00:00 2001 From: Matt Gleason Date: Wed, 6 Sep 2023 16:35:35 -0700 Subject: [PATCH 1/2] Log more descriptive error message if version option input is invalid --- Tasks/UniversalPackagesV0/task.json | 3 ++- Tasks/UniversalPackagesV0/universalpublish.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Tasks/UniversalPackagesV0/task.json b/Tasks/UniversalPackagesV0/task.json index c3123b13143f..4bdfc7344b3b 100644 --- a/Tasks/UniversalPackagesV0/task.json +++ b/Tasks/UniversalPackagesV0/task.json @@ -9,7 +9,7 @@ "category": "Package", "version": { "Major": 0, - "Minor": 227, + "Minor": 228, "Patch": 0 }, "runsOn": [ @@ -427,6 +427,7 @@ "PackagesPublishedSuccessfully": "Packages were published successfully", "PackagesFailedToPublish": "Packages failed to publish", "UnknownFeedType": "Unknown feed type '%s'", + "Error_NoVersionOptionSpecifiedForPublish": "Invalid versionOption/versionPublishSelector provided. Must be set to 'major', 'minor', 'patch', or 'custom'", "Error_NoSourceSpecifiedForPublish": "No external source was specified for publish", "Error_NoSourceSpecifiedForDownload": "No external source was specified for download", "Error_UnexpectedErrorArtifactTool": "An unexpected error occurred while trying to push the package. Exit code(%s) and error(%s)", diff --git a/Tasks/UniversalPackagesV0/universalpublish.ts b/Tasks/UniversalPackagesV0/universalpublish.ts index 96506c7f70fb..d3d4ef5f7418 100644 --- a/Tasks/UniversalPackagesV0/universalpublish.ts +++ b/Tasks/UniversalPackagesV0/universalpublish.ts @@ -88,9 +88,11 @@ export async function run(artifactToolPath: string): Promise { if (versionRadio === "custom") { version = tl.getInput("versionPublish"); } - else { + else if (versionRadio in ["major", "minor", "patch"]) { feedUri = await pkgLocationUtils.getFeedUriFromBaseServiceUri(serviceUri, accessToken); version = await getNextPackageVersion(feedUri, accessToken, projectId, feedId, packageName); + } else { + throw new Error(tl.loc("Error_NoVersionOptionSpecifiedForPublish")); } tl.debug(tl.loc("Info_UsingArtifactToolPublish")); From c23c98364d017357eba6bd15c08dd39a996248dc Mon Sep 17 00:00:00 2001 From: Matt Gleason Date: Thu, 7 Sep 2023 15:59:21 -0700 Subject: [PATCH 2/2] Run build, correct version strings --- .../Strings/resources.resjson/en-US/resources.resjson | 1 + Tasks/UniversalPackagesV0/task.loc.json | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Tasks/UniversalPackagesV0/Strings/resources.resjson/en-US/resources.resjson b/Tasks/UniversalPackagesV0/Strings/resources.resjson/en-US/resources.resjson index a53b189311bd..76d3b803022b 100644 --- a/Tasks/UniversalPackagesV0/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/UniversalPackagesV0/Strings/resources.resjson/en-US/resources.resjson @@ -59,6 +59,7 @@ "loc.messages.PackagesPublishedSuccessfully": "Packages were published successfully", "loc.messages.PackagesFailedToPublish": "Packages failed to publish", "loc.messages.UnknownFeedType": "Unknown feed type '%s'", + "loc.messages.Error_NoVersionOptionSpecifiedForPublish": "Invalid versionOption/versionPublishSelector provided. Must be set to 'major', 'minor', 'patch', or 'custom'", "loc.messages.Error_NoSourceSpecifiedForPublish": "No external source was specified for publish", "loc.messages.Error_NoSourceSpecifiedForDownload": "No external source was specified for download", "loc.messages.Error_UnexpectedErrorArtifactTool": "An unexpected error occurred while trying to push the package. Exit code(%s) and error(%s)", diff --git a/Tasks/UniversalPackagesV0/task.loc.json b/Tasks/UniversalPackagesV0/task.loc.json index 375fa5895a5d..5a849f6a7d24 100644 --- a/Tasks/UniversalPackagesV0/task.loc.json +++ b/Tasks/UniversalPackagesV0/task.loc.json @@ -9,7 +9,7 @@ "category": "Package", "version": { "Major": 0, - "Minor": 227, + "Minor": 228, "Patch": 0 }, "runsOn": [ @@ -427,6 +427,7 @@ "PackagesPublishedSuccessfully": "ms-resource:loc.messages.PackagesPublishedSuccessfully", "PackagesFailedToPublish": "ms-resource:loc.messages.PackagesFailedToPublish", "UnknownFeedType": "ms-resource:loc.messages.UnknownFeedType", + "Error_NoVersionOptionSpecifiedForPublish": "ms-resource:loc.messages.Error_NoVersionOptionSpecifiedForPublish", "Error_NoSourceSpecifiedForPublish": "ms-resource:loc.messages.Error_NoSourceSpecifiedForPublish", "Error_NoSourceSpecifiedForDownload": "ms-resource:loc.messages.Error_NoSourceSpecifiedForDownload", "Error_UnexpectedErrorArtifactTool": "ms-resource:loc.messages.Error_UnexpectedErrorArtifactTool",