fix crons doesn't have proper commit (#3020)

* fix(action): probable image not correct tag issue

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>

* fix(ci): possible fix for cron image update

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>

---------

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
This commit is contained in:
Rajesh Rajendran 2025-02-10 15:51:29 +01:00 committed by GitHub
parent eed357a79b
commit 1799f9d4a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 23 deletions

View file

@ -123,8 +123,9 @@ jobs:
tag: ${IMAGE_TAG} tag: ${IMAGE_TAG}
EOF EOF
export IMAGE_TAG=${IMAGE_TAG}
# Update changed image tag # Update changed image tag
sed -i "/assist-stats/{n;n;n;s/.*/ tag: ${IMAGE_TAG}/}" /tmp/image_override.yaml yq '.utilities.apiCrons.assiststats.image.tag = strenv(IMAGE_TAG)' -i /tmp/image_override.yaml
cat /tmp/image_override.yaml cat /tmp/image_override.yaml
# Deploy command # Deploy command

View file

@ -100,33 +100,32 @@ jobs:
docker push $DOCKER_REPO/$image:$IMAGE_TAG docker push $DOCKER_REPO/$image:$IMAGE_TAG
done done
- name: Creating old image input - name: Creating old image input
env:
# We're not passing -ee flag, because helm will add that.
IMAGE_TAG: ${{ github.ref_name }}_${{ github.sha }}
run: | run: |
# cd scripts/helmcharts/
# Create yaml with existing image tags cat <<EOF>/tmp/image_override.yaml
# image: &image
kubectl get pods -n app -o jsonpath="{.items[*].spec.containers[*].image}" |\ tag: "${IMAGE_TAG}"
tr -s '[[:space:]]' '\n' | sort | uniq -c | grep '/foss/' | cut -d '/' -f3 > /tmp/image_tag.txt utilities:
apiCrons:
echo > /tmp/image_override.yaml assiststats:
image: *image
for line in `cat /tmp/image_tag.txt`; report:
do image: *image
image_array=($(echo "$line" | tr ':' '\n')) sessionsCleaner:
cat <<EOF >> /tmp/image_override.yaml image: *image
${image_array[0]}: projectsStats:
image: image: *image
# We've to strip off the -ee, as helm will append it. fixProjectsStats:
tag: `echo ${image_array[1]} | cut -d '-' -f 1` image: *image
EOF EOF
done
- name: Deploy to kubernetes - name: Deploy to kubernetes
run: | run: |
cd scripts/helmcharts/ cd scripts/helmcharts/
# Update changed image tag
sed -i "/crons/{n;n;n;s/.*/ tag: ${IMAGE_TAG}/}" /tmp/image_override.yaml
cat /tmp/image_override.yaml cat /tmp/image_override.yaml
# Deploy command # Deploy command
mkdir -p /tmp/charts mkdir -p /tmp/charts
@ -136,8 +135,6 @@ jobs:
helm template openreplay -n app openreplay -f vars.yaml -f /tmp/image_override.yaml --set ingress-nginx.enabled=false --set skipMigration=true --no-hooks --kube-version=$k_version | kubectl apply -f - helm template openreplay -n app openreplay -f vars.yaml -f /tmp/image_override.yaml --set ingress-nginx.enabled=false --set skipMigration=true --no-hooks --kube-version=$k_version | kubectl apply -f -
env: env:
DOCKER_REPO: ${{ secrets.EE_REGISTRY_URL }} DOCKER_REPO: ${{ secrets.EE_REGISTRY_URL }}
# We're not passing -ee flag, because helm will add that.
IMAGE_TAG: ${{ github.ref_name }}_${{ github.sha }}
ENVIRONMENT: staging ENVIRONMENT: staging
- name: Alert slack - name: Alert slack