Add ability to promote a specific label (#394)

* Add ability to promote a specific label

* Updated Documentation and log message from CLI

* Modified README
This commit is contained in:
max-mironov 2017-02-25 03:02:10 +03:00 коммит произвёл Richard Hua
Родитель 5dfefc118c
Коммит 840a2a5fda
4 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -732,6 +732,7 @@ Once you've tested an update against a specific deployment (e.g. `Staging`), and
```
code-push promote <appName> <sourceDeploymentName> <destDeploymentName>
[--description <description>]
[--label <label>]
[--disabled <disabled>]
[--mandatory]
[--noDuplicateReleaseError]
@ -751,6 +752,10 @@ We recommend that all users take advantage of the automatically created `Staging
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.
### Label parameter
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.
### Disabled parameter
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.

Просмотреть файл

@ -146,6 +146,7 @@ export interface ILoginCommand extends ICommand {
export interface IPackageInfo {
description?: string;
label?: string;
disabled?: boolean;
mandatory?: boolean;
rollout?: number;

Просмотреть файл

@ -1077,6 +1077,7 @@ function promote(command: cli.IPromoteCommand): Promise<void> {
var packageInfo: PackageInfo = {
appVersion: command.appStoreVersion,
description: command.description,
label: command.label,
isDisabled: getYargsBooleanOrNull(command.disabled),
isMandatory: getYargsBooleanOrNull(command.mandatory),
rollout: command.rollout
@ -1084,7 +1085,7 @@ function promote(command: cli.IPromoteCommand): Promise<void> {
return sdk.promote(command.appName, command.sourceDeploymentName, command.destDeploymentName, packageInfo)
.then((): void => {
log("Successfully promoted the \"" + command.sourceDeploymentName + "\" deployment of the \"" + command.appName + "\" app to the \"" + command.destDeploymentName + "\" deployment.");
log("Successfully promoted " + (command.label !== null ? "\"" + command.label + "\" of " : "") + "the \"" + command.sourceDeploymentName + "\" deployment of the \"" + command.appName + "\" app to the \"" + command.destDeploymentName + "\" deployment.");
})
.catch((err: CodePushError) => releaseErrorHandler(err, command));
}

Просмотреть файл

@ -356,6 +356,7 @@ var argv = yargs.usage(USAGE_PREFIX + " <command>")
.example("promote MyApp Staging Production", "Promotes the latest release within the \"Staging\" deployment of \"MyApp\" to \"Production\"")
.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")
.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" })
.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" })
.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" })
.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" })
.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 {
deploymentPromoteCommand.sourceDeploymentName = arg2;
deploymentPromoteCommand.destDeploymentName = arg3;
deploymentPromoteCommand.description = argv["description"] ? backslash(argv["description"]) : "";
deploymentPromoteCommand.label = argv["label"];
deploymentPromoteCommand.disabled = argv["disabled"];
deploymentPromoteCommand.mandatory = argv["mandatory"];
deploymentPromoteCommand.noDuplicateReleaseError = argv["noDuplicateReleaseError"];