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

feat: support multiple branches per version #495

Merged
merged 51 commits into from
Sep 6, 2021

Conversation

bethesque
Copy link
Member

@bethesque bethesque commented Sep 1, 2021

tl;dr support an application version being associated with multiple branches.

This keeps track of the branch head versions, so we won't have same performance issues we do with "latest for tag" (though I'm going to use the same design to fix the performance issues with tags too at some stage).

Adding branch support to the Pact clients

@uglyog to associate a version with a branch, it's pretty much the same as tagging:

    curl -XPUT http://broker/pacticipants/{pacticipant}/branches/{branch}/versions/{version} \
          -H "Content-Type: application/json" -d "{}"

Like the tagging, the resource will auto create the pacticipant, branch and version if they don't exist. Also like the tagging, it should be called before the pact is published so that the right data is set up on the version when the webhook gets kicked off.

The all-in-one contract publishing endpoint is already set up to support the branch property, but if you'd rather just add to the mess that is the existing pact publishing code for now and do a separate call, the HAL relation to create the branch version is on the pacticipant resource at pb:branch-version or the index atpb:pacticipant-branch-version. Please detect the presence of that relation to determine whether or not branches are supported and show an appropriate "not supported, please upgrade" message to the user. The Ruby client says "This version of the Pact Broker does not support version branches. Please update to version 2.58.0 or later." (I'm just guessing for now that will the the version it gets released in, it'll be near enough.)

I haven't created the "all in one" verification publishing endpoint yet, so for now, you'll have to use the branch version endpoint to set the branch for provider versions anyway.

Copy link
Member

@uglyog uglyog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of changes. Must be good.

@bethesque
Copy link
Member Author

More changes must be more better right? (Not expecting anyone to care about the code, just getting you both across the features).

@bethesque bethesque merged commit acff2fc into master Sep 6, 2021
@bethesque bethesque deleted the feat/support-multiple-branches-per-version branch September 6, 2021 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants