Hi there! I have a question related to `can-i-depl...
# pact-broker
r
Hi there! I have a question related to
can-i-deploy
feature. The background is that Pact broker webhook intercepts event like "Contract published that requires verification" and send 2 requests To verify single contract against providers: • (deployed in production) build • (latest version from main branch) build Using can-i-deploy tool I can get results of verification for (deployed in production) build like:
Copy code
pact-broker can-i-deploy \
 --pacticipant consumer \
 --version ${GIT_COMMIT} \
 --to-environment production
The question is how to get results of verification for (latest version from main branch) build using can-i-deploy? I'm trying this command but it doesn't work: P.S. I'm using branches not tags.
pact-broker can-i-deploy \
--pacticipant consumer --version ${GIT_COMMIT} \
--pacticipant provider --latest master \
--broker-base-url https://mytest.pactflow.io \
Computer says no ¯\_(ツ)_/¯ CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS? | RESULT# -----------|------------|----------|-----------|----------|-------- consumer | 13d20aa... | provider | ??? | ??? |
No version with tag master exists for provider
y
Copy code
pact-broker can-i-deploy \
 --pacticipant consumer \
 --version ${GIT_COMMIT} \
 --to-environment production
this is correct for your consumer. It publishes verification results against the providers main branch, but that isn’t relevant when deploying to consumers code, as it cares about what is in the deployed env. the triggered provider verification would check that the providers latest from main is still compatible, and if it isn’t it would stop the providers codebase from being deployed For your provider you would use can i deploy with the git commit for the version to deploy on your main branch.
Copy code
pact-broker can-i-deploy \
 --pacticipant provider \
 --version ${GIT_COMMIT} \
 --to-environment production
r
@Yousaf Nabi (pactflow.io) thanks! you're right but I plan to use that in my feature branch and not before deploying to production. Just to understand that latest provider main branch fulfil that contract. How I can get results of verification of contract from feature branch against (latest version from main branch) build using can-i-deploy ?
And follow up question: Is there a way to remove record after executing "pact-broker record-deployment"? Like to make it empty
y
you can record releases and unrelease them. a deployment will mark all others as undeployed
✅ 1
are you deploying feature branches to an env? or testing pre merge
r
testing pre merge
btw I've found how to do it:
Copy code
pact-broker can-i-deploy    
--pacticipant consumer --version HASH   \
--pacticipant provider --branch main
this will compare particular contract with the "latest version from main branch"
✅ 1