pact-jvm icon indicating copy to clipboard operation
pact-jvm copied to clipboard

Option to verify only the first tag in list

Open PLT875 opened this issue 5 years ago • 7 comments

Have a process of verifying tags in PR before merge to master branch

Say we provide a list of tags for contracts we need to verify e.g. [feature, master]

Say if feature tag is a new contract, then we would want to skip master (as it would fail)

Is there option to check first tag in list only?

PLT875 avatar Oct 01 '19 10:10 PLT875

How would you know when to only verify the first tag, and when to verify all of them? Maybe a better option is to only pass the tags you want to verify from the command line?

There is a current feature being implemented to support feature branches in the pact broker. See https://github.com/pact-foundation/pact_broker/issues/307

uglyog avatar Oct 12 '19 04:10 uglyog

So if contract found for first tag then stop there.

Have a process where contracts should be verified as part of PRs.

So if a feature branch has a new contract (will publish and tag as the feature branch name)

Our CI will then trigger the provider tests - by checking out the corresponding branch of the provider repo (then run verification tests) - if not found fall back to master branch.

In first instance if feature tag not found its an indication of no contract changes. However if feature branch found then we do not wish to verify the master tag in list

PLT875 avatar Oct 16 '19 12:10 PLT875

This is semi supported in the Ruby impl. We have a concept of a "fallback" tag, for doing a "pact feature branch workflow".

See https://dius.com.au/2018/05/04/pact-testing-git-workflow-and-continuous-integration/

I'm thinking of adding this into the new API. As I understand it, you want to say "if a pact with X tag exists, verify that, otherwise, fall back to the master pact". The "feat-x" tag name would be dynamically determined based on the provider's current branch. Yes?

bethesque avatar Dec 19 '19 02:12 bethesque

This is semi supported in the Ruby impl. We have a concept of a "fallback" tag, for doing a "pact feature branch workflow".

See https://dius.com.au/2018/05/04/pact-testing-git-workflow-and-continuous-integration/

I'm thinking of adding this into the new API. As I understand it, you want to say "if a pact with X tag exists, verify that, otherwise, fall back to the master pact". The "feat-x" tag name would be dynamically determined based on the provider's current branch. Yes?

Yes thats right

PLT875 avatar Dec 27 '19 15:12 PLT875

You can vote for this feature here: https://pact.canny.io/feature-requests/p/support-a-fallback-tag-for-coordinated-branch-based-development (just started using this fancy new feature prioritisation tool!)

bethesque avatar Jan 16 '20 22:01 bethesque

The "fallback" tag feature was implemented in the broker now. We can implement support for it in pact-jvm now. Please also update the Consumer Version Selectors docs.

tinexw avatar Oct 18 '20 09:10 tinexw

@tinexw version 4.1.10 has the fallback tag implemented

uglyog avatar Nov 06 '20 01:11 uglyog