diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
commit | d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch) | |
tree | 2341ef426af70ad1e289c38036737e04b0aa5007 /scripts/rails-update-bisect | |
parent | d6e514dd13db8947884cd58fe2a9c2a063400a9b (diff) |
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'scripts/rails-update-bisect')
-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 $@ |