From f367a0d0325d2ea91befa4b06fce765e1da67618 Mon Sep 17 00:00:00 2001 From: dvirlabs Date: Wed, 18 Feb 2026 11:05:59 +0200 Subject: [PATCH] Update gitlab token --- .gitlab-ci.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 824910b..5fe0a86 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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}" \