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
cd $(dirname $0)/..
case "$USE_WEB_SERVER" in
puma|"") # and the "" defines default
exec bin/web_puma "$@"
;;
puma|"") # and the "" defines default
exec bin/web_puma "$@"
;;
unicorn)
exec bin/web_unicorn "$@"
;;
unicorn)
exec bin/web_unicorn "$@"
;;
*)
echo "Unkown web server used by USE_WEB_SERVER: $USE_WEB_SERVER."
exit 1
;;
*)
echo "Unkown web server used by USE_WEB_SERVER: $USE_WEB_SERVER."
exit 1
;;
esac
......@@ -73,7 +73,7 @@ fi
# Switch to the gitlab path, exit on failure.
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
if [ -z "$SIDEKIQ_WORKERS" ]; then
......@@ -341,7 +341,7 @@ start_gitlab() {
echo "Gitaly is already running with pid $gapid, not restarting"
else
$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
......@@ -413,39 +413,39 @@ print_status() {
return
fi
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
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
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
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
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
printf "The GitLab Workhorse is \033[31mnot running\033[0m.\n"
printf "The GitLab Workhorse is \033[31mnot running\033[0m.\n"
fi
if [ "$mail_room_enabled" = true ]; 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
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
if [ "$gitlab_pages_enabled" = true ]; 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
printf "The GitLab Pages is \033[31mnot running\033[0m.\n"
printf "The GitLab Pages is \033[31mnot running\033[0m.\n"
fi
fi
if [ "$gitaly_enabled" = true ]; then
if [ "$gitaly_status" = "0" ]; then
echo "Gitaly with pid $gapid is running."
echo "Gitaly with pid $gapid is running."
else
printf "Gitaly is \033[31mnot running\033[0m.\n"
printf "Gitaly is \033[31mnot running\033[0m.\n"
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
......@@ -490,25 +490,25 @@ restart_gitlab(){
case "$1" in
start)
start_gitlab
;;
start_gitlab
;;
stop)
stop_gitlab
;;
stop_gitlab
;;
restart)
restart_gitlab
;;
restart_gitlab
;;
reload|force-reload)
reload_gitlab
;;
reload_gitlab
;;
status)
print_status
exit $gitlab_status
;;
print_status
exit $gitlab_status
;;
*)
echo "Usage: service gitlab {start|stop|restart|reload|status}"
exit 1
;;
echo "Usage: service gitlab {start|stop|restart|reload|status}"
exit 1
;;
esac
exit
......@@ -2,7 +2,7 @@
gemfile_lock_changed() {
if [ -n "$(git diff --name-only -- Gemfile.lock)" ]; then
cat << EOF
cat <<EOF
Gemfile was updated but Gemfile.lock was not updated.
Usually, when Gemfile is updated, you should run
......
......@@ -6,7 +6,7 @@ lint_paths="changelogs/unreleased"
invalid_files=$(find $lint_paths -type f -not -name "*.yml" -not -name ".gitkeep")
if [ -n "$invalid_files" ]; then
echo "Changelog files must end in .yml, but these did not:"
echo "$invalid_files" | sed -e "s/^/* /"
echo "Changelog files must end in .yml, but these did not:"
echo "$invalid_files" | sed -e "s/^/* /"
exit 1
fi
......@@ -7,56 +7,56 @@ set -e
if [[ "$MERGE_TRAIN_TRIGGER_TOKEN" == '' ]]
then
echo 'The variable MERGE_TRAIN_TRIGGER_TOKEN must be set to a non-empty value'
exit 1
echo 'The variable MERGE_TRAIN_TRIGGER_TOKEN must be set to a non-empty value'
exit 1
fi
if [[ "$MERGE_TRAIN_TRIGGER_URL" == '' ]]
then
echo 'The variable MERGE_TRAIN_TRIGGER_URL must be set to a non-empty value'
exit 1
echo 'The variable MERGE_TRAIN_TRIGGER_URL must be set to a non-empty value'
exit 1
fi
if [[ "$CI_COMMIT_REF_NAME" == '' ]]
then
echo 'The variable CI_COMMIT_REF_NAME must be set to a non-empty value'
exit 1
echo 'The variable CI_COMMIT_REF_NAME must be set to a non-empty value'
exit 1
fi
if [[ "$SOURCE_PROJECT" == '' ]]
then
echo 'The variable SOURCE_PROJECT must be set to a non-empty value'
exit 1
echo 'The variable SOURCE_PROJECT must be set to a non-empty value'
exit 1
fi
if [[ "$TARGET_PROJECT" == '' ]]
then
echo 'The variable TARGET_PROJECT must be set to a non-empty value'
exit 1
echo 'The variable TARGET_PROJECT must be set to a non-empty value'
exit 1
fi
if [[ "$TARGET_PROJECT" != "gitlab-org/gitlab-foss" ]]
then
echo 'This is a security FOSS merge train'
echo "Checking if $CI_COMMIT_SHA is available on canonical"
echo 'This is a security FOSS merge train'
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" ]]
then
echo 'Commit available on canonical, skipping merge train'
exit 0
fi
if [[ "$gitlab_com_commit_status" != "null" ]]
then
echo 'Commit available on canonical, skipping merge train'
exit 0
fi
echo 'Commit not available, triggering a merge train'
echo 'Commit not available, triggering a merge train'
fi
curl -X POST \
-F token="$MERGE_TRAIN_TRIGGER_TOKEN" \
-F ref=master \
-F "variables[MERGE_FOSS]=1" \
-F "variables[SOURCE_BRANCH]=$CI_COMMIT_REF_NAME" \
-F "variables[TARGET_BRANCH]=${CI_COMMIT_REF_NAME/-ee/}" \
-F "variables[SOURCE_PROJECT]=$SOURCE_PROJECT" \
-F "variables[TARGET_PROJECT]=$TARGET_PROJECT" \
"$MERGE_TRAIN_TRIGGER_URL"
-F token="$MERGE_TRAIN_TRIGGER_TOKEN" \
-F ref=master \
-F "variables[MERGE_FOSS]=1" \
-F "variables[SOURCE_BRANCH]=$CI_COMMIT_REF_NAME" \
-F "variables[TARGET_BRANCH]=${CI_COMMIT_REF_NAME/-ee/}" \
-F "variables[SOURCE_PROJECT]=$SOURCE_PROJECT" \
-F "variables[TARGET_PROJECT]=$TARGET_PROJECT" \
"$MERGE_TRAIN_TRIGGER_URL"
function retry() {
if eval "$@"; then
return 0
fi
for i in 2 1; do
sleep 3s
echo "Retrying $i..."
if eval "$@"; then
return 0
return 0
fi
for i in 2 1; do
sleep 3s
echo "Retrying $i..."
if eval "$@"; then
return 0
fi
done
return 1
done
return 1
}
function setup_db_user_only() {
source scripts/create_postgres_user.sh
source scripts/create_postgres_user.sh
}
function setup_db() {
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 "setup_db_user_only"
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() {
......
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