Skip to content

Commit

Permalink
Merge pull request #1975 from brave/mplesa-add-rebase-to-pr-builder-0…
Browse files Browse the repository at this point in the history
….61.x

Mplesa add rebase to pr builder 0.61.x
  • Loading branch information
mihaiplesa authored Mar 15, 2019
2 parents 4b67463 + cd0f480 commit 2d5a9bc
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,63 @@ pipeline {
stage("config") {
steps {
sh """
#!/bin/bash
set +x
if [ -d brave-browser ]; then
rm -rf brave-browser
fi
echo "Cloning brave-browser..."
git clone --branch ${TARGET_BRANCH} ${BB_REPO} || git clone ${BB_REPO}
cd brave-browser
git config user.name brave-builds
git config user.email [email protected]
git config push.default simple
if [ "`curl -s -w %{http_code} -o /dev/null ${BB_REPO}/tree/${BRANCH_TO_BUILD}`" = "404" ]; then
echo "Creating ${BRANCH_TO_BUILD} branch in brave-browser..."
git checkout -b ${BRANCH_TO_BUILD}
echo "Pinning brave-core to branch ${BRANCH_TO_BUILD}..."
jq "del(.config.projects[\\"brave-core\\"].branch) | .config.projects[\\"brave-core\\"].branch=\\"${BRANCH_TO_BUILD}\\"" package.json > package.json.new
mv package.json.new package.json
echo "Pushing changes..."
echo "Committing..."
git commit --all --message "pin brave-core to branch ${BRANCH_TO_BUILD}"
echo "Pushing changes..."
git push ${BB_REPO}
else
git checkout ${BRANCH_TO_BUILD}
if [ "`cat package.json | jq -r .version`" != "`cat ../package.json | jq -r .version`" ]; then
set +e
echo "Version mismatch between brave-browser and brave-core in package.json! Attempting rebase on brave-browser..."
echo "Fetching latest changes and pruning refs..."
git fetch --prune
echo "Rebasing ${BRANCH_TO_BUILD} branch on brave-browser against ${TARGET_BRANCH}..."
git rebase origin/${TARGET_BRANCH}
if [ \$? -ne 0 ]; then
echo "Failed to rebase (conflicts), will need to be manually rebased!"
git rebase --abort
else
echo "Rebased, force pushing to brave-browser..."
git push --force ${BB_REPO}
fi
if [ "`cat package.json | jq -r .version`" != "`cat ../package.json | jq -r .version`" ]; then
echo "Version mismatch between brave-browser and brave-core in package.json! Please try rebasing this branch in brave-core as well."
exit 1
fi
set -e
fi
fi
echo "Sleeping 5m so new branch is discovered or associated PR created in brave-browser..."
Expand Down

0 comments on commit 2d5a9bc

Please sign in to comment.