Harry
01/10/2023, 7:28 AMMatt (pactflow.io / pact-js / pact-go)
pact-broker help can-i-deploy
Usage:
pact-broker can-i-deploy -a, --pacticipant=PACTICIPANT -b, --broker-base-url=BROKER_BASE_URL
Options:
-a, --pacticipant=PACTICIPANT # The pacticipant name. Use once for each pacticipant being checked.
-e, [--version=VERSION] # The pacticipant version. Must be entered after the --pacticipant that it relates to.
[--ignore=IGNORE] # The pacticipant name to ignore. Use once for each pacticipant being ignored. A specific version can be ignored by also specifying a --version after the pacticipant name option.
-l, [--latest=[TAG]] # Use the latest pacticipant version. Optionally specify a TAG to use the latest version with the specified tag.
[--to-environment=ENVIRONMENT] # The environment into which the pacticipant(s) are to be deployed
[--branch=BRANCH] # The branch of the version for which you want to check the verification results
[--to=TAG] # The tag that represents the branch or environment of the integrated applications for which you want to check the verification result status.
-o, [--output=OUTPUT] # json or table
# Default: table
[--retry-while-unknown=TIMES] # The number of times to retry while there is an unknown verification result (ie. the provider verification is likely still running)
# Default: 0
[--retry-interval=SECONDS] # The time between retries in seconds. Use in conjuction with --retry-while-unknown
# Default: 10
[--dry-run], [--no-dry-run] # When dry-run is enabled, always exit process with a success code. Can also be enabled by setting the environment variable PACT_BROKER_CAN_I_DEPLOY_DRY_RUN=true. This mode is useful when setting up your CI/CD pipeline for the first time, or in a 'break glass' situation where you need to knowingly deploy what Pact considers a breaking change. For the second scenario, it is recommended to use the environment variable and just set it for the build required to deploy that particular version, so you don't accidentally leave the dry run mode enabled.
-b, --broker-base-url=BROKER_BASE_URL # The base URL of the Pact Broker
-u, [--broker-username=BROKER_USERNAME] # Pact Broker basic auth username
-p, [--broker-password=BROKER_PASSWORD] # Pact Broker basic auth password
-k, [--broker-token=BROKER_TOKEN] # Pact Broker bearer token
-v, [--verbose], [--no-verbose] # Verbose output. Default: false
Description:
Returns exit code 0 or 1, indicating whether or not the specified application (pacticipant) has a successful verification result with each of the application versions that are already deployed to a
particular environment. Prints out the relevant pact/verification details, indicating any missing or failed verification results.
The can-i-deploy tool was originally written to support specifying versions and dependencies using tags. This usage has now been superseded by first class support for environments, deployments and releases.
For documentation on how to use can-i-deploy with tags, please see <https://docs.pact.io/pact_broker/client_cli/can_i_deploy_usage_with_tags/>
Before `can-i-deploy` can be used, the relevant environment resources must first be created in the Pact Broker using the `create-environment` command. The "test" and "production" environments will have been
seeded for you. You can check the existing environments by running `pact-broker list-environments`. See <https://docs.pact.io/pact_broker/client_cli/readme#environments> for more information.
$ pact-broker create-environment --name "uat" --display-name "UAT" --no-production
After an application is deployed or released, its deployment must be recorded using the `record-deployment` or `record-release` commands. See
<https://docs.pact.io/pact_broker/recording_deployments_and_releases/> for more information.
$ pact-broker record-deployment --pacticipant Foo --version 173153ae0 --environment uat
Before an application is deployed or released to an environment, the can-i-deploy command must be run to check that the application version is safe to deploy with the versions of each integrated application
that are already in that environment.
$ pact-broker can-i-deploy --pacticipant PACTICIPANT --version VERSION --to-environment ENVIRONMENT
Example: can I deploy version 173153ae0 of application Foo to the test environment?
$ pact-broker can-i-deploy --pacticipant Foo --version 173153ae0 --to-environment test
Can-i-deploy can also be used to check if arbitrary versions have a successful verification. When asking "Can I deploy this application version with the latest version from the main branch of another
application" it functions as a "can I merge" check.
$ pact-broker can-i-deploy --pacticipant Foo 173153ae0 \ --pacticipant Bar --latest mainHarry
01/10/2023, 7:32 AMHarry
01/10/2023, 11:16 AMBeth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Harry
01/19/2023, 11:16 AM