Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
- run: apt-get install -y make
- checkout
- run:
name: Rebase on-top of latest develop
command: ./devops/scripts/rebase-develop.sh
name: Rebase on-top of github target
command: ./devops/scripts/rebase-ci.sh
- setup_remote_docker

- run: TAG=${CIRCLE_SHA1} make ci-lint-image
Expand All @@ -27,8 +27,8 @@ jobs:
- run: apt-get install -y make
- checkout
- run:
name: Rebase on-top of latest develop
command: ./devops/scripts/rebase-develop.sh
name: Rebase on-top of github target
command: ./devops/scripts/rebase-ci.sh
- setup_remote_docker

- restore_cache:
Expand Down Expand Up @@ -133,8 +133,8 @@ jobs:
- checkout

- run:
name: Rebase on-top of latest develop
command: ./devops/scripts/rebase-develop.sh
name: Rebase on-top of github target
command: ./devops/scripts/rebase-ci.sh

- run:
name: Installation apt pre-reqs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/bin/bash
# shellcheck disable=SC2086
#
# To be utilized in CircleCI
# Determine target branch from PR number and rebase against that

set -e

GITHUB_PR_URL="https://api.github.com/repos/freedomofpress/securedrop/pulls/${CIRCLE_PULL_REQUEST##*/}"

# If current branch is not master or doesnt start with release...
if [[ "$CIRCLE_BRANCH" != "master" && "$CIRCLE_BRANCH" != release* ]]; then

Expand All @@ -12,9 +18,14 @@ if [[ "$CIRCLE_BRANCH" != "master" && "$CIRCLE_BRANCH" != release* ]]; then
# Ensure presensce of upstream remote
git ls-remote --exit-code --quiet upstream 2>/dev/null || git remote add upstream https://github.com/freedomofpress/securedrop.git

# Determine target branch via API
#
# (We are togglin' between two upstream containers here - the constant is both have python3)
target_branch="$(curl -s ${GITHUB_PR_URL} | python3 -c 'import sys, json; print(json.load(sys.stdin)["base"]["ref"])')"

# Fetch and rebase onto the latest in develop
git fetch upstream develop
git rebase upstream/develop
git fetch upstream "${target_branch}"
git rebase "upstream/${target_branch}"

# Print out the current head for debugging potential CI issues
git rev-parse HEAD
Expand Down