migration 745 Bytes
Newer Older
Emanuel Calvo's avatar
Emanuel Calvo committed
1
#!/bin/bash
Matteo Melli's avatar
Matteo Melli committed
2

Emanuel Calvo's avatar
Emanuel Calvo committed
3
set -eu
Emanuel Calvo's avatar
Emanuel Calvo committed
4

5
[[ $# -lt 2 ]] && { echo "Specify the environment and role"; exit 1 ; }
Emanuel Calvo's avatar
Emanuel Calvo committed
6

Emanuel Calvo's avatar
Emanuel Calvo committed
7
# Because some of the script use one or another, we clone both,
8 9
# although we need to homogenize
export BASE="$(dirname "$0")" 
10
export ENVIRONMENT=$1
11
export ROLE=$2
Emanuel Calvo's avatar
Emanuel Calvo committed
12
export GITLAB_ENV=$ENVIRONMENT
Emanuel Calvo's avatar
Emanuel Calvo committed
13

14
# shellcheck source=/dev/null
15 16
source "${BASE}/source_vars"
source "${BASE}/env_${ENVIRONMENT}" # That is, .env_staging or .env_production (test also supported)
17
source "${BASE}/migration_utilities"
18
source "${BASE}/steps_${ROLE}"
Matteo Melli's avatar
Matteo Melli committed
19 20 21 22

#Check all steps have a script
for step in "${steps[@]}"
do
23
  if ! step_check "$step"
Matteo Melli's avatar
Matteo Melli committed
24 25 26 27 28
  then
    >&2 echo "Function $(step_script "$step") do not exists for step $(step_3digit_number "$step")"
    exit 1
  fi
done
Emanuel Calvo's avatar
Emanuel Calvo committed
29 30 31

do_menu