Set the VALUES_FILE env
This commit is contained in:
parent
cbefc54227
commit
fd817b5334
@ -7,7 +7,6 @@ variables:
|
|||||||
NAMESPACE: "sandbox-gitlab"
|
NAMESPACE: "sandbox-gitlab"
|
||||||
CHART_PATH: "./open-meteo-service"
|
CHART_PATH: "./open-meteo-service"
|
||||||
VALUES_FILE: "./values.yaml"
|
VALUES_FILE: "./values.yaml"
|
||||||
SERVICE_NAME: "open-meteo-service-open-meteo-service" # <-- אם אצלך שם אחר, תשנה פה
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
@ -34,17 +33,13 @@ deploy:
|
|||||||
script: |-
|
script: |-
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Install yq if missing
|
# Update values.yaml with the new tag using sed
|
||||||
if ! command -v yq >/dev/null 2>&1; then
|
sed -i "s/^ tag: .*/ tag: \"${TAG}\"/" "${VALUES_FILE}"
|
||||||
YQ_VERSION="v4.35.1"
|
|
||||||
wget -qO /usr/bin/yq "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64"
|
|
||||||
chmod +x /usr/bin/yq
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Update values.yaml with the new tag
|
|
||||||
/tmp/yq e ".image.tag = \"${TAG}\"" -i "${VALUES_FILE}"
|
|
||||||
echo "Updated ${VALUES_FILE} with image.tag=${TAG}"
|
echo "Updated ${VALUES_FILE} with image.tag=${TAG}"
|
||||||
|
|
||||||
|
# Verify the change
|
||||||
|
grep -A 1 "^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"
|
||||||
git config user.name "GitLab CI"
|
git config user.name "GitLab CI"
|
||||||
@ -58,6 +53,7 @@ deploy:
|
|||||||
|
|
||||||
echo "Deploying with Helm..."
|
echo "Deploying with Helm..."
|
||||||
helm upgrade --install "${RELEASE}" "${CHART_PATH}" \
|
helm upgrade --install "${RELEASE}" "${CHART_PATH}" \
|
||||||
|
-f "${VALUES_FILE}" \
|
||||||
-n "${NAMESPACE}" \
|
-n "${NAMESPACE}" \
|
||||||
--create-namespace \
|
--create-namespace \
|
||||||
--wait --timeout 5m
|
--wait --timeout 5m
|
||||||
@ -66,6 +62,7 @@ deploy:
|
|||||||
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
|
||||||
|
|
||||||
echo "Port-forward for tests..."
|
echo "Port-forward for tests..."
|
||||||
|
SERVICE_NAME="${RELEASE}-open-meteo-service"
|
||||||
kubectl -n "${NAMESPACE}" port-forward "svc/${SERVICE_NAME}" 8000:8000 >/tmp/pf.log 2>&1 &
|
kubectl -n "${NAMESPACE}" port-forward "svc/${SERVICE_NAME}" 8000:8000 >/tmp/pf.log 2>&1 &
|
||||||
PF_PID=$!
|
PF_PID=$!
|
||||||
sleep 5
|
sleep 5
|
||||||
@ -90,4 +87,3 @@ deploy:
|
|||||||
|
|
||||||
kill $PF_PID || true
|
kill $PF_PID || true
|
||||||
echo "All tests passed!"
|
echo "All tests passed!"
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user