Commit 7f67dca8 authored by Hordur Freyr Yngvason's avatar Hordur Freyr Yngvason
Browse files

Merge branch...

Merge branch '191-ci-cd-tunnel-based-deploy-fails-with-current-context-must-exist-in-order-to-minify' into 'master'

Resolve "CI/CD tunnel based deploy fails with: current-context must exist in order to minify"

See merge request gitlab-org/cluster-integration/auto-deploy-image!243
parents 191aac4e 1a6cdc85
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -34,6 +34,24 @@
          echo "Failed as expected and exited with $?"
        }

test-use-kube-context:
  <<: *test-job
  variables:
    KUBE_CONTEXT: default
  script:
    # This test that any function will be properly
    # loaded. Even when calling `kubectl config --minify`
    # without a current context pre-setup
    - kubectl config unset current-context
    - kubectl config get-contexts
    - auto-deploy use_kube_context
    - context=$(kubectl config current-context)
    - |
      if [[ "$context" != "default" ]]; then
        echo "Failed to assign context"
        exit 1
      fi

test-dependencies:
  <<: *test-job
  variables:
+2 −6
Original line number Diff line number Diff line
@@ -13,12 +13,8 @@ export ASSETS_CHART_DIR="${ASSETS_DIR}/auto-deploy-app"
export ROLLOUT_RESOURCE_TYPE="${ROLLOUT_RESOURCE_TYPE:-deployment}"

if [[ -z "$KUBE_NAMESPACE" ]]; then
  context_namespace=$(kubectl config view --minify -o jsonpath='{..namespace}')
  if [[ -n "$context_namespace" ]]; then
    export KUBE_NAMESPACE="$context_namespace"
  else
    export KUBE_NAMESPACE='default'
  fi
  context_namespace=$(kubectl config view --minify -o jsonpath='{..namespace}' 2>/dev/null || true)
  export KUBE_NAMESPACE="${context_namespace:-"default"}"
fi

function use_kube_context() {