Update gitlab token

This commit is contained in:
dvirlabs 2026-02-18 11:05:59 +02:00
parent fd817b5334
commit f367a0d032

View File

@ -33,6 +33,11 @@ deploy:
script: |- script: |-
set -euo pipefail 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 # Update values.yaml with the new tag using sed
sed -i "s/^ tag: .*/ tag: \"${TAG}\"/" "${VALUES_FILE}" sed -i "s/^ tag: .*/ tag: \"${TAG}\"/" "${VALUES_FILE}"
echo "Updated ${VALUES_FILE} with image.tag=${TAG}" echo "Updated ${VALUES_FILE} with image.tag=${TAG}"
@ -48,8 +53,13 @@ deploy:
git add "${VALUES_FILE}" git add "${VALUES_FILE}"
git commit -m "ci: bump image tag to ${TAG} [skip ci]" || echo "No changes to commit" 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" # Push using GITLAB_TOKEN (set as CI/CD variable)
git push origin "HEAD:${CI_COMMIT_REF_NAME}" || echo "Nothing to push" 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..." echo "Deploying with Helm..."
helm upgrade --install "${RELEASE}" "${CHART_PATH}" \ helm upgrade --install "${RELEASE}" "${CHART_PATH}" \