https://pact.io logo
#general
Title
# general
t

Thomas K

04/11/2022, 1:34 PM
Hi there, Im just reading up on https://docs.pact.io/pact_nirvana/step_5 and am a little confused, where it says
Copy code
Configure your consumer build to run the Pact tests and publish its pact to the Broker as part of its main build (consult the documentation for your chosen language). Consumer Pact tests typically run after the unit tests, and before deploying to a test environment.
If I have unit tests and pact tests etc running on every PR build, on different feature or task branches (e.g.
feature/PACT-101-do-something-cool
), should I publish it to pact broker as part of this PR build, using commit sha and branch (e.g. HEAD), or do I only do it on PR approval, at which point the feature branch merges into
develop
branch? (we follow git flow consumer side)
m

Matt (pactflow.io / pact-js / pact-go)

04/11/2022, 1:35 PM
every build
t

Thomas K

04/11/2022, 1:35 PM
ok thats what I currently do
I guess the tag name in this sense will always be
HEAD
then along with the git sha
m

Matt (pactflow.io / pact-js / pact-go)

04/11/2022, 1:39 PM
the tag would probably be
master
or
main
HEAD is a ref, not a tag
t

Thomas K

04/11/2022, 1:39 PM
eh ok im confused again sorry, I thought I read we use branch and git sha instead of the legacy tagging?
so I run the pact tests and publish task every PR build, which runs on different feature branches
once PR is approved its merged into
develop
branch
which then triggers a build again on
develop
branch
m

Matt (pactflow.io / pact-js / pact-go)

04/11/2022, 1:40 PM
ha yes well you said
tag
so I gave you the equivalent
Yes, you’re on the right track
the CI/CD workshop I think explains it better, but that’s just the way I digest content (howtolearn)
s

Slackbot

04/11/2022, 1:41 PM
Here are a number of useful hands-on labs that teach all of the key concepts: https://docs.pactflow.io/docs/workshops and https://docs.pact.io/implementation_guides/workshops
t

Thomas K

04/11/2022, 1:42 PM
thanks will have a look
👍 1
Hey sorry have a couple more questions around this
im just looking at this in regards to my consumer app's PR validation pipeline...
but the docs seem to suggest using branches and record deployment/release instead of tags, so ive gone with that newer approach
for my PR builds (before its merged into develop branch (staging)), do i need to apply a "tag" there, or do i need to "record a deployment" ? or do i do neither as its not really deployed to an environment until the PR is merged into develop/staging ?
bit confused here 😕
m

Matt (pactflow.io / pact-js / pact-go)

04/14/2022, 10:12 AM
Keep using branches and releases. I know this doc is being actively worked on with some great input from community as we transition from tags. Avoid tags if you're on the newer approach. You don't record a deployment before a PR is merged, unless of course you do deploy before merge.
t

Thomas K

04/14/2022, 10:13 AM
awesome im on the right track then 🙂
thanks for confirming
m

Matt (pactflow.io / pact-js / pact-go)

04/14/2022, 10:13 AM
👍