Unverified Commit 818383f6 authored by Atkins, Charles Vernon's avatar Atkins, Charles Vernon Committed by GitHub
Browse files

Merge pull request #1799 from chuckatkins/add-extra-release-branches

Adding all release branches to CI
parents 837d1b0e 826a8841
trigger:
- master
- release
- release*
pr:
autoCancel: true
branches:
include:
- master
- release
- release*
resources:
containers:
......
#!/bin/bash
if [ $# -ne 1 ]
if [ $# -ne 1 -a $# -ne 2 ]
then
echo "[E] Usage: $0 [pull request number]"
echo "[E] Usage: $0 pr_num [release_branch]"
echo " release_branch defaults to using the most recent"
echo " upstream/release_xy if not specified"
exit 1
fi
......@@ -14,10 +16,18 @@ then
echo " Press Ctrl+C to cancel operation or wait 5s to continue"
sleep 5
fi
DST="$(git branch | awk '$1=="*" {print $2}')"
if [ $# -eq 2 ]
then
SRC="$2"
else
SRC="$(git branch -a | grep remotes/upstream/release_ | sort | tail -1 | sed 's|.* remotes/||')"
fi
PR=$1
echo "[I] Locating PR merge commit in upstream/master"
PR_MERGE_COMMIT=$(git log --oneline --merges --first-parent --no-decorate upstream/release | awk -v PRMATCH="#${PR}" '$5==PRMATCH {print $1}')
echo "[I] Locating PR merge commit in ${SRC}"
PR_MERGE_COMMIT=$(git log --oneline --merges --first-parent --no-decorate ${SRC} | awk -v PRMATCH="#${PR}" '$5==PRMATCH {print $1}')
if [ -z "${PR_MERGE_COMMIT}" ]
then
echo "[E] Unable to find pull request #${PR}"
......@@ -26,7 +36,7 @@ else
echo "[I] Found ${PR_MERGE_COMMIT}"
fi
echo "[I] Locating PR base commit in upstream/master"
echo "[I] Locating PR base commit in ${SRC}"
PR_BASE_COMMIT=$(git show -s --oneline ${PR_MERGE_COMMIT}^2 | awk '{print $1}')
echo "[I] Found ${PR_BASE_COMMIT}"
......@@ -49,14 +59,14 @@ else
echo "[W] Skipping; branch already contains PR base commit ${PR_BASE_COMMIT}"
fi
echo "[I] Merging release branch"
echo "[I] Merging ${SRC/upstream\//} branch"
if ! git merge --no-ff --no-commit ${PR_MERGE_COMMIT} 1>/dev/null 2>/dev/null
then
echo "[E] Merge failed"
git reset --hard
exit 6
fi
if ! git commit -m "Merge release"
if ! git commit -m "Merge ${SRC/upstream\//}"
then
echo "[E] Commit of previous merge failed"
git reset --hard
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment