From 4d865fba49bc0fdc6b76a428c5284957579b7910 Mon Sep 17 00:00:00 2001 From: Kanthi Subramanian Date: Mon, 22 Jul 2024 18:08:12 -0400 Subject: [PATCH] Added logic to replace docker build tag --- .github/workflows/docker-build.yml | 7 +++++++ .../docker/start-docker-compose.sh.template | 15 +++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 sink-connector-lightweight/docker/start-docker-compose.sh.template diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index fd3e12d91..fe9fdd500 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -101,6 +101,13 @@ jobs: run: | docker build . --file sink-connector-lightweight/Dockerfile --tag altinityinfra/clickhouse-sink-connector:${{ env.IMAGE_TAG }}-lt docker save altinityinfra/clickhouse-sink-connector:${{ env.IMAGE_TAG }}-lt | gzip > clickhouse-sink-connector_${{ env.IMAGE_TAG }}-lt.tar.gz + # use sed to replace the image tag in docker/start-docker-compose.sh.template and copy it over to start-docker-compose.sh + sed -i "s/IMAGE_TAG/${{ env.IMAGE_TAG }}-lt/g" sink-connector-lightweight/docker/start-docker-compose.sh.template + cp sink-connector-lightweight/docker/start-docker-compose.sh.template sink-connector-lightweight/docker/start-docker-compose.sh + # commit the file to git + git add sink-connector-lightweight/docker/start-docker-compose.sh + git commit -m "Update image tag in start-docker-compose.sh" + git push - name: Upload Docker tar (Lightweight) uses: actions/upload-artifact@v3 diff --git a/sink-connector-lightweight/docker/start-docker-compose.sh.template b/sink-connector-lightweight/docker/start-docker-compose.sh.template new file mode 100755 index 000000000..81e6fc33e --- /dev/null +++ b/sink-connector-lightweight/docker/start-docker-compose.sh.template @@ -0,0 +1,15 @@ +#!/bin/bash + + +if [ -z $1 ] +then + echo 'Using the latest tag for Sink connector' + export CLICKHOUSE_SINK_CONNECTOR_LT_IMAGE='altinityinfra/clickhouse-sink-connector:IMAGE_TAG' +else + export CLICKHOUSE_SINK_CONNECTOR_LT_IMAGE=$1 +fi + +./stop-docker-compose.sh +# Altinity sink images are tagged daily with this tag yyyy-mm-dd(2022-07-19) + +docker-compose -f docker-compose-mysql.yml up --remove-orphans --force-recreate --renew-anon-volumes