Commit 60984d7a authored by Clement Bois's avatar Clement Bois
Browse files

fix: remove color variables

parent 42ca2cc6
Loading
Loading
Loading
Loading
+14 −27
Original line number Diff line number Diff line
@@ -36,15 +36,8 @@ workflow:
    - when: always

variables:
  # Color code for traces
  COLOR_GREEN: "\e[1;32m"
  COLOR_RED: "\e[1;31m"
  COLOR_BLUE: "\e[1;34m"
  COLOR_NONE: "\e[0m"
  COLOR_YELLOW: "\e[1;33m"
  
  # variabilized tracking image
  TBC_TRACKING_IMAGE: "$CI_REGISTRY/to-be-continuous/tools/tracking:master"
  TBC_TRACKING_IMAGE: "registry.gitlab.com/to-be-continuous/tools/tracking:master"

  # Docker Image with CF CLI tool (can be overridden)
  CF_CLI_IMAGE: "registry.hub.docker.com/governmentpaas/cf-cli"
@@ -671,14 +664,8 @@ stages:
    pre_delete

    # delete app
    tobesearched="/^${appname}\$/p"
    sfound=$(cf apps | sed -e 1,3d | cut -d " " -f 1 | sed -ne "${tobesearched}")
    if [[ -z "$sfound" ]]; then
      log_info "--- nothing to delete"
    else
    log_info "--- \\e[32mcf delete\\e[0m"
    cf delete "$appname" -f -r
    fi

    post_delete
  }
@@ -769,7 +756,7 @@ stages:
      if [[ "${notnull}" == "true" ]]; then
   	    desc_field_error="${2} should not be null: creation aborted"
        if [[ -n "$desc_field_error" ]]; then
          log_info "${smsg}${COLOR_RED}KO - skipped${COLOR_NONE} (${COLOR_BLUE}${desc_field_error}${COLOR_NONE})"
          log_error "${smsg}KO - skipped (${desc_field_error})"
          manage_services_errors=$((manage_services_errors+1))
          return
        fi
@@ -814,12 +801,12 @@ stages:
    mandatory=("true" "true" "true" "false" "false")
    fvalues=("" "" "" "" "")
    service_desc=$1
    smsg="Create service instance ${COLOR_YELLOW}${service_desc}${COLOR_NONE}: "
    smsg="Create service instance ${service_desc}: "
    for fi in "${!fields[@]}"
    do
      get_desc_field "${service_desc}" "${fields[fi]}" "${mandatory[fi]}"
      fvalues[fi]=$(echo "${desc_field}" | tr -d '\r' | envsubst)
      log_info "--- ${fields[fi]}: ${COLOR_YELLOW}${fvalues[fi]}${COLOR_NONE}"
      log_info "--- ${fields[fi]}: ${fvalues[fi]}"
    done
    log_info "${smsg}service definition OK - proceed"
    tobesearched="/^${fvalues[0]}\$/p"
@@ -847,9 +834,9 @@ stages:
        fi
      fi
      rm -f "${argfile}"
      log_info "${COLOR_GREEN}... created${COLOR_NONE}"
      log_info "... created"
    else
      log_info "${COLOR_BLUE}... service instance \"${fvalues[0]}\" already exist - skipped${COLOR_NONE}"
      log_warn "... service instance \"${fvalues[0]}\" already exist - skipped"
    fi
  }

@@ -857,26 +844,26 @@ stages:
    service_desc=$1
    case ${ENV_TYPE} in
    staging | production)
      log_info "Delete service instance ${COLOR_YELLOW}${service_desc}${COLOR_NONE}: ignored (env=${ENV_TYPE})"
      log_info "Delete service instance ${service_desc}: ignored (env=${ENV_TYPE})"
      ;;
    *)
      smsg="Delete service instance ${COLOR_YELLOW}${service_desc}${COLOR_NONE}: "
      smsg="Delete service instance ${service_desc}: "
      get_desc_field "${service_desc}" "cfServiceName" "true"
      if [[ -n "${desc_field_error}" ]]; then
        log_info "${smsg}${COLOR_RED}KO - skipped${COLOR_NONE} (${COLOR_BLUE}${desc_field_error}${COLOR_NONE})"
        log_error "${smsg}KO - skipped (${desc_field_error})"
        manage_services_errors=$((manage_services_errors+1))
        return
      fi
      name=$(echo "${desc_field}" | tr -d '\r')
      log_info "${smsg}service definition OK - proceed"
      log_info "--- cfServiceName: ${COLOR_YELLOW}${name}${COLOR_NONE}"
      log_info "--- cfServiceName: ${name}"
      tobesearched="/^${name}\$/p"
      sfound=$(cf services | sed -e 1,3d | cut -d " " -f 1 | sed -ne "${tobesearched}")
      if [[ -z "${sfound}" ]]; then
        log_info "${COLOR_BLUE}.... service instance \"${name}\" does not exist - skipped${COLOR_NONE}"
        log_warn ".... service instance \"${name}\" does not exist - skipped"
      else
        cf delete-service "${name}" -f >/dev/null
        log_info "${COLOR_GREEN}.... deleted${COLOR_NONE}"
        log_info ".... deleted"
      fi
      ;;
    esac