New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: setup pact in CI/CD #35
base: main
Are you sure you want to change the base?
Conversation
@@ -1,3 +1,5 @@ | |||
//go:build smoke |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL
scripts/publish-contract.sh
Outdated
|
||
if [[ $(git diff ..main **/pacts/*.json) ]]; then | ||
echo "Contract has changed" | ||
if [[ $(git diff ..main .consumer-version) ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add that to the CI to forcibly fail PR checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean? Do you mean an earlier linting check rather than failing so late in the CI/CD?
scripts/publish-contract.sh
Outdated
else | ||
echo "Publishing Pact contracts..." | ||
pact-broker publish internal/deepcode/pacts/code-client-go-snykcodeapi.json --consumer-app-version "$consumerVersion" --branch main --broker-base-url "$brokerUrl" --broker-token "$brokerToken" | ||
pact-broker publish internal/workspace/2024-03-12/pacts/code-client-go-workspaceapi.json --consumer-app-version "$consumerVersion" --branch main --broker-base-url "$brokerUrl" --broker-token "$brokerToken" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be safer to pass broker token as env variable with PACT_BROKER_TOKEN
instead of CLI parameter.
|
d279217
to
8b5cdac
Compare
d7526d6
to
1a614d9
Compare
1a614d9
to
40cf21f
Compare
The diagram of the pipeline can be found at https://miro.com/app/board/uXjVNsON77A=/?moveToWidget=3458764586699482727&cot=14
The
workspace-service
branch is https://github.com/snyk/workspace-service/compare/main...feat/spike/pact-separate.After
publish-contract
:After
verify-contract
:After
make is-contract-compatible
:workspace-service
has not deployed the versionworkspace-service
has deployed the version (../code-client-go/.bin/pact/bin/pact-broker record_deployment --pacticipant WorkspaceApi --version 7.35.1-featspikepact-separate+7.147b9763.SNAPSHOT.Teodoras-MacBook-Pro --environment production --broker-base-url $PACT_BROKER_URL --broker-token $PACT_BROKER_TOKEN
from theworkspace-service
repo)We need to be able to create an environment first:
../code-client-go/.bin/pact/bin/pact-broker create-environment --name production --display-name Production --production --broker-base-url $PACT_BROKER_URL --broker-token $PACT_BROKER_TOKEN
After
make deploy-contract
:To do:
workspace-service
tests inverify-contract
workspace-service
branch once https://github.com/snyk/workspace-service/compare/main...feat/spike/pact-separate is PR-ed and mergedmake deploy-contract
one