diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-07 00:12:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-07 00:12:16 +0300 |
commit | 87598f1576cc7b3e1071a83d70778a51009b853b (patch) | |
tree | 42a1e678a3f9abf870d1cc88ecf536375f889b12 /scripts | |
parent | 30e5ae4c2b9c1674dc222e4bde0daa3f9795782e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/rails-update-bisect | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/rails-update-bisect b/scripts/rails-update-bisect new file mode 100755 index 00000000000..77a01e2dadc --- /dev/null +++ b/scripts/rails-update-bisect @@ -0,0 +1,39 @@ +#!/bin/bash +SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" +GITLAB_DIR="$(dirname "$SCRIPT_DIR")" + +# Because this script is intended to be run with `git bisect run`, +# we are returning `-1` status code to alert `git bisect` of failures. +# +# See: https://git-scm.com/docs/git-bisect#_bisect_run +# +abort_bisect () { + exit -1 +} + +if [ $# -eq 0 ]; then + echo "No arguments supplied. Please provide spec file(s) as first argument(s)" + abort_bisect +fi + +[[ -z "${RAILS_FOLDER}" ]] && { echo >&2 "RAILS_FOLDER env variable is not set"; abort_bisect; } + +if ! grep -q -E "gem 'rails'.+RAILS_VERSION.+RAILS_FOLDER" $GITLAB_DIR/Gemfile; then + echo "Gemfile is not modified" + echo "Please alter the gem 'rails' line in Gemfile with:" + echo "gem 'rails', ENV['RAILS_VERSION'], path: ENV['RAILS_FOLDER']" + abort_bisect +fi + +export RAILS_VERSION=$(cat $RAILS_FOLDER/RAILS_VERSION) + +cd $GITLAB_DIR && \ +echo "Updating dependencies... this could take a while." && \ +bundle update rails --quiet + +test $? -eq 0 || { echo >&2 "bundle update has failed"; abort_bisect; } + +# Stop spring if it's installed +command -v spring >/dev/null 2>&1 && spring stop + +bin/rspec $@ |