Alan Boshier
06/28/2024, 10:32 AM@pact-foundation/pact: 12.5.2 and using the --auto-detect-version-properties switch when using the pact-broker publish command.
This is running in a BitBucket Cloud pipeline.
The docs say this flag:
Automatically detect the repository commit, branch and build URL from known CI environment variables or git CLI
When I look in the branch_versions table I can see a new row with the expected branch name and underlying version number, but:
⢠The associated row of versions has blank build_url and repository_ref columns (I'm assuming the former should contain the "build URL" described above
⢠I'm not sure where the "repository commit" alluded to above would crop up in the pact broker DB, so I'm not sure where to check for that.
Should I expect repository commit and build URL to be recorded in the DB somewhere? If they should be, any advice for how to track down why they are not appearing?Yousaf Nabi (pactflow.io)
Alan Boshier
06/28/2024, 10:55 AM--verbose set on the call to publish - is there anything in particular I should be looking for in there?Yousaf Nabi (pactflow.io)
Created GoAdminService version bf65b7406bec6dd9a15569ec1441649ea19a51c0 with branch master
You should see something like the above, with version <version> being the commit (if it has been picked up).
it actually wont let you publish without a commit versionYousaf Nabi (pactflow.io)
Alan Boshier
06/28/2024, 11:02 AMCreated foo version 285bd2d-featurepact-use-branch-not-tag+285bd2d with branch feature/pact-use-branch-not-tag and tags feature/pact-use-branch-not-tag
The version is calculated using npx absolute-version, and the only slight oddity is the removal of the / character present in the branch from the version.Yousaf Nabi (pactflow.io)
Alan Boshier
06/28/2024, 11:06 AMAlan Boshier
06/28/2024, 11:06 AM/ is an ab-ver thing too.Alan Boshier
06/28/2024, 11:08 AMpact-broker publish ./pacts --consumer-app-version=<ab-ver> --auto-detect-version-properties --tag-with-git-branch --verbose --broker-base-url=<broker-url>
where <ab-ver> is the output 285bd2d-featurepact-use-branch-not-tag+285bd2d from absolute-version.Alan Boshier
06/28/2024, 11:24 AMBITBUCKET_BRANCH
BITBUCKET_BUILD_NUMBER
BITBUCKET_CLONE_DIR
BITBUCKET_COMMIT
BITBUCKET_GIT_HTTP_ORIGIN
BITBUCKET_GIT_SSH_ORIGIN
BITBUCKET_PIPELINE_UUID
BITBUCKET_PROJECT_KEY
BITBUCKET_PROJECT_UUID
BITBUCKET_REPO_FULL_NAME
BITBUCKET_REPO_IS_PRIVATE
BITBUCKET_REPO_OWNER
BITBUCKET_REPO_OWNER_UUID
BITBUCKET_REPO_SLUG
BITBUCKET_REPO_UUID
BITBUCKET_SSH_KEY_FILE
BITBUCKET_STEP_RUN_NUMBER
BITBUCKET_STEP_TRIGGERER_UUID
BITBUCKET_STEP_UUID
BITBUCKET_WORKSPACEAlan Boshier
06/28/2024, 11:26 AMBITBUCKET_BRANCH and BITBUCKET_COMMIT appear in that list of envVars you sent me; in particular there's nothing to match anything in the BUILD_URL_ENV_VAR_NAMES list.Yousaf Nabi (pactflow.io)
Alan Boshier
06/28/2024, 11:27 AMBITBUCKET_BRANCH = feature/pact-use-branch-not-tag
BITBUCKET_COMMIT = 91b019b1b56126b3af0925f22eb30f3b4f55b79cYousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Alan Boshier
06/28/2024, 11:30 AMBUILD_URL from some of the available bits as outlined in the s/o above.
I'll give that a try - many thanks for your help!Yousaf Nabi (pactflow.io)
Alan Boshier
06/28/2024, 12:46 PMBUILD_URL to <https://bitbucket.org/${BITBUCKET_REPO_FULL_NAME}/pipelines/results/${BITBUCKET_BUILD_NUMBER}> prior to calling publish from the BitBucket pipeline results in the `versions.build_url`being populated in the database,