diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/contracts/publish-contracts.sh | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/contracts/publish-contracts.sh')
-rw-r--r-- | spec/contracts/publish-contracts.sh | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/spec/contracts/publish-contracts.sh b/spec/contracts/publish-contracts.sh index f20cc43e258..8b9d4b6ecc6 100644 --- a/spec/contracts/publish-contracts.sh +++ b/spec/contracts/publish-contracts.sh @@ -2,22 +2,50 @@ LATEST_SHA=$(git rev-parse HEAD) GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) BROKER_BASE_URL="http://localhost:9292" -CONTRACTS=$(find ./contracts -name "*.json") -ERROR=0 - -trap 'catch' ERR +cd "${0%/*}" || exit 1 function catch() { printf "\e[31mAn error occured while trying to publish the pact.\033[0m\n" ERROR=1 } -for contract in $CONTRACTS -do - printf "\e[32mPublishing ${contract}...\033[0m\n" - pact-broker publish $contract --consumer-app-version $LATEST_SHA --branch $GIT_BRANCH --broker-base-url $BROKER_BASE_URL --output json -done +function publish_contract () { + CONTRACTS=$(find ./contracts -name "*.json") + ERROR=0 + + trap 'catch' ERR + + for contract in $CONTRACTS + do + printf "\e[32mPublishing %s...\033[0m\n" "$contract" + pact-broker publish "$contract" --consumer-app-version "$LATEST_SHA" --branch "$GIT_BRANCH" --broker-base-url "$BROKER_BASE_URL" --output json + done + + if [ ${ERROR} = 1 ]; then + exit 1; + fi +} + +function publish_ce_contracts () { + publish_contract +} + +function publish_ee_contracts () { + cd "../../ee/spec/contracts" || exit 1 + publish_contract +} -if [ ${ERROR} = 1 ]; then +if [ $1 = "ce" ]; then + printf "\e[32mPublishing CE contracts...\033[0m\n" + publish_ce_contracts +elif [ $1 = "ee" ]; then + printf "\e[32mPublishing EE contracts...\033[0m\n" + publish_ee_contracts +elif [ $1 = "all" ]; then + printf "\e[32mPublishing all contracts...\033[0m\n" + publish_ce_contracts + publish_ee_contracts +else + printf "\e[31mInvalid argument. Please choose either \"ce\", \"ee\", or \"all\".\033[0m\n" exit 1; -fi
\ No newline at end of file +fi |