migration 641 Bytes
Newer Older
Emanuel Calvo's avatar
Emanuel Calvo committed
1
#!/bin/bash
Emanuel Calvo's avatar
Emanuel Calvo committed
2
set -eu
Emanuel Calvo's avatar
Emanuel Calvo committed
3
4
5

[[ $# -lt 1 ]] && { echo "Specify the environment"; exit 1 ; }

Emanuel Calvo's avatar
Emanuel Calvo committed
6
7
# Because some of the script use one or another, we clone both,
# although we need to homogenize 
8
export ENVIRONMENT=$1
Emanuel Calvo's avatar
Emanuel Calvo committed
9
export GITLAB_ENV=$ENVIRONMENT
Emanuel Calvo's avatar
Emanuel Calvo committed
10

Emanuel Calvo's avatar
Emanuel Calvo committed
11
source .env_${ENVIRONMENT} # That is, .env_staging or .env_production (test also supported)
Emanuel Calvo's avatar
Emanuel Calvo committed
12
13
source utilities
source steps_${ENVIRONMENT}
Matteo Melli's avatar
Matteo Melli committed
14
15
16
17
18
19
20
21
22
23

#Check all steps have a script
for step in "${steps[@]}"
do
  if ! type "$(step_script "$step")" > /dev/null 2>&1
  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
24
25
26
27
28
29

echo "menu"
do_menu