Skip to content

Instantly share code, notes, and snippets.

@zedtux
Created January 25, 2019 11:02
Show Gist options
  • Save zedtux/c28d660715d4a7f40bcf9f05a5b7e32d to your computer and use it in GitHub Desktop.
Save zedtux/c28d660715d4a7f40bcf9f05a5b7e32d to your computer and use it in GitHub Desktop.
Gitlab AutoDevOps create_secret function extract
function create_secret() {
echo "Create secret..."
if [[ "$CI_PROJECT_VISIBILITY" == "public" ]]; then
return
fi
kubectl create secret -n "$KUBE_NAMESPACE" \
docker-registry gitlab-registry \
--docker-server="$CI_REGISTRY" \
--docker-username="${CI_DEPLOY_USER:-$CI_REGISTRY_USER}" \
--docker-password="${CI_DEPLOY_PASSWORD:-$CI_REGISTRY_PASSWORD}" \
--docker-email="$GITLAB_USER_EMAIL" \
-o yaml --dry-run | kubectl replace -n "$KUBE_NAMESPACE" --force -f -
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment