CI/CD tunnel based deploy fails with: current-context must exist in order to minify
Problem
When using the CI/CD Tunnel, auto-deploy will fail with the message
$ auto-deploy check_kube_domain
error: current-context must exist in order to minify
The problem is that when check_kube_domain
is called, the src/bin/auto-deploy
file is loaded and it does not yet has a current-context setup. Although, the kubectl config view --minify
command, which is run while the file is being loaded, needs a context. So, context setting needs to happen before we get to this line. This happens here:
Reproduce the problem locally
λ kubectl config unset current-context
Property "current-context" unset.
λ kubectl config current-context
error: current-context is not set
λ kubectl config view --minify -o jsonpath='{..namespace}'
error: current-context must exist in order to minify
Proposal
Simply calling use_kube_context
logic before check_kube_domain
won't work, as it will face the same problem. We really need to call use_kube_context
before calling kubectl config view --minify
.
Edited by João Alexandre Cunha