Commit 14822a68 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'FixShellScriptIndent' into 'master'

Unify indentation in shell scripts

See merge request gitlab-org/gitlab!32767
parents 0682da01 d12b7c91
...@@ -5,16 +5,16 @@ set -e ...@@ -5,16 +5,16 @@ set -e
cd $(dirname $0)/.. cd $(dirname $0)/..
case "$USE_WEB_SERVER" in case "$USE_WEB_SERVER" in
puma|"") # and the "" defines default puma|"") # and the "" defines default
exec bin/web_puma "$@" exec bin/web_puma "$@"
;; ;;
unicorn) unicorn)
exec bin/web_unicorn "$@" exec bin/web_unicorn "$@"
;; ;;
*) *)
echo "Unkown web server used by USE_WEB_SERVER: $USE_WEB_SERVER." echo "Unkown web server used by USE_WEB_SERVER: $USE_WEB_SERVER."
exit 1 exit 1
;; ;;
esac esac
...@@ -73,7 +73,7 @@ fi ...@@ -73,7 +73,7 @@ fi
# Switch to the gitlab path, exit on failure. # Switch to the gitlab path, exit on failure.
if ! cd "$app_root" ; then if ! cd "$app_root" ; then
echo "Failed to cd into $app_root, exiting!"; exit 1 echo "Failed to cd into $app_root, exiting!"; exit 1
fi fi
if [ -z "$SIDEKIQ_WORKERS" ]; then if [ -z "$SIDEKIQ_WORKERS" ]; then
...@@ -341,7 +341,7 @@ start_gitlab() { ...@@ -341,7 +341,7 @@ start_gitlab() {
echo "Gitaly is already running with pid $gapid, not restarting" echo "Gitaly is already running with pid $gapid, not restarting"
else else
$app_root/bin/daemon_with_pidfile $gitaly_pid_path \ $app_root/bin/daemon_with_pidfile $gitaly_pid_path \
$gitaly_dir/gitaly $gitaly_dir/config.toml >> $gitaly_log 2>&1 & $gitaly_dir/gitaly $gitaly_dir/config.toml >> $gitaly_log 2>&1 &
fi fi
fi fi
...@@ -413,39 +413,39 @@ print_status() { ...@@ -413,39 +413,39 @@ print_status() {
return return
fi fi
if [ "$web_status" = "0" ]; then if [ "$web_status" = "0" ]; then
echo "The GitLab web server with pid $wpid is running." echo "The GitLab web server with pid $wpid is running."
else else
printf "The GitLab web server is \033[31mnot running\033[0m.\n" printf "The GitLab web server is \033[31mnot running\033[0m.\n"
fi fi
if [ "$sidekiq_status" = "0" ]; then if [ "$sidekiq_status" = "0" ]; then
echo "The GitLab Sidekiq job dispatcher with pid $spid is running." echo "The GitLab Sidekiq job dispatcher with pid $spid is running."
else else
printf "The GitLab Sidekiq job dispatcher is \033[31mnot running\033[0m.\n" printf "The GitLab Sidekiq job dispatcher is \033[31mnot running\033[0m.\n"
fi fi
if [ "$gitlab_workhorse_status" = "0" ]; then if [ "$gitlab_workhorse_status" = "0" ]; then
echo "The GitLab Workhorse with pid $hpid is running." echo "The GitLab Workhorse with pid $hpid is running."
else else
printf "The GitLab Workhorse is \033[31mnot running\033[0m.\n" printf "The GitLab Workhorse is \033[31mnot running\033[0m.\n"
fi fi
if [ "$mail_room_enabled" = true ]; then if [ "$mail_room_enabled" = true ]; then
if [ "$mail_room_status" = "0" ]; then if [ "$mail_room_status" = "0" ]; then
echo "The GitLab MailRoom email processor with pid $mpid is running." echo "The GitLab MailRoom email processor with pid $mpid is running."
else else
printf "The GitLab MailRoom email processor is \033[31mnot running\033[0m.\n" printf "The GitLab MailRoom email processor is \033[31mnot running\033[0m.\n"
fi fi
fi fi
if [ "$gitlab_pages_enabled" = true ]; then if [ "$gitlab_pages_enabled" = true ]; then
if [ "$gitlab_pages_status" = "0" ]; then if [ "$gitlab_pages_status" = "0" ]; then
echo "The GitLab Pages with pid $gppid is running." echo "The GitLab Pages with pid $gppid is running."
else else
printf "The GitLab Pages is \033[31mnot running\033[0m.\n" printf "The GitLab Pages is \033[31mnot running\033[0m.\n"
fi fi
fi fi
if [ "$gitaly_enabled" = true ]; then if [ "$gitaly_enabled" = true ]; then
if [ "$gitaly_status" = "0" ]; then if [ "$gitaly_status" = "0" ]; then
echo "Gitaly with pid $gapid is running." echo "Gitaly with pid $gapid is running."
else else
printf "Gitaly is \033[31mnot running\033[0m.\n" printf "Gitaly is \033[31mnot running\033[0m.\n"
fi fi
fi fi
if [ "$web_status" = "0" ] && [ "$sidekiq_status" = "0" ] && [ "$gitlab_workhorse_status" = "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" = "0" ]; } && { [ "$gitlab_pages_enabled" != true ] || [ "$gitlab_pages_status" = "0" ]; } && { [ "$gitaly_enabled" != true ] || [ "$gitaly_status" = "0" ]; }; then if [ "$web_status" = "0" ] && [ "$sidekiq_status" = "0" ] && [ "$gitlab_workhorse_status" = "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" = "0" ]; } && { [ "$gitlab_pages_enabled" != true ] || [ "$gitlab_pages_status" = "0" ]; } && { [ "$gitaly_enabled" != true ] || [ "$gitaly_status" = "0" ]; }; then
...@@ -490,25 +490,25 @@ restart_gitlab(){ ...@@ -490,25 +490,25 @@ restart_gitlab(){
case "$1" in case "$1" in
start) start)
start_gitlab start_gitlab
;; ;;
stop) stop)
stop_gitlab stop_gitlab
;; ;;
restart) restart)
restart_gitlab restart_gitlab
;; ;;
reload|force-reload) reload|force-reload)
reload_gitlab reload_gitlab
;; ;;
status) status)
print_status print_status
exit $gitlab_status exit $gitlab_status
;; ;;
*) *)
echo "Usage: service gitlab {start|stop|restart|reload|status}" echo "Usage: service gitlab {start|stop|restart|reload|status}"
exit 1 exit 1
;; ;;
esac esac
exit exit
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
gemfile_lock_changed() { gemfile_lock_changed() {
if [ -n "$(git diff --name-only -- Gemfile.lock)" ]; then if [ -n "$(git diff --name-only -- Gemfile.lock)" ]; then
cat << EOF cat <<EOF
Gemfile was updated but Gemfile.lock was not updated. Gemfile was updated but Gemfile.lock was not updated.
Usually, when Gemfile is updated, you should run Usually, when Gemfile is updated, you should run
......
...@@ -6,7 +6,7 @@ lint_paths="changelogs/unreleased" ...@@ -6,7 +6,7 @@ lint_paths="changelogs/unreleased"
invalid_files=$(find $lint_paths -type f -not -name "*.yml" -not -name ".gitkeep") invalid_files=$(find $lint_paths -type f -not -name "*.yml" -not -name ".gitkeep")
if [ -n "$invalid_files" ]; then if [ -n "$invalid_files" ]; then
echo "Changelog files must end in .yml, but these did not:" echo "Changelog files must end in .yml, but these did not:"
echo "$invalid_files" | sed -e "s/^/* /" echo "$invalid_files" | sed -e "s/^/* /"
exit 1 exit 1
fi fi
...@@ -7,56 +7,56 @@ set -e ...@@ -7,56 +7,56 @@ set -e
if [[ "$MERGE_TRAIN_TRIGGER_TOKEN" == '' ]] if [[ "$MERGE_TRAIN_TRIGGER_TOKEN" == '' ]]
then then
echo 'The variable MERGE_TRAIN_TRIGGER_TOKEN must be set to a non-empty value' echo 'The variable MERGE_TRAIN_TRIGGER_TOKEN must be set to a non-empty value'
exit 1 exit 1
fi fi
if [[ "$MERGE_TRAIN_TRIGGER_URL" == '' ]] if [[ "$MERGE_TRAIN_TRIGGER_URL" == '' ]]
then then
echo 'The variable MERGE_TRAIN_TRIGGER_URL must be set to a non-empty value' echo 'The variable MERGE_TRAIN_TRIGGER_URL must be set to a non-empty value'
exit 1 exit 1
fi fi
if [[ "$CI_COMMIT_REF_NAME" == '' ]] if [[ "$CI_COMMIT_REF_NAME" == '' ]]
then then
echo 'The variable CI_COMMIT_REF_NAME must be set to a non-empty value' echo 'The variable CI_COMMIT_REF_NAME must be set to a non-empty value'
exit 1 exit 1
fi fi
if [[ "$SOURCE_PROJECT" == '' ]] if [[ "$SOURCE_PROJECT" == '' ]]
then then
echo 'The variable SOURCE_PROJECT must be set to a non-empty value' echo 'The variable SOURCE_PROJECT must be set to a non-empty value'
exit 1 exit 1
fi fi
if [[ "$TARGET_PROJECT" == '' ]] if [[ "$TARGET_PROJECT" == '' ]]
then then
echo 'The variable TARGET_PROJECT must be set to a non-empty value' echo 'The variable TARGET_PROJECT must be set to a non-empty value'
exit 1 exit 1
fi fi
if [[ "$TARGET_PROJECT" != "gitlab-org/gitlab-foss" ]] if [[ "$TARGET_PROJECT" != "gitlab-org/gitlab-foss" ]]
then then
echo 'This is a security FOSS merge train' echo 'This is a security FOSS merge train'
echo "Checking if $CI_COMMIT_SHA is available on canonical" echo "Checking if $CI_COMMIT_SHA is available on canonical"
gitlab_com_commit_status=$(curl -s "https://gitlab.com/api/v4/projects/278964/repository/commits/$CI_COMMIT_SHA" | jq -M .status) gitlab_com_commit_status=$(curl -s "https://gitlab.com/api/v4/projects/278964/repository/commits/$CI_COMMIT_SHA" | jq -M .status)
if [[ "$gitlab_com_commit_status" != "null" ]] if [[ "$gitlab_com_commit_status" != "null" ]]
then then
echo 'Commit available on canonical, skipping merge train' echo 'Commit available on canonical, skipping merge train'
exit 0 exit 0
fi fi
echo 'Commit not available, triggering a merge train' echo 'Commit not available, triggering a merge train'
fi fi
curl -X POST \ curl -X POST \
-F token="$MERGE_TRAIN_TRIGGER_TOKEN" \ -F token="$MERGE_TRAIN_TRIGGER_TOKEN" \
-F ref=master \ -F ref=master \
-F "variables[MERGE_FOSS]=1" \ -F "variables[MERGE_FOSS]=1" \
-F "variables[SOURCE_BRANCH]=$CI_COMMIT_REF_NAME" \ -F "variables[SOURCE_BRANCH]=$CI_COMMIT_REF_NAME" \
-F "variables[TARGET_BRANCH]=${CI_COMMIT_REF_NAME/-ee/}" \ -F "variables[TARGET_BRANCH]=${CI_COMMIT_REF_NAME/-ee/}" \
-F "variables[SOURCE_PROJECT]=$SOURCE_PROJECT" \ -F "variables[SOURCE_PROJECT]=$SOURCE_PROJECT" \
-F "variables[TARGET_PROJECT]=$TARGET_PROJECT" \ -F "variables[TARGET_PROJECT]=$TARGET_PROJECT" \
"$MERGE_TRAIN_TRIGGER_URL" "$MERGE_TRAIN_TRIGGER_URL"
function retry() { function retry() {
if eval "$@"; then
return 0
fi
for i in 2 1; do
sleep 3s
echo "Retrying $i..."
if eval "$@"; then if eval "$@"; then
return 0 return 0
fi fi
done
for i in 2 1; do return 1
sleep 3s
echo "Retrying $i..."
if eval "$@"; then
return 0
fi
done
return 1
} }
function setup_db_user_only() { function setup_db_user_only() {
source scripts/create_postgres_user.sh source scripts/create_postgres_user.sh
} }
function setup_db() { function setup_db() {
run_timed_command "setup_db_user_only" run_timed_command "setup_db_user_only"
run_timed_command "bundle exec rake db:drop db:create db:structure:load db:migrate gitlab:db:setup_ee" run_timed_command "bundle exec rake db:drop db:create db:structure:load db:migrate gitlab:db:setup_ee"
} }
function install_api_client_dependencies_with_apk() { function install_api_client_dependencies_with_apk() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment