Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: option to reject previous builds and submissions on ASC submission #289

Merged
merged 34 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5b2ae7e
Add expire_previous_builds and cancel_previous_submissions actions
VeArnold Dec 1, 2022
c0a5e03
Remove cancel-submissions action
VeArnold Dec 1, 2022
124fcf4
Fix tests
VeArnold Dec 1, 2022
73b3ba3
Fix expire previous builds function
VeArnold Dec 2, 2022
d3bf1e6
Fix expiring build with modify
VeArnold Dec 2, 2022
965abcb
Amend
VeArnold Dec 2, 2022
25b3b90
Add new actions to cancel and expire all
VeArnold Dec 2, 2022
d8415da
Use not_expired instead of expired as a filter
VeArnold Dec 2, 2022
cda4337
Update changelog and pump version
VeArnold Dec 5, 2022
2815215
Update expire action and address comments
VeArnold Dec 5, 2022
bdd9114
Amend
VeArnold Dec 5, 2022
054ea47
Amend
VeArnold Dec 5, 2022
1b0444c
Fix types
VeArnold Dec 5, 2022
828dd1c
Fix default values in tests
VeArnold Dec 5, 2022
773e045
Sync abstractmethod
VeArnold Dec 5, 2022
d3169e0
Amend
VeArnold Dec 5, 2022
2d4a9fa
Fix list_review_submissions abstractmethod type
VeArnold Dec 5, 2022
b511ea9
Merge master into branch and refactor
VeArnold Jan 30, 2023
8ddc6e1
Remove None declaration for app id in review submissions
VeArnold Jan 30, 2023
dfa569a
Update src/codemagic/apple/app_store_connect/versioning/review_submis…
VeArnold Jan 30, 2023
dee7df8
Refactor as expire_builds and generate docs
VeArnold Jan 31, 2023
72cdaa7
Fix excepted build argument
VeArnold Jan 31, 2023
d56fc94
Fix docs
VeArnold Jan 31, 2023
91ac3a8
Refactor and add new options
VeArnold Feb 1, 2023
1c3f99d
Update changelog
VeArnold Feb 2, 2023
fba4664
Move action groups
VeArnold Feb 2, 2023
cc482c6
Move action groups
VeArnold Feb 2, 2023
489f3d3
Revert "Move action groups"
VeArnold Feb 2, 2023
35c5f5e
Move app specific actions to apps group
VeArnold Feb 2, 2023
0b358e8
Remove unused expire-builds flag
VeArnold Feb 2, 2023
b28cd99
Refactor submitting to app store with canceling prev
VeArnold Feb 2, 2023
d77a0cb
Fix incorrect types and refactor slightly
VeArnold Feb 2, 2023
c5b0fbd
Update docs
VeArnold Feb 2, 2023
df6310b
Update src/codemagic/__version__.py
VeArnold Feb 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
Version 0.38.0
-------------

This is an enhancement release to further streamline the App Store review submission automation capabilities.

Additions and changes from [pull request #289](https://github.com/codemagic-ci-cd/cli-tools/pull/289). Resolves [issue #289](https://github.com/codemagic-ci-cd/cli-tools/issues/288).

**Features**

- Add new action `app-store-connect apps list-review-submissions` to list existing review submissions in the App Store for a specific application. See official API method [documentation](https://developer.apple.com/documentation/appstoreconnectapi/get_v1_reviewsubmissions).
- Add new action `app-store-connect apps cancel-review-submissions` to cancel existing review submissions in the App Store based on their type for a specific app. Uses the already existing `app-store-connect review-submissions cancel` action internally that allows to set the submission status to `canceled` using `PATCH`. See official API method [documentation](https://developer.apple.com/documentation/appstoreconnectapi/patch_v1_reviewsubmissions_id).
- Add new action `app-store-connect builds expire` to expire a specific build that has been uploaded to App Store Connect. Modifies the existing build resource to an expired status using `PATCH`. See official API method [documentation](https://developer.apple.com/documentation/appstoreconnectapi/modify_a_build).
- Add new action `app-store-connect apps expire-builds` to expire all builds uploaded to App Store Connect except the given build(s) for the specific application. Uses the aforementioned `app-store-connect builds expire` action internally.
- Add new action `app-store-connect apps expire-build-submitted-for-review` to expire build in App Store Connect that has been submitted to review and has not been `Approved` for a specific application. Uses the aforementioned `app-store-connect builds expire` action internally.
- Add new action `app-store-connect builds app` to get the application information based on the given build.
- Add flags `--cancel-previous-submissions` and `--expire-build-submitted-for-review` to the `app-store-connect publish` action.
- Add flag `--beta-review-state` to `app-store-connect apps builds` and `app-store-connect list-builds` actions for filtering builds based on their beta review state.
- Add flag `--cancel-previous-submissions` to the `app-store-connect builds submit-to-app-store` action.
- Add flag `--expire-build-submitted-for-review` to the `app-store-connect builds submit-to-testflight` action.

**Docs**
- Documentation updated for existing actions:
- new option `--beta-review-state` for the action `app-store-connect apps builds`
- new option `--cancel-previous-submissions` for the action `app-store-connect builds submit-to-app-store`
- new option `--expire-build-submitted-for-review` for the action `app-store-connect builds submit-to-testflight`
- new option `--beta-review-state` for the action `app-store-connect list-builds`
- new options `--expire-build-submitted-for-review` and `--cancel-previous-submissions` for the action `app-store-connect publish`
- description update for the `app-store-connect review-submissions cancel` action
- Documentation added for new actions:
- `app-store-connect builds app`
- `app-store-connect builds expire`
- `app-store-connect apps expire-builds`
- `app-store-connect apps expire-build-submitted-for-review`
- `app-store-connect apps cancel-review-submissions`
- `app-store-connect apps list-review-submissions`

priitlatt marked this conversation as resolved.
Show resolved Hide resolved
Version 0.37.1
-------------

Expand Down
4 changes: 4 additions & 0 deletions docs/app-store-connect/apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,12 @@ Enable verbose logging for commands

|Action|Description|
| :--- | :--- |
|[`cancel-review-submissions`](apps/cancel-review-submissions.md)|Find and cancel review submissions in App Store Connect for the given application|
|[`expire-builds`](apps/expire-builds.md)|Expire all application builds except the given build(s)|
|[`expire-build-submitted-for-review`](apps/expire-build-submitted-for-review.md)|Expire application build that is currently waiting for review, or is currently in review in TestFlight|
|[`get`](apps/get.md)|Get information about a specific app|
|[`builds`](apps/builds.md)|Get a list of builds associated with a specific app matching given constrains|
|[`pre-release-versions`](apps/pre-release-versions.md)|Get a list of prerelease versions associated with a specific app|
|[`app-store-versions`](apps/app-store-versions.md)|Get a list of App Store versions associated with a specific app|
|[`list`](apps/list.md)|Find and list apps added in App Store Connect|
|[`list-review-submissions`](apps/list-review-submissions.md)|Find and list review submissions in App Store Connect for the given application|
5 changes: 5 additions & 0 deletions docs/app-store-connect/apps/builds.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ app-store-connect apps builds [-h] [--log-stream STREAM] [--no-color] [--version
[--private-key PRIVATE_KEY]
[--certificates-dir CERTIFICATES_DIRECTORY]
[--profiles-dir PROFILES_DIRECTORY]
[--beta-review-state BETA_REVIEW_STATE]
[--build-id BUILD_ID_RESOURCE_ID_OPTIONAL]
[--build-version-number BUILD_VERSION_NUMBER]
[--expired]
Expand All @@ -33,6 +34,10 @@ app-store-connect apps builds [-h] [--log-stream STREAM] [--no-color] [--version
Application Apple ID. An automatically generated ID assigned to your app
### Optional arguments for action `builds`

##### `--beta-review-state=APPROVED | IN_REVIEW | REJECTED | WAITING_FOR_REVIEW`


Build beta review state. Multiple arguments
##### `--build-id=BUILD_ID_RESOURCE_ID_OPTIONAL`


Expand Down
107 changes: 107 additions & 0 deletions docs/app-store-connect/apps/cancel-review-submissions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@

cancel-review-submissions
=========================


**Find and cancel review submissions in App Store Connect for the given application**
### Usage
```bash
app-store-connect apps cancel-review-submissions [-h] [--log-stream STREAM] [--no-color] [--version] [-s] [-v]
[--log-api-calls]
[--api-unauthorized-retries UNAUTHORIZED_REQUEST_RETRIES]
[--api-server-error-retries SERVER_ERROR_RETRIES]
[--disable-jwt-cache]
[--json]
[--issuer-id ISSUER_ID]
[--key-id KEY_IDENTIFIER]
[--private-key PRIVATE_KEY]
[--certificates-dir CERTIFICATES_DIRECTORY]
[--profiles-dir PROFILES_DIRECTORY]
[--platform PLATFORM_OPTIONAL]
[--review-submission-state REVIEW_SUBMISSION_STATE]
APPLICATION_ID_RESOURCE_ID
```
### Required arguments for action `cancel-review-submissions`

##### `APPLICATION_ID_RESOURCE_ID`


Application Apple ID. An automatically generated ID assigned to your app
### Optional arguments for action `cancel-review-submissions`

##### `--platform, --app-store-version-platform=IOS | MAC_OS | TV_OS`


App Store Version platform
##### `--review-submission-state=CANCELING | COMPLETE | COMPLETING | IN_REVIEW | READY_FOR_REVIEW | UNRESOLVED_ISSUES | WAITING_FOR_REVIEW`


String value of the review submission state. Multiple arguments
### Optional arguments for command `app-store-connect`

##### `--log-api-calls`


Turn on logging for App Store Connect API HTTP requests
##### `--api-unauthorized-retries, -r=UNAUTHORIZED_REQUEST_RETRIES`


Specify how many times the App Store Connect API request should be retried in case the called request fails due to an authentication error (401 Unauthorized response from the server). In case of the above authentication error, the request is retried usinga new JSON Web Token as many times until the number of retries is exhausted. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_API_UNAUTHORIZED_RETRIES`. [Default: 3]
##### `--api-server-error-retries=SERVER_ERROR_RETRIES`


Specify how many times the App Store Connect API request should be retried in case the called request fails due to a server error (response with status code 5xx). In case of server error, the request is retried until the number of retries is exhausted. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_API_SERVER_ERROR_RETRIES`. [Default: 3]
##### `--disable-jwt-cache`


Turn off caching App Store Connect JSON Web Tokens to disk. By default generated tokens are cached to disk to be reused between separate processes, which can can reduce number of false positive authentication errors from App Store Connect API. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_DISABLE_JWT_CACHE`.
##### `--json`


Whether to show the resource in JSON format
##### `--issuer-id=ISSUER_ID`


App Store Connect API Key Issuer ID. Identifies the issuer who created the authentication token. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_ISSUER_ID`. Alternatively to entering `ISSUER_ID` in plaintext, it may also be specified using the `@env:` prefix followed by an environment variable name, or the `@file:` prefix followed by a path to the file containing the value. Example: `@env:<variable>` uses the value in the environment variable named `<variable>`, and `@file:<file_path>` uses the value from the file at `<file_path>`.
##### `--key-id=KEY_IDENTIFIER`


App Store Connect API Key ID. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_KEY_IDENTIFIER`. Alternatively to entering `KEY_IDENTIFIER` in plaintext, it may also be specified using the `@env:` prefix followed by an environment variable name, or the `@file:` prefix followed by a path to the file containing the value. Example: `@env:<variable>` uses the value in the environment variable named `<variable>`, and `@file:<file_path>` uses the value from the file at `<file_path>`.
##### `--private-key=PRIVATE_KEY`


App Store Connect API private key used for JWT authentication to communicate with Apple services. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If not provided, the key will be searched from the following directories in sequence for a private key file with the name `AuthKey_<key_identifier>.p8`: private_keys, ~/private_keys, ~/.private_keys, ~/.appstoreconnect/private_keys, where <key_identifier> is the value of `--key-id`. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_PRIVATE_KEY`. Alternatively to entering `PRIVATE_KEY` in plaintext, it may also be specified using the `@env:` prefix followed by an environment variable name, or the `@file:` prefix followed by a path to the file containing the value. Example: `@env:<variable>` uses the value in the environment variable named `<variable>`, and `@file:<file_path>` uses the value from the file at `<file_path>`.
##### `--certificates-dir=CERTIFICATES_DIRECTORY`


Directory where the code signing certificates will be saved. Default:&nbsp;`$HOME/Library/MobileDevice/Certificates`
##### `--profiles-dir=PROFILES_DIRECTORY`


Directory where the provisioning profiles will be saved. Default:&nbsp;`$HOME/Library/MobileDevice/Provisioning Profiles`
### Common options

##### `-h, --help`


show this help message and exit
##### `--log-stream=stderr | stdout`


Log output stream. Default `stderr`
##### `--no-color`


Do not use ANSI colors to format terminal output
##### `--version`


Show tool version and exit
##### `-s, --silent`


Disable log output for commands
##### `-v, --verbose`


Enable verbose logging for commands
95 changes: 95 additions & 0 deletions docs/app-store-connect/apps/expire-build-submitted-for-review.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@

expire-build-submitted-for-review
=================================


**Expire application build that is currently waiting for review, or is currently in review in TestFlight**
### Usage
```bash
app-store-connect apps expire-build-submitted-for-review [-h] [--log-stream STREAM] [--no-color] [--version] [-s] [-v]
[--log-api-calls]
[--api-unauthorized-retries UNAUTHORIZED_REQUEST_RETRIES]
[--api-server-error-retries SERVER_ERROR_RETRIES]
[--disable-jwt-cache]
[--json]
[--issuer-id ISSUER_ID]
[--key-id KEY_IDENTIFIER]
[--private-key PRIVATE_KEY]
[--certificates-dir CERTIFICATES_DIRECTORY]
[--profiles-dir PROFILES_DIRECTORY]
APPLICATION_ID_RESOURCE_ID
```
### Required arguments for action `expire-build-submitted-for-review`

##### `APPLICATION_ID_RESOURCE_ID`


Application Apple ID. An automatically generated ID assigned to your app
### Optional arguments for command `app-store-connect`

##### `--log-api-calls`


Turn on logging for App Store Connect API HTTP requests
##### `--api-unauthorized-retries, -r=UNAUTHORIZED_REQUEST_RETRIES`


Specify how many times the App Store Connect API request should be retried in case the called request fails due to an authentication error (401 Unauthorized response from the server). In case of the above authentication error, the request is retried usinga new JSON Web Token as many times until the number of retries is exhausted. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_API_UNAUTHORIZED_RETRIES`. [Default: 3]
##### `--api-server-error-retries=SERVER_ERROR_RETRIES`


Specify how many times the App Store Connect API request should be retried in case the called request fails due to a server error (response with status code 5xx). In case of server error, the request is retried until the number of retries is exhausted. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_API_SERVER_ERROR_RETRIES`. [Default: 3]
##### `--disable-jwt-cache`


Turn off caching App Store Connect JSON Web Tokens to disk. By default generated tokens are cached to disk to be reused between separate processes, which can can reduce number of false positive authentication errors from App Store Connect API. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_DISABLE_JWT_CACHE`.
##### `--json`


Whether to show the resource in JSON format
##### `--issuer-id=ISSUER_ID`


App Store Connect API Key Issuer ID. Identifies the issuer who created the authentication token. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_ISSUER_ID`. Alternatively to entering `ISSUER_ID` in plaintext, it may also be specified using the `@env:` prefix followed by an environment variable name, or the `@file:` prefix followed by a path to the file containing the value. Example: `@env:<variable>` uses the value in the environment variable named `<variable>`, and `@file:<file_path>` uses the value from the file at `<file_path>`.
##### `--key-id=KEY_IDENTIFIER`


App Store Connect API Key ID. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_KEY_IDENTIFIER`. Alternatively to entering `KEY_IDENTIFIER` in plaintext, it may also be specified using the `@env:` prefix followed by an environment variable name, or the `@file:` prefix followed by a path to the file containing the value. Example: `@env:<variable>` uses the value in the environment variable named `<variable>`, and `@file:<file_path>` uses the value from the file at `<file_path>`.
##### `--private-key=PRIVATE_KEY`


App Store Connect API private key used for JWT authentication to communicate with Apple services. Learn more at https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api. If not provided, the key will be searched from the following directories in sequence for a private key file with the name `AuthKey_<key_identifier>.p8`: private_keys, ~/private_keys, ~/.private_keys, ~/.appstoreconnect/private_keys, where <key_identifier> is the value of `--key-id`. If not given, the value will be checked from the environment variable `APP_STORE_CONNECT_PRIVATE_KEY`. Alternatively to entering `PRIVATE_KEY` in plaintext, it may also be specified using the `@env:` prefix followed by an environment variable name, or the `@file:` prefix followed by a path to the file containing the value. Example: `@env:<variable>` uses the value in the environment variable named `<variable>`, and `@file:<file_path>` uses the value from the file at `<file_path>`.
##### `--certificates-dir=CERTIFICATES_DIRECTORY`


Directory where the code signing certificates will be saved. Default:&nbsp;`$HOME/Library/MobileDevice/Certificates`
##### `--profiles-dir=PROFILES_DIRECTORY`


Directory where the provisioning profiles will be saved. Default:&nbsp;`$HOME/Library/MobileDevice/Provisioning Profiles`
### Common options

##### `-h, --help`


show this help message and exit
##### `--log-stream=stderr | stdout`


Log output stream. Default `stderr`
##### `--no-color`


Do not use ANSI colors to format terminal output
##### `--version`


Show tool version and exit
##### `-s, --silent`


Disable log output for commands
##### `-v, --verbose`


Enable verbose logging for commands
Loading