Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #983 from laverya/publish-pacts
Browse files Browse the repository at this point in the history
publish pacts when releasing ship
  • Loading branch information
laverya authored Jun 20, 2019
2 parents e3a387b + 8c08902 commit ee93add
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,15 @@ jobs:
- setup_remote_docker
- run: make build-deps pacts-ci

pacts_publish:
docker:
- image: circleci/golang:1.12
working_directory: /go/src/github.com/replicatedhq/ship
steps:
- checkout
- setup_remote_docker
- run: make build-deps pacts-ci-publish

windows_build_test:
docker:
- image: golang:1.12
Expand Down Expand Up @@ -800,3 +809,11 @@ workflows:
only: /^v[0-9]+(\.[0-9]+)*(-.*)*/
branches:
ignore: /.*/
- pacts_publish:
requires:
- deploy
filters:
tags:
only: /^v[0-9]+(\.[0-9]+)*(-.*)*/
branches:
ignore: /.*/
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ pacts-ci:
ship-contract-tests \
bash -c 'go test -v ./contracts/...'

.PHONY: pacts-ci-publish
pacts-ci-publish:
docker build -t ship-contract-tests -f contracts/Dockerfile.testing .
docker run --rm --name ship-contract-tests \
-e PACT_BROKER_USERNAME -e PACT_BROKER_PASSWORD -e VERSION=$$CIRCLE_TAG \
ship-contract-tests \
bash -c 'go test -v ./contracts/... && ./contracts/publish.sh'

_mockgen:
rm -rf pkg/test-mocks
mkdir -p pkg/test-mocks/ui
Expand Down
9 changes: 9 additions & 0 deletions contracts/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

curl \
--silent --output /dev/null --show-error --fail \
--user ${PACT_BROKER_USERNAME}:${PACT_BROKER_PASSWORD} \
-X PUT \
-H "Content-Type: application/json" \
-d@pacts/ship-prem-graphql-api.json \
https://replicated-pact-broker.herokuapp.com/pacts/provider/prem-graphql-api/consumer/ship/version/${VERSION}

0 comments on commit ee93add

Please sign in to comment.