Update gitlab token
This commit is contained in:
parent
fd817b5334
commit
f367a0d032
@ -33,6 +33,11 @@ deploy:
|
||||
script: |-
|
||||
set -euo pipefail
|
||||
|
||||
# Configure kubectl for k3s cluster
|
||||
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
|
||||
echo "Configured kubectl to use k3s cluster"
|
||||
kubectl cluster-info || echo "Warning: Could not connect to cluster yet"
|
||||
|
||||
# Update values.yaml with the new tag using sed
|
||||
sed -i "s/^ tag: .*/ tag: \"${TAG}\"/" "${VALUES_FILE}"
|
||||
echo "Updated ${VALUES_FILE} with image.tag=${TAG}"
|
||||
@ -48,8 +53,13 @@ deploy:
|
||||
git add "${VALUES_FILE}"
|
||||
git commit -m "ci: bump image tag to ${TAG} [skip ci]" || echo "No changes to commit"
|
||||
|
||||
git remote set-url origin "https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
|
||||
git push origin "HEAD:${CI_COMMIT_REF_NAME}" || echo "Nothing to push"
|
||||
# Push using GITLAB_TOKEN (set as CI/CD variable)
|
||||
if [ -n "${GITLAB_TOKEN:-}" ]; then
|
||||
git remote set-url origin "https://oauth2:${GITLAB_TOKEN}@${CI_SERVER_HOST#https://}/${CI_PROJECT_PATH}.git"
|
||||
git push origin "HEAD:${CI_COMMIT_REF_NAME}" && echo "Pushed values.yaml update" || echo "Failed to push, continuing anyway"
|
||||
else
|
||||
echo "GITLAB_TOKEN not set, skipping git push (values.yaml updated in workspace)"
|
||||
fi
|
||||
|
||||
echo "Deploying with Helm..."
|
||||
helm upgrade --install "${RELEASE}" "${CHART_PATH}" \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user