Skip to content

Commit

Permalink
added flag rescueChangesNotSendForReview (#327)
Browse files Browse the repository at this point in the history
* added flag rescueChangesNotSendForReview

* Bumped minor version

* fixed typo in textfile

* fixed typo in labelname

* Update again the minor version to current sprint number

* bumped minor version to current sprint

* added visible rule to show the new option in UI only if "changesNotSentForReview = true"

* bumped extension version

* added visibleRule also to task.loc.json
  • Loading branch information
devops-ninja2021 authored Apr 4, 2023
1 parent 3086e25 commit e123496
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
"loc.input.help.nativeDebugSymbolsFile": "The path to the native debug symbols (.zip) file to upload. Glob patterns are supported.",
"loc.input.label.changesNotSentForReview": "Send changes to review",
"loc.input.help.changesNotSentForReview": "Select this option to send changes for review in GooglePlay Console. If changes are already sent for review automatically, you shouldn't select this option. [More info](https://developers.google.com/android-publisher/api-ref/rest/v3/edits/commit#query-parameters).",
"loc.input.label.rescueChangesNotSentForReview": "Retry commit if changesNotSentForReview failed",
"loc.input.help.rescueChangesNotSentForReview": "Retry commit if changesNotSentForReview failed",
"loc.input.label.releaseName": "Release name",
"loc.input.help.releaseName": "The release name is only for use in Play Console and won't be visible to users. To make your release easier to identify, add a release name that's meaningful to you.",
"loc.input.label.versionCodeFilterType": "Replace version codes",
Expand Down Expand Up @@ -92,4 +94,4 @@
"loc.messages.UpdateTrack": "Updating track information...",
"loc.messages.UploadImageFail": "Failed to upload image.",
"loc.messages.UploadingMetadataForLanguage": "Attempting to upload metadata in %s for language code %s"
}
}
34 changes: 33 additions & 1 deletion Tasks/GooglePlayReleaseV4/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ async function run(): Promise<void> {
const nativeDebugSymbolsFilePattern: string = tl.getInput('nativeDebugSymbolsFile');

const changesNotSentForReview: boolean = tl.getBoolInput('changesNotSentForReview');
tl.debug(`changesNotSentForReview: ${changesNotSentForReview}`);
const rescueChangesNotSentForReview: boolean = tl.getBoolInput('rescueChangesNotSentForReview', false);
tl.debug(`rescueChangesNotSentForReview: ${rescueChangesNotSentForReview}`);

const releaseName: string = tl.getInput('releaseName', false);

Expand Down Expand Up @@ -226,8 +229,37 @@ async function run(): Promise<void> {
}

tl.debug('Committing the edit transaction in Google Play.');
await edits.commit({ changesNotSentForReview });
try {
await edits.commit({ changesNotSentForReview });
} catch (error) {
if (!rescueChangesNotSentForReview) {
throw error;
}

tl.debug('Try to rescue commit enabled.');
if (
error.message.includes(
'The query parameter changesNotSentForReview must not be set'
)
) {
console.log(
'Try to rescue commit without sending changesNotSentForReview flag.'
);
await edits.commit();
} else if (
error.message.includes(
'Please set the query parameter changesNotSentForReview to true'
)
) {
console.log(
'Try to rescue commit by setting changesNotSentForReview to true'
);
let changesNotSentForReview = true;
await edits.commit({ changesNotSentForReview });
} else {
throw error;
}
}
console.log(tl.loc('TrackInfo', track));
tl.setResult(tl.TaskResult.Succeeded, tl.loc('PublishSucceed'));
} catch (e) {
Expand Down
9 changes: 9 additions & 0 deletions Tasks/GooglePlayReleaseV4/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,15 @@
"helpMarkDown": "Select this option to send changes for review in GooglePlay Console. If changes are already sent for review automatically, you shouldn't select this option. [More info](https://developers.google.com/android-publisher/api-ref/rest/v3/edits/commit#query-parameters).",
"groupName": "advanced"
},
{
"name": "rescueChangesNotSentForReview",
"type": "boolean",
"label": "Retry commit if changesNotSentForReview failed",
"defaultValue": false,
"helpMarkDown": "Retry commit if changesNotSentForReview failed",
"groupName": "advanced",
"visibleRule": "changesNotSentForReview = true"
},
{
"name": "releaseName",
"type": "string",
Expand Down
9 changes: 9 additions & 0 deletions Tasks/GooglePlayReleaseV4/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,15 @@
"helpMarkDown": "ms-resource:loc.input.help.changesNotSentForReview",
"groupName": "advanced"
},
{
"name": "rescueChangesNotSentForReview",
"type": "boolean",
"label": "ms-resource:loc.input.label.rescueChangesNotSentForReview",
"defaultValue": false,
"helpMarkDown": "ms-resource:loc.input.help.rescueChangesNotSentForReview",
"groupName": "advanced",
"visibleRule": "changesNotSentForReview = true"
},
{
"name": "releaseName",
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion vsts-extension-google-play.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifestVersion": 1.0,
"id": "google-play",
"name": "Google Play",
"version": "4.220.0",
"version": "4.220.1",
"publisher": "ms-vsclient",
"description": "Provides tasks for continuous delivery to the Google Play Store from TFS/Team Services build or release definitions",
"categories": [
Expand Down

0 comments on commit e123496

Please sign in to comment.