-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
@kfox1111 I think there is a "chicken and egg" issue to work out here. This block seems to fail if the secret doesn't already exist:
Current Code
Lines 123 to 124 in 9db5170
| SECRET_NAME="${SECRET_NAME:-gitlab-registry-token}" | |
| kubectl get secret "$SECRET_NAME" || kubectl create secret docker-registry "$SECRET_NAME" --docker-server="$CI_REGISTRY" --docker-username="$CI_DEPLOY_USER" --docker-password="$CI_DEPLOY_PASSWORD" --docker-email=gitab@blackhole.com |
Current Output
$ SECRET_NAME="${SECRET_NAME:-gitlab-registry-token}" # collapsed multi-line command
Error from server (NotFound): secrets "config-editor-deploy-token" not found
error: flag docker-username is required
See 'kubectl create secret docker-registry -h' for help and examples
Proposed Solution
I would propose something more like:
script:
- |
SECRET_NAME="${SECRET_NAME:-gitlab-registry-token}"
kubectl create secret docker-registry "$SECRET_NAME" --docker-server="$CI_REGISTRY" --docker-username="$CI_DEPLOY_USER" --docker-password="$CI_DEPLOY_PASSWORD" --docker-email=gitab@blackhole.com --dry-run -o yaml | kubectl apply -f -Metadata
Metadata
Assignees
Labels
No labels