Johannes
05/23/2022, 12:36 PM--include-wip-pacts-since
with a date well into the past but nothing. Am I totally misunderstanding how this is supposed to work?Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
consumerVersionSelectors
on the provider side
https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors#verifying-the-latest-development-test-and-master-pactsYousaf Nabi (pactflow.io)
Johannes
05/23/2022, 12:58 PMdev-3808
Command being used to publish contract: docker run --rm pactfoundation/pact-cli:latest publish ./pact --consumer-app-version 11.16.116-80952e64 --branch dev-3808 --broker-base-url <broker base URL here>
(the above runs fine, shows up in the UI with the correct values)
Provider language: Go, although I'm using pact-provider-verifier
, version 1.36.1, at the moment
Verification command: pact-provider-verifier --broker-base-url=<broker base url here> --provider-base-url=<http://localhost:8000> --provider=<provider name here> --enable-pending --include-wip-pacts-since=2022-05-01 --provider-app-version=1.1.6 --provider-version-branch=master --consumer-version-selector='{"tag":"master","latest":true}'
Pact file specification version: 2
(the above only verifies master
for its consumer while I would've hoped it'd verify the dev-3808
branch mentioned earlier)Yousaf Nabi (pactflow.io)
consumerVersionSelector
for co-ordinated development
--consumer-version-selector='{ "branch": "<branch>", "fallbackBranch": "master" }'
I don’t think you can use tag
or latest
, as you aren’t tagging in your consumer, you are using branches
which is excellent 👼
`tag`: the tag name(s) of the consumer versions to get the pacts for. This field is still supported but it is recommended to use thein preference now.branch
`latest`: true. Used in conjuction with theI may be totally wrong tho, so happy to be corrected 🙂property. If atag
is specified, andtag
islatest
, then the latest pact for each of the consumers with that tag will be returned. If atrue
is specified and the latest flag is not set totag
, all the pacts with the specified tag will be returned. (This might seem a bit weird, but it’s done this way to match the syntax used for the matrix query params. See https://docs.pact.io/selectors).true
Johannes
05/23/2022, 1:11 PMI thought the point of WIP pacts was to not have to manually specify what consumer feature branches to verify. Am I incorrect in thinking that?--consumer-version-selector='{ "branch": "<branch>", "fallbackBranch": "master" }'
Johannes
05/23/2022, 1:13 PMYousaf Nabi (pactflow.io)
Johannes
05/23/2022, 1:25 PMjust for clarity, have you got a verified pact between your consumer and provider on the master branches, and these are deployed to an environment?Yes
you now are introducing a change on a consumer branch, which you are trying to verify against the providers master build.Correct
Which version of the broker are you using? Pactflow or OSS 2.60.0+Pactflow
Johannes
05/23/2022, 1:30 PMYousaf Nabi (pactflow.io)
--branch
◦ @"${PACT_CLI}" publish ${PWD}/pacts --consumer-app-version ${GIT_COMMIT} --branch ${GIT_BRANCH}
leads to not finding anything on the provider side, when specifying tag
not branch
.
• https://github.com/pactflow/example-provider/blob/master/src/product/product.pact.test.js#L34
◦ consumerVersionSelectors: [{ tag: 'master', latest: true }, { deployed: true } ]
If both the consumer and provider use tag
everything matches up, or if they both use branch
they match up.
If I then publish a failing consumer pact on a branch, it won’t be validated until I enable the WIP Pacts feature
enablePending: true,
includeWipPactsSince: "2022-05-01",
hereJohannes
05/23/2022, 2:19 PMincludeWipPactsSince
, that feature branch contract gets verified for you? How odd, I can't see anything you've suggested that is different to what I've done, and yet, it does not work for me 😞Yousaf Nabi (pactflow.io)
--branch
but verifying with tag
Yousaf Nabi (pactflow.io)
docker run --rm pactfoundation/pact-cli:latest publish ./pact --consumer-app-version 11.16.116-80952e64 --branch dev-3808 --broker-base-url <broker base URL here>
Verification command: pact-provider-verifier --broker-base-url=<broker base url here> --provider-base-url=<http://localhost:8000> --provider=<provider name here> --enable-pending --include-wip-pacts-since=2022-05-01 --provider-app-version=1.1.6 --provider-version-branch=master --consumer-version-selector='{"tag":"master","latest":true}'
After
using only branch
publish contract: docker run --rm pactfoundation/pact-cli:latest publish ./pact --consumer-app-version 11.16.116-80952e64 --branch dev-3808 --broker-base-url <broker base URL here>
Verification command: pact-provider-verifier --broker-base-url=<broker base url here> --provider-base-url=<http://localhost:8000> --provider=<provider name here> --enable-pending --include-wip-pacts-since=2022-05-01 --provider-app-version=1.1.6 --provider-version-branch=master --consumer-version-selector='{"branch":"master","latest":true}'
using only tag
publish contract: docker run --rm pactfoundation/pact-cli:latest publish ./pact --consumer-app-version 11.16.116-80952e64 --tag dev-3808 --broker-base-url <broker base URL here>
Verification command: pact-provider-verifier --broker-base-url=<broker base url here> --provider-base-url=<http://localhost:8000> --provider=<provider name here> --enable-pending --include-wip-pacts-since=2022-05-01 --provider-app-version=1.1.6 --provider-version-branch=master --consumer-version-selector='{"tag":"master","latest":true}'
Johannes
05/23/2022, 2:25 PMbranch
in both places just now, too, there is no difference for me.
DEBUG: The pact at <pact url here> is being verified because the pact content belongs to the consumer version matching the following criterion:
* latest version from branch 'master' (<latest version in master here>)Is the only output regarding branches I get for that consumer.
Johannes
05/23/2022, 2:27 PMYousaf Nabi (pactflow.io)
make fake_ci
to easily run it from your machine and cross compare.
{
"_embedded": {
"pacts": [
{
"shortDescription": "latest from branch master",
"verificationProperties": {
"pending": false,
"notices": [
{
"when": "before_verification",
"text": "The pact at <https://saf.pactflow.io/pacts/provider/pactflow-example-provider/consumer/pactflow-example-consumer/pact-version/4a6c2017e4f913c5b18ee0b526eae842567bf489> is being verified because the pact content belongs to the consumer version matching the following criterion:\n * latest version from branch 'master' (ac94418+1653314421)"
},
{
"when": "before_verification",
"text": "This pact has previously been successfully verified by a version of pactflow-example-provider with tag 'master'. If this verification fails, it will fail the build. Read more at <https://docs.pact.io/go/pending>"
}
]
},
"_links": {
"self": {
"href": "<https://saf.pactflow.io/pacts/provider/pactflow-example-provider/consumer/pactflow-example-consumer/pact-version/4a6c2017e4f913c5b18ee0b526eae842567bf489/metadata/c1tdW2JdPW1hc3RlciZzW11bbF09dHJ1ZSZzW11bY3ZdPTM5JnA9ZmFsc2U>",
"name": "Pact between pactflow-example-consumer (ac94418+1653314421) and pactflow-example-provider"
}
}
},
{
"shortDescription": "latest from branch wip_pact",
"verificationProperties": {
"pending": true,
"wip": true,
"notices": [
{
"when": "before_verification",
"text": "The pact at <https://saf.pactflow.io/pacts/provider/pactflow-example-provider/consumer/pactflow-example-consumer/pact-version/b4d89ebc01885acfd726f527182ca47f8abc712c/metadata/d2lwPXRydWU> is being verified because it is a 'work in progress' pact (ie. it is the pact for the latest version of pactflow-example-consumer from branch 'wip_pact' and is still in pending state). Read more at <https://docs.pact.io/go/wip>"
},
{
"when": "before_verification",
"text": "This pact is in pending state for this version of pactflow-example-provider because a successful verification result for a version of pactflow-example-provider with tag 'master' has not yet been published. If this verification fails, it will not cause the overall build to fail. Read more at <https://docs.pact.io/go/pending>"
},
{
"when": "after_verification:success_true_published_false",
"text": "This pact is still in pending state for any version of pactflow-example-provider with tag 'master' as the successful verification results with this tag have not yet been published."
},
{
"when": "after_verification:success_false_published_false",
"text": "This pact is still in pending state for any version of pactflow-example-provider with tag 'master' as a successful verification result with this tag has not yet been published"
},
{
"when": "after_verification:success_true_published_true",
"text": "This pact is no longer in pending state for any version of pactflow-example-provider with tag 'master', as a successful verification result with this tag has been published. If a verification for a version of pactflow-example-provider with this tag fails in the future, it will fail the build. Read more at <https://docs.pact.io/go/pending>"
},
{
"when": "after_verification:success_false_published_true",
"text": "This pact is still in pending state for any version of pactflow-example-provider with tag 'master' as a successful verification result with this tag has not yet been published"
}
]
},
"_links": {
"self": {
"href": "<https://saf.pactflow.io/pacts/provider/pactflow-example-provider/consumer/pactflow-example-consumer/pact-version/b4d89ebc01885acfd726f527182ca47f8abc712c/metadata/dz10cnVl>",
"name": "Pact between pactflow-example-consumer (520ecb6+1653314859) and pactflow-example-provider"
}
}
}
]
},
"_links": {
"self": {
"href": "<https://saf.pactflow.io/pacts/provider/pactflow-example-provider/for-verification>",
"title": "Pacts to be verified"
}
}
}
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Yousaf Nabi (pactflow.io)
Johannes
05/27/2022, 11:01 AM