Update the token
This commit is contained in:
parent
5dab10b843
commit
b1d56d1cb7
@ -34,7 +34,7 @@ deploy:
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Configure kubectl for k3s cluster
|
# Configure kubectl for k3s cluster
|
||||||
export KUBECONFIG=/tmp/k3s.yaml
|
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
|
||||||
echo "Configured kubectl to use k3s cluster"
|
echo "Configured kubectl to use k3s cluster"
|
||||||
kubectl cluster-info || echo "Warning: Could not connect to cluster yet"
|
kubectl cluster-info || echo "Warning: Could not connect to cluster yet"
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ deploy:
|
|||||||
echo "Updated ${VALUES_FILE} with image.tag=${TAG}"
|
echo "Updated ${VALUES_FILE} with image.tag=${TAG}"
|
||||||
|
|
||||||
# Verify the change
|
# Verify the change
|
||||||
grep -A 1 "^image:" "${VALUES_FILE}"
|
grep -A 2 "^image:" "${VALUES_FILE}"
|
||||||
|
|
||||||
# Configure git identity
|
# Configure git identity
|
||||||
git config user.email "gitlab-ci@dvirlabs.com"
|
git config user.email "gitlab-ci@dvirlabs.com"
|
||||||
@ -53,20 +53,33 @@ 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"
|
||||||
|
|
||||||
# Push using GITLAB_TOKEN (set as CI/CD variable)
|
# Push using GITLAB_TOKEN (Project Access Token with api scope)
|
||||||
if [ -n "${GITLAB_TOKEN:-}" ]; then
|
if [ -n "${GITLAB_TOKEN:-}" ]; then
|
||||||
git remote set-url origin "https://oauth2:${GITLAB_TOKEN}@${CI_SERVER_HOST#https://}/${CI_PROJECT_PATH}.git"
|
git remote set-url origin "https://oauth2:${GITLAB_TOKEN}@gitlab.com/${CI_PROJECT_PATH}.git"
|
||||||
git push origin "HEAD:${CI_COMMIT_REF_NAME}" && echo "Pushed values.yaml update" || echo "Failed to push, continuing anyway"
|
git push origin "HEAD:${CI_COMMIT_REF_NAME}" && echo "Pushed values.yaml update successfully" || echo "Failed to push, continuing deployment anyway"
|
||||||
else
|
else
|
||||||
echo "GITLAB_TOKEN not set, skipping git push (values.yaml updated in workspace)"
|
echo "GITLAB_TOKEN not set, skipping git push (values.yaml is updated locally for this deployment)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Create namespace if it doesn't exist
|
||||||
|
kubectl create namespace "${NAMESPACE}" --dry-run=client -o yaml | kubectl apply -f -
|
||||||
|
|
||||||
|
# Create or update GitLab registry secret for pulling images
|
||||||
|
echo "Creating/updating image pull secret..."
|
||||||
|
kubectl create secret docker-registry gitlab-registry \
|
||||||
|
--docker-server="${CI_REGISTRY}" \
|
||||||
|
--docker-username="${CI_REGISTRY_USER}" \
|
||||||
|
--docker-password="${CI_REGISTRY_PASSWORD}" \
|
||||||
|
--namespace="${NAMESPACE}" \
|
||||||
|
--dry-run=client -o yaml | kubectl apply -f -
|
||||||
|
|
||||||
echo "Deploying with Helm..."
|
echo "Deploying with Helm..."
|
||||||
helm upgrade --install "${RELEASE}" "${CHART_PATH}" \
|
helm upgrade --install "${RELEASE}" "${CHART_PATH}" \
|
||||||
-f "${VALUES_FILE}" \
|
-f "${VALUES_FILE}" \
|
||||||
-n "${NAMESPACE}" \
|
-n "${NAMESPACE}" \
|
||||||
--create-namespace \
|
--create-namespace \
|
||||||
--wait --timeout 5m
|
--wait --timeout 10m \
|
||||||
|
--debug
|
||||||
|
|
||||||
echo "Waiting for deployment to be ready..."
|
echo "Waiting for deployment to be ready..."
|
||||||
kubectl -n "${NAMESPACE}" rollout status deploy -l app.kubernetes.io/name=open-meteo-service --timeout=180s
|
kubectl -n "${NAMESPACE}" rollout status deploy -l app.kubernetes.io/name=open-meteo-service --timeout=180s
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user