Skip to content

Commit

Permalink
spec: Add git SHA to pact file consumer version.
Browse files Browse the repository at this point in the history
test plan:
  - use the bin/contracts-publish-api file to publish
    a pact file to the pact broker
  - verify the SHA on the broker matches the HEAD SHA on your
    current branch using `git log`

Change-Id: I69a08a2e4fb735d1f211fb29d860f829c75113fd
Reviewed-on: https://gerrit.instructure.com/156448
Tested-by: Jenkins
Reviewed-by: Deepeeca Soundarrajan <[email protected]>
Reviewed-by: Anju Reddy <[email protected]>
Product-Review: Anju Reddy <[email protected]>
QA-Review: Anju Reddy <[email protected]>
  • Loading branch information
Robert Lamb authored and Anju Reddy committed Jul 7, 2018
1 parent 510e76e commit b811f3e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/contracts-publish-api
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/bash

generic_consumer_version='0.15'
sha=$(git rev-parse --short HEAD)
version="$generic_consumer_version+$sha"

echo Publishing version: $version

set -e

Expand All @@ -11,12 +15,12 @@ if [ -f config/consul.yml ]; then # canvas is running in docker
-u $PACT_BROKER_USERNAME \
-p $PACT_BROKER_PASSWORD \
-b https://inst-pact-broker.inseng.net \
-a $generic_consumer_version
-a $version
else
RAILS_ENV=test \
bundle exec pact-broker publish pacts/generic_consumer-canvas_lms_api.json \
-u $PACT_BROKER_USERNAME \
-p $PACT_BROKER_PASSWORD \
-b https://inst-pact-broker.inseng.net \
-a $generic_consumer_version
-a $version
fi
31 changes: 31 additions & 0 deletions bin/contracts-tag-prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

scriptname=$0

if [ -z "$1" ]; then
echo Usage: $scriptname version
exit
else
version=$1
fi

echo "This will tag your specified version of the Generic Consumer pact file on"
echo "inst-pact-broker.inseng.net as the 'prod' version. This tag will signal"
echo "the canvas__contract-tests CI build to use your pact file version to"
echo "test every new Canvas patchset."
echo
echo "Are you sure? (yes/no)"
read confirm

if [ $confirm != "yes" ]; then
echo Aborting.
exit
fi

set -e

bundle exec pact-broker create-version-tag \
-a "Generic Consumer" \
-b https://inst-pact-broker.inseng.net \
-e $version \
-t prod

0 comments on commit b811f3e

Please sign in to comment.