You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/pact_broker/client/cli/broker.rb
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ class Broker < CustomThor
18
18
method_option:version,required: false,aliases: "-e",desc: "The pacticipant version. Must be entered after the --pacticipant that it relates to."
19
19
method_option:latest,required: false,aliases: "-l",banner: '[TAG]',desc: "Use the latest pacticipant version. Optionally specify a TAG to use the latest version with the specified tag."
20
20
method_option:to,required: false,banner: 'TAG',desc: "This is too hard to explain in a short sentence. Look at the examples.",default: nil
21
+
method_option:to_environment,required: false,banner: 'ENVIRONMENT',desc: "The environment into which the pacticipant(s) are to be deployed",default: nil,hide: true
21
22
method_option:broker_base_url,required: true,aliases: "-b",desc: "The base URL of the Pact Broker"
Copy file name to clipboardExpand all lines: lib/pact_broker/client/cli/can_i_deploy_long_desc.txt
+18-9Lines changed: 18 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -19,17 +19,27 @@ Using a specific version is the easiest way to ensure you get an accurate respon
19
19
20
20
#### Recommended usage - allowing the Pact Broker to automatically determine the dependencies
21
21
22
-
Prerequisite: if you would like the Pact Broker to calculate the dependencies for you when you want to deploy an application into a given environment, you will need to let the Broker know which version of each application is in that environment. To do this, the relevant application version resource in the Broker will need to be "tagged" with the name of the environment during the deployment process:
22
+
Prerequisite: if you would like the Pact Broker to calculate the dependencies for you when you want to deploy an application into a given environment, you will need to let the Broker know which version of each application is in that environment.
23
+
24
+
How you do this depends on the version of the Pact Broker you are running.
25
+
26
+
If you are using a Broker version where deployment versions are supported, then you would notify the Broker of the deployment of this application version like so:
27
+
28
+
$ pact-broker record-deployment --pacticipant Foo --version 173153ae0 --environment test
29
+
30
+
This assumes that you have already set up an environment named "test" in the Broker.
31
+
32
+
If you are using a Broker version that does not support deployment environments, then you will need to use tags to notify the broker of the deployment of this application version, like so:
23
33
24
34
$ pact-broker create-version-tag --pacticipant Foo --version 173153ae0 --tag test
25
35
26
-
This allows you to use the following simple command to find out if you are safe to deploy:
36
+
Once you have configured your build to notify the Pact Broker of the successful deployment using either method describe above, you can use the following simple command to find out if you are safe to deploy (use either `--to` or `--to-environment` as supported):
27
37
28
-
$ pact-broker can-i-deploy --pacticipant PACTICIPANT --version VERSION \
29
-
--to ENVIRONMENT \
38
+
$ pact-broker can-i-deploy --pacticipant PACTICIPANT --version VERSION
If the `--to` tag is omitted, then the query will return the compatiblity with the overall latest version of each of the other applications.
42
+
If the `--to` or `--to-environment` options are omitted, then the query will return the compatiblity with the overall latest version of each of the other applications.
33
43
34
44
Examples:
35
45
@@ -38,7 +48,7 @@ Can I deploy version 173153ae0 of application Foo to the test environment?
If you are unable to use tags, or there is some other limitation that stops you from using the recommended approach, you can specify one or more of the dependencies explictly. You must also do this if you want to use the `--all TAG` option for any of the pacticipants.
63
72
64
73
You can specify as many application versions as you like, and you can even specify multiple versions of the same application (repeat the `--pacticipant` name and supply a different version.)
65
74
66
-
You can use explictly declared dependencies with or without the `--to ENVIRONMENT`. For example, if you declare two (or more) application versions with no `--to ENVIRONMENT`, then only the applications you specify will be taken into account when determining if it is safe to deploy. If you declare two (or more) application versions _as well as_ a `--to ENVIRONMENT`, then the Pact Broker will work out what integrations your declared applications will have in that environment when determining if it safe to deploy. When using this script for a production release, and you are using tags, it is always the most future-proof option to use the `--to` if possible, as it will catch any newly added consumers or providers.
75
+
You can use explictly declared dependencies with or without the `--to ENVIRONMENT_TAG`. For example, if you declare two (or more) application versions with no `--to ENVIRONMENT_TAG`, then only the applications you specify will be taken into account when determining if it is safe to deploy. If you declare two (or more) application versions _as well as_ a `--to ENVIRONMENT`, then the Pact Broker will work out what integrations your declared applications will have in that environment when determining if it safe to deploy. When using this script for a production release, and you are using tags, it is always the most future-proof option to use the `--to` if possible, as it will catch any newly added consumers or providers.
67
76
68
77
If you are finding that your dependencies are not being automatically included when you supply multiple pacticipant versions, please upgrade to the latest version of the Pact Broker, as this is a more recently added feature.
0 commit comments