Viktoriia Vlasiuk
01/09/2023, 9:11 AM#!/usr/bin/env bash
echo "running can-I-deploy with the following params""
PACT_BROKER_BASE_URL: $PACT_BROKER_BASE_URL
PACT_BROKER_TOKEN: $PACT_BROKER_TOKEN
consumer: $consumer
version: $version
provider: $provider
to_environment: $to_environment
"""
if [ -z "$version" ]; then
echo "ERROR: version cannot be empty to run can-i-deploy verification"
exit 1
fi
command=
if [ -z "$to_environment" ]; then
command="--pacticipant $provider --branch master"
else
command="--provider $provider --to-environment $to_environment"
fi
echo "command = $command "
docker run --rm \
-w "${PWD}" \
-v "${PWD}":"${PWD}" \
-e PACT_BROKER_BASE_URL="$PACT_BROKER_BASE_URL" \
-e PACT_BROKER_TOKEN="$PACT_BROKER_TOKEN" \
pactfoundation/pact-cli:0.50.0.32 \
broker can-i-deploy \
--pacticipant "$consumer" \
--version "$version" \
$command
I've found that if I want to use --branch master
in my command I need to use --pacticipant
, if I want to use --to-environment
I need to use --provider
otherwise it returns an error...Am I missing something here? If not...why cannot it be the same (provider or pacticipant) in both cases?Matt (pactflow.io / pact-js / pact-go)
pact-broker can-i-deploy \
--pacticipant ${PACTICIPANT} \
--version ${GIT_COMMIT} \
--to-environment ${ENVIRONMENT}
Viktoriia Vlasiuk
01/09/2023, 12:00 PMMatt (pactflow.io / pact-js / pact-go)
--pacticipant
values in this case? I think that’s your issueMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
--pacticipant
flag. And vice versaViktoriia Vlasiuk
01/10/2023, 8:44 AMstrategy:
matrix:
provider: [<provider1>]
env: [
"<env1>", "<env2>", "<env3>"
]
and I expect my command call to looks this way (in a loop for each env):
broker can-i-deploy \
--pacticipant "$consumer" \
--version "$version" \
--provider "<provider1>"
--to-environment "<env1>"
Viktoriia Vlasiuk
01/10/2023, 8:46 AMexact
providersMatt (pactflow.io / pact-js / pact-go)
Viktoriia Vlasiuk
01/10/2023, 11:22 AMprod
.
• P1 is a single-tenant service and gets deployed to client1_prod, client2_prod, client3_prod envs.
• P2 is a single-tenant service and gets deployed to client1_prod, client2_prod envs
I will record deployment for
• P1
envs client1_prod
, client2_prod
, client3_prod
• P2
envs lient1_prod
, client2_prod
Now I need to verify if I can deploy C. I need to verify pacts
C - P1 env client1_prod
C - P1 env client2_prod
C - P1 env client3_prod
C - P2 env client1_prod
C - P2 env client2_prod
If I don't specify the provider, I need to verify <all pacts for consumer C> for envs client1_prod
, client2_prod
, client3_prod
But verification C - P2 env client3_prod
will fail, because this service will never be there