Hi there! I'm just starting out on Pact. My repo ...
# pact-net
m
Hi there! I'm just starting out on Pact. My repo is github and pipeline in azure devops. In the "Gold: integrate with PR pipeline" section, one of the step says "Modify the consumer commit pipeline to tag with master branch". Can someone clarify on how to implement this? I'm assuming when it says commit pipeline, CI pipeline (triggerd on merging pull request) is being referred. This is how I'm trying to integrate with pipeline - In PR validation pipeline (triggered on creation of pull request), I published the pact with branch as "feature branch name" and consumer app version as the "git commit hash". In the CI pipeline (triggered on merge), I tried using pact-broker create-version-tag and tag with master in the CI pipeline, but --version is mandatory there and in CI pipeline I'm not able to get the right git commit hash. Also, the documentation says not to use tags anymore if branches are supported. All help and guidance are greatly appreciated.
t
in CI pipeline I’m not able to get the right git commit hash.
Why not?
I think “tag with master branch” is a misnomer. I think it means publish the Pact with the branch name.
This used to be a separate step. Which document are you reading? It should probably be updated.
m
Thanks for the response. I am referring to https://docs.pact.io/pact_nirvana/step_5 From what I understood from your response, in the PR validation pipeline, I'll publish the pact with feature-branch-name. From CI pipeline (on merge) will publish another pact with branch as 'master' Please correct if I misunderstood.
W.r.t "not able to get git commit hash" In the PR validation pipeline I can use system.pullRequest.sourceCommitId, which is same as the git commit hash. But, in the CI pipeline I could not find how to get it. There's a predefined variable "Build.SourceVersion". When using this variable, it is totally different from the git commit hash. This way the consumer app version in the feature branch pact comes out to be different from the consumer version in master branch. Would creating consumer app version by using guid generator be better in this case?
g
@Timothy Jones I found this thread by looking for "Modify the consumer commit pipeline to tag with master branch" which is step B in https://docs.pact.io/pact_nirvana/step_5#tasks Looks like that from step B I'm supposed to publish the pacts again but using the main branch. If tha'ts the case, what is the Step C about? It feels like the same as step B but then again, I'm not sure https://docs.pact.io/pact_nirvana/step_5#c-add-a-step-at-the-beginning-of-the-pipeline-to-app[…]the-name-of-your-main-branch-eg-master-trunk-or-main
t
I don’t know. They look the same to me.
1
g
tks. I opened a suport ticket regarding it and will move on as if they are the same for now
@Timothy Jones FYI I received feedback from customer support
Copy code
Greetings,

Thank you for the feedback on the <http://Pact.io|Pact.io> documentation. The PactFlow team reviewed it and corrected it (C was removed as it seemed that there was no difference between B and C).
Before vs Now