Commit b9729cf3 authored by Alexis Deruelle's avatar Alexis Deruelle
Browse files

fix: plug preinit.sh for tf-validate job

parent f5097c28
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -674,6 +674,17 @@ stages:
    return $?
  }

  tf_pre_init() {
    # maybe execute pre init script
    prescript="$TF_SCRIPTS_DIR/tf-pre-init.sh"
    if [[ -f "$prescript" ]]; then
      log_info "--- \\e[32mpre-init\\e[0m hook (\\e[33;1m${prescript}\\e[0m) found: execute"
      exec_hook "$prescript"
    else
      log_info "--- \\e[32mpre-init\\e[0m hook (\\e[33;1m${prescript}\\e[0m) not found: skip"
    fi
  }

  function tf_init() {
    opts=${ENV_INIT_OPTS:-$TF_INIT_OPTS}
    extra_opts=${ENV_EXTRA_OPTS:-$TF_EXTRA_OPTS}
@@ -715,13 +726,7 @@ stages:
    terraform --version

    # maybe execute pre init script
    prescript="$TF_SCRIPTS_DIR/tf-pre-init.sh"
    if [[ -f "$prescript" ]]; then
      log_info "--- \\e[32mpre-init\\e[0m hook (\\e[33;1m${prescript}\\e[0m) found: execute"
      exec_hook "$prescript"
    else
      log_info "--- \\e[32mpre-init\\e[0m hook (\\e[33;1m${prescript}\\e[0m) not found: skip"
    fi
    tf_pre_init

    if [[ "$TF_GITLAB_BACKEND_DISABLED" != "true" ]]
    then
@@ -1148,6 +1153,7 @@ tf-validate:
  stage: test
  needs: []
  script:
    - tf_pre_init
    - terraform init -backend=false
    - terraform validate
  dependencies: []