From ade5243ebd8e96835eb965088fbd547db69bd8bc Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Mon, 3 Feb 2020 12:40:43 +1100 Subject: [PATCH 1/3] chore(ci): Add triggerBuilds to increment-version --- resources/build/increment-version.sh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/resources/build/increment-version.sh b/resources/build/increment-version.sh index 60aa7d9144..4abe8ab935 100755 --- a/resources/build/increment-version.sh +++ b/resources/build/increment-version.sh @@ -19,6 +19,8 @@ THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BA . "$(dirname "$THIS_SCRIPT")/build-utils.sh" ## END STANDARD BUILD SCRIPT INCLUDE +. "$(dirname "$THIS_SCRIPT")/trigger-builds.sh" + gitbranch=`git branch --show-current` if [[ $# -gt 0 ]]; then @@ -59,7 +61,6 @@ fi # avoid transient errors git pull origin $base - # # Run the increment + history refresh # @@ -69,15 +70,19 @@ npm install npm run build:ts popd > /dev/null -pushd "$KEYMAN_ROOT" -node resources/build/version/lib/index.js history version -t "$GITHUB_TOKEN" -b "$base" || ( +pushd "$KEYMAN_ROOT" > /dev/null +ABORT=0 +node resources/build/version/lib/index.js history version -t "$GITHUB_TOKEN" -b "$base" || ABORT=1 + +if [[ $ABORT = 1 ]]; then echo "Skipping version increment from $VERSION: no recently merged pull requests were found" if [ ! -z "${TEAMCITY_VERSION-}" ]; then # Send TeamCity a build status echo "##teamcity[buildStatus status='SUCCESS' text='Skipping version increment from $VERSION: no recently merged pull requests were found']" fi exit 0 -) +fi +popd > /dev/null # # Push the result @@ -100,7 +105,17 @@ if [ "$action" == "commit" ]; then git branch -D "$branch" popd > /dev/null - echo "Version was incremented and pull request was created" + # + # Trigger builds for the previous version on TeamCity + # + + triggerBuilds + + # + # Done + # + + echo "Version was incremented and pull request was created, and builds were triggered" if [ ! -z "${TEAMCITY_VERSION-}" ]; then # Send TeamCity a build status echo "##teamcity[buildStatus status='SUCCESS' text='Version was incremented from $VERSION to $NEWVERSION and pull request was created']" From d184c1080c157f4727a902c89ba3d3b3ee8cb59c Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Mon, 3 Feb 2020 12:44:28 +1100 Subject: [PATCH 2/3] chore(ci): trigger-builds script --- resources/build/trigger-builds.sh | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 resources/build/trigger-builds.sh diff --git a/resources/build/trigger-builds.sh b/resources/build/trigger-builds.sh new file mode 100644 index 0000000000..8957112e8f --- /dev/null +++ b/resources/build/trigger-builds.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# +# Tell TeamCity to trigger new builds +# + +function triggerBuilds() { + local base=`git branch --show-current` + if [[ $base == master ]]; then + local TEAMCITY_BUILDTYPES=( KeymanAndroid_Build Keyman_iOS_Master KeymanLinux_Master KeymanMac_Master Keyman_Build Keymanweb_Build ) + local TEAMCITY_VCS_ID=HttpsGithubComKeymanappKeyman + elif [[ $base == beta ]]; then + local TEAMCITY_BUILDTYPES=( KeymanAndroid_Beta Keyman_iOS_Beta KeymanLinux_Beta KeymanMac_Beta KeymanDesktop_Beta Keymanweb_Beta ) + local TEAMCITY_VCS_ID=Keyman_KeymanappKeymanBeta + else + exit 1 + fi + + for TEAMCITY_BUILDTYPE in "${TEAMCITY_BUILDTYPES[@]}"; do + triggerBuild $TEAMCITY_BUILDTYPE $TEAMCITY_VCS_ID + done +} + +function triggerBuild() { + local TEAMCITY_BUILDTYPE="$1" + local TEAMCITY_VCS_ID="$2" + +# 2caf29b27b3b364433c9298ec4d032fd178a210e + local GIT_OID=`git rev-parse HEAD` + local TEAMCITY_SERVER=https://build.palaso.org + + curl -s --header "Authorization: Bearer $TEAMCITY_TOKEN" \ + -X POST \ + -H "Content-Type: application/xml" \ + -H "Accept: application/json" \ + -H "Origin: $TEAMCITY_SERVER" \ + $TEAMCITY_SERVER/app/rest/buildQueue \ + -d "" +} From 6830ed1539d43235a0e00b64ff33c0b0c205f3b0 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Mon, 3 Feb 2020 12:44:50 +1100 Subject: [PATCH 3/3] chore: remove commented oid --- resources/build/trigger-builds.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/build/trigger-builds.sh b/resources/build/trigger-builds.sh index 8957112e8f..bfc6aa715d 100644 --- a/resources/build/trigger-builds.sh +++ b/resources/build/trigger-builds.sh @@ -25,7 +25,6 @@ function triggerBuild() { local TEAMCITY_BUILDTYPE="$1" local TEAMCITY_VCS_ID="$2" -# 2caf29b27b3b364433c9298ec4d032fd178a210e local GIT_OID=`git rev-parse HEAD` local TEAMCITY_SERVER=https://build.palaso.org