From 4763c840187292a9e17b81b7d26a4e44d68404f2 Mon Sep 17 00:00:00 2001 From: Steve Zelek Date: Mon, 26 Apr 2021 15:07:37 -0700 Subject: [PATCH] feat(appflow): add flag for skipping artifact download after builds succeed --- .../@ionic/cli/src/commands/deploy/build.ts | 18 +++++++++++++++--- .../@ionic/cli/src/commands/package/build.ts | 14 +++++++++++++- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/packages/@ionic/cli/src/commands/deploy/build.ts b/packages/@ionic/cli/src/commands/deploy/build.ts index d4a8b5a2d9..9f078fd55a 100644 --- a/packages/@ionic/cli/src/commands/deploy/build.ts +++ b/packages/@ionic/cli/src/commands/deploy/build.ts @@ -48,12 +48,12 @@ export class BuildCommand extends Command { groups: [MetadataGroup.PAID], summary: 'Create a deploy build on Appflow', description: ` -This command creates a deploy build on Ionic Appflow. While the build is running, it prints the remote build log to the terminal. If the build is successful, it downloads the created web build zip file in the current directory. +This command creates a deploy build on Ionic Appflow. While the build is running, it prints the remote build log to the terminal. If the build is successful, it downloads the created web build zip file in the current directory. Downloading build artifacts can be skipped by supplying the flag ${input('skip-download')}. + +Apart from ${input('--commit')}, every option can be specified using the full name setup within the Appflow Dashboard[^dashboard]. Customizing the build: - The ${input('--environment')} and ${input('--channel')} options can be used to customize the groups of values exposed to the build. - -Apart from ${input('--commit')}, every option can be specified using the full name setup within the Appflow Dashboard[^dashboard]. `, footnotes: [ { @@ -66,6 +66,7 @@ Apart from ${input('--commit')}, every option can be specified using the full na '--environment="My Custom Environment Name"', '--commit=2345cd3305a1cf94de34e93b73a932f25baac77c', '--channel="Master"', + '--channel="Master" --skip-download', '--channel="Master" --channel="My Custom Channel"', ], options: [ @@ -88,6 +89,13 @@ Apart from ${input('--commit')}, every option can be specified using the full na groups: [MetadataGroup.ADVANCED], spec: { value: 'sha1' }, }, + { + name: 'skip-download', + summary: `Skip downloading build artifacts after command succeeds.`, + type: Boolean, + spec: { value: 'name' }, + default: false, + }, ], }; } @@ -126,6 +134,10 @@ Apart from ${input('--commit')}, every option can be specified using the full na throw new Error(`Build ${build.state}`); } + if (options['skip-download']) { + return; + } + const url = await this.getDownloadUrl(appflowId, buildId, token); if (!url.url) { diff --git a/packages/@ionic/cli/src/commands/package/build.ts b/packages/@ionic/cli/src/commands/package/build.ts index 6b6be59f48..bb70515e9d 100644 --- a/packages/@ionic/cli/src/commands/package/build.ts +++ b/packages/@ionic/cli/src/commands/package/build.ts @@ -71,7 +71,7 @@ export class BuildCommand extends Command { groups: [MetadataGroup.PAID], summary: 'Create a package build on Appflow', description: ` -This command creates a package build on Ionic Appflow. While the build is running, it prints the remote build log to the terminal. If the build is successful, it downloads the created app package file in the current directory. +This command creates a package build on Ionic Appflow. While the build is running, it prints the remote build log to the terminal. If the build is successful, it downloads the created app package file in the current directory. Downloading build artifacts can be skipped by supplying the flag ${input('skip-download')}. Apart from ${input('--commit')}, every option can be specified using the full name setup within the Dashboard[^dashboard]. @@ -104,6 +104,7 @@ if you do not wish to download ${input('apk')}. 'android debug --native-config="My Custom Native Config Name"', 'android debug --commit=2345cd3305a1cf94de34e93b73a932f25baac77c', 'android debug --artifact-type=aab', + 'android debug --skip-download', 'android debug --aab-name="my-app-prod.aab" --apk-name="my-app-prod.apk"', 'ios development --signing-certificate="iOS Signing Certificate Name" --build-stack="iOS - Xcode 9"', 'ios development --signing-certificate="iOS Signing Certificate Name" --ipa-name=my_custom_file_name.ipa', @@ -201,6 +202,13 @@ if you do not wish to download ${input('apk')}. type: String, spec: { value: 'name' }, }, + { + name: 'skip-download', + summary: `Skip downloading build artifacts after command succeeds.`, + type: Boolean, + spec: { value: 'name' }, + default: false, + }, ], }; } @@ -332,6 +340,10 @@ if you do not wish to download ${input('apk')}. throw new Error(`Build ${build.state}`); } + if (options['skip-download']) { + return; + } + const availableArtifactTypes = build.artifacts.map((artifact) => artifact.artifact_type); if (Array.isArray(options['artifact-type'])) {