Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 840a2a5

Browse files
max-mironovRichard Hua
authored andcommitted
Add ability to promote a specific label (#394)
* Add ability to promote a specific label * Updated Documentation and log message from CLI * Modified README
1 parent 5dfefc1 commit 840a2a5

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

cli/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,7 @@ Once you've tested an update against a specific deployment (e.g. `Staging`), and
732732
```
733733
code-push promote <appName> <sourceDeploymentName> <destDeploymentName>
734734
[--description <description>]
735+
[--label <label>]
735736
[--disabled <disabled>]
736737
[--mandatory]
737738
[--noDuplicateReleaseError]
@@ -751,6 +752,10 @@ We recommend that all users take advantage of the automatically created `Staging
751752

752753
This is the same parameter as the one described in the [above section](#description-parameter), and simply allows you to override the description that will be used for the promoted release. If unspecified, the new release will inherit the description from the release being promoted.
753754

755+
### Label parameter
756+
757+
This optional parameter allows you to pick the specified label from the source deployment and promote it to the destination deployment. If unspecified, the latest release on the source deployment will be promoted.
758+
754759
### Disabled parameter
755760

756761
This is the same parameter as the one described in the [above section](#disabled-parameter), and simply allows you to override the value of the disabled flag that will be used for the promoted release. If unspecified, the new release will inherit the disabled property from the release being promoted.

cli/definitions/cli.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export interface ILoginCommand extends ICommand {
146146

147147
export interface IPackageInfo {
148148
description?: string;
149+
label?: string;
149150
disabled?: boolean;
150151
mandatory?: boolean;
151152
rollout?: number;

cli/script/command-executor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,14 +1077,15 @@ function promote(command: cli.IPromoteCommand): Promise<void> {
10771077
var packageInfo: PackageInfo = {
10781078
appVersion: command.appStoreVersion,
10791079
description: command.description,
1080+
label: command.label,
10801081
isDisabled: getYargsBooleanOrNull(command.disabled),
10811082
isMandatory: getYargsBooleanOrNull(command.mandatory),
10821083
rollout: command.rollout
10831084
};
10841085

10851086
return sdk.promote(command.appName, command.sourceDeploymentName, command.destDeploymentName, packageInfo)
10861087
.then((): void => {
1087-
log("Successfully promoted the \"" + command.sourceDeploymentName + "\" deployment of the \"" + command.appName + "\" app to the \"" + command.destDeploymentName + "\" deployment.");
1088+
log("Successfully promoted " + (command.label !== null ? "\"" + command.label + "\" of " : "") + "the \"" + command.sourceDeploymentName + "\" deployment of the \"" + command.appName + "\" app to the \"" + command.destDeploymentName + "\" deployment.");
10881089
})
10891090
.catch((err: CodePushError) => releaseErrorHandler(err, command));
10901091
}

cli/script/command-parser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ var argv = yargs.usage(USAGE_PREFIX + " <command>")
356356
.example("promote MyApp Staging Production", "Promotes the latest release within the \"Staging\" deployment of \"MyApp\" to \"Production\"")
357357
.example("promote MyApp Staging Production --des \"Production rollout\" -r 25", "Promotes the latest release within the \"Staging\" deployment of \"MyApp\" to \"Production\", with an updated description, and targeting only 25% of the users")
358358
.option("description", { alias: "des", default: null, demand: false, description: "Description of the changes made to the app with this release. If omitted, the description from the release being promoted will be used.", type: "string" })
359+
.option("label", { alias: "l", default: null, demand: false, description: "Label of the source release that will be taken. If omitted, the latest release being promoted will be used.", type: "string" })
359360
.option("disabled", { alias: "x", default: null, demand: false, description: "Specifies whether this release should be immediately downloadable. If omitted, the disabled attribute from the release being promoted will be used.", type: "boolean" })
360361
.option("mandatory", { alias: "m", default: null, demand: false, description: "Specifies whether this release should be considered mandatory. If omitted, the mandatory property from the release being promoted will be used.", type: "boolean" })
361362
.option("noDuplicateReleaseError", { default: false, demand: false, description: "When this flag is set, promoting a package that is identical to the latest release on the target deployment will produce a warning instead of an error", type: "boolean" })
@@ -751,6 +752,7 @@ function createCommand(): cli.ICommand {
751752
deploymentPromoteCommand.sourceDeploymentName = arg2;
752753
deploymentPromoteCommand.destDeploymentName = arg3;
753754
deploymentPromoteCommand.description = argv["description"] ? backslash(argv["description"]) : "";
755+
deploymentPromoteCommand.label = argv["label"];
754756
deploymentPromoteCommand.disabled = argv["disabled"];
755757
deploymentPromoteCommand.mandatory = argv["mandatory"];
756758
deploymentPromoteCommand.noDuplicateReleaseError = argv["noDuplicateReleaseError"];

0 commit comments

Comments
 (0)