mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Auto-merge from CI [skip ci]
This commit is contained in:
@@ -19,6 +19,21 @@ function succeed_if_master_merged {
|
||||
fi
|
||||
}
|
||||
|
||||
function set_ofn_commit {
|
||||
echo "Setting commit to $1"
|
||||
buildkite-agent meta-data set "openfoodnetwork:git:commit" $1
|
||||
}
|
||||
|
||||
function get_ofn_commit {
|
||||
echo `buildkite-agent meta-data get "openfoodnetwork:git:commit"`
|
||||
}
|
||||
|
||||
function checkout_ofn_commit {
|
||||
OFN_COMMIT=`buildkite-agent meta-data get "openfoodnetwork:git:commit"`
|
||||
echo "Checking out stored commit $OFN_COMMIT"
|
||||
git checkout -qf "$OFN_COMMIT"
|
||||
}
|
||||
|
||||
function drop_and_recreate_database {
|
||||
# Adapted from: http://stackoverflow.com/questions/12924466/capistrano-with-postgresql-error-database-is-being-accessed-by-other-users
|
||||
psql -U openfoodweb postgres <<EOF
|
||||
|
||||
@@ -4,6 +4,7 @@ set -e
|
||||
source ./script/ci/includes.sh
|
||||
|
||||
echo "--- Checking if master has already been merged"
|
||||
set_ofn_commit $BUILDKITE_COMMIT
|
||||
succeed_if_master_merged
|
||||
|
||||
echo "--- Merging master into this branch"
|
||||
@@ -12,3 +13,5 @@ git merge origin/$BUILDKITE_BRANCH
|
||||
git merge origin/master -m "Auto-merge from CI [skip ci]"
|
||||
git push origin $BUILDKITE_BRANCH
|
||||
git checkout origin/$BUILDKITE_BRANCH
|
||||
|
||||
set_ofn_commit `git rev-parse $BUILDKITE_BRANCH`
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
set -e
|
||||
source ./script/ci/includes.sh
|
||||
|
||||
# Add production git remote if required
|
||||
PROD_TEST=`git remote | grep -s 'production' || true`
|
||||
@@ -9,7 +10,9 @@ if [[ "$PROD_TEST" != *production* ]]; then
|
||||
fi
|
||||
|
||||
echo "--- Saving baseline data for staging"
|
||||
ssh ofn-staging2 "/home/openfoodweb/apps/openfoodweb/current/script/ci/save_staging_baseline.sh $BUILDKITE_COMMIT"
|
||||
ssh ofn-staging2 "/home/openfoodweb/apps/openfoodweb/current/script/ci/save_staging_baseline.sh `get_ofn_commit`"
|
||||
|
||||
echo "--- Pushing to production"
|
||||
[[ $(git push production $BUILDKITE_COMMIT:master --force 2>&1) =~ "Done" ]]
|
||||
exec 5>&1
|
||||
OUTPUT=$(git push production `get_ofn_commit`:master --force 2>&1 |tee /dev/fd/5)
|
||||
[[ $OUTPUT =~ "Done" ]]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
set -e
|
||||
source ./script/ci/includes.sh
|
||||
|
||||
# Add staging git remote if required
|
||||
@@ -16,4 +16,6 @@ echo "--- Loading baseline data"
|
||||
ssh ofn-staging2 "/home/openfoodweb/apps/openfoodweb/current/script/ci/load_staging_baseline.sh"
|
||||
|
||||
echo "--- Pushing to staging"
|
||||
[[ $(git push staging2 $BUILDKITE_COMMIT:master --force 2>&1) =~ "Done" ]]
|
||||
exec 5>&1
|
||||
OUTPUT=$(git push staging2 `get_ofn_commit`:master --force 2>&1 |tee /dev/fd/5)
|
||||
[[ $OUTPUT =~ "Done" ]]
|
||||
|
||||
@@ -5,6 +5,7 @@ set -e
|
||||
echo "--- Loading environment"
|
||||
source ./script/ci/includes.sh
|
||||
load_environment
|
||||
checkout_ofn_commit
|
||||
|
||||
echo "--- Verifying branch is based on current master"
|
||||
exit_unless_master_merged
|
||||
|
||||
@@ -5,6 +5,7 @@ set -e
|
||||
echo "--- Loading environment"
|
||||
source ./script/ci/includes.sh
|
||||
load_environment
|
||||
checkout_ofn_commit
|
||||
|
||||
echo "--- Verifying branch is based on current master"
|
||||
exit_unless_master_merged
|
||||
|
||||
Reference in New Issue
Block a user