Skip to content

Commit

Permalink
Merge pull request #786 from Altinity/update_docker_compose_start
Browse files Browse the repository at this point in the history
Added logic to get latest release from github
  • Loading branch information
subkanthi authored Sep 4, 2024
2 parents b88a562 + 002cb0b commit 8ddd375
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
31 changes: 31 additions & 0 deletions sink-connector-lightweight/docker/getLatestRelease.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Replace with your GitHub repository (e.g., user/repo)
REPO="altinity/clickhouse-sink-connector"

# Fetch the latest release from GitHub API
latest_release=$(curl -s https://api.github.com/repos/$REPO/releases/latest)

# Also get the date of the latest release
latest_release_date=$(echo $latest_release | jq -r '.published_at')

# Extract the tag name (version) from the JSON response
latest_version=$(echo $latest_release | jq -r '.tag_name')


echo "****************************************************************************************************"
# Display a message to the usage of the latest_version in color green
echo -e "\e[32mThe latest release is: $latest_version published on: $latest_release_date\e[0m"
# echo that the enviroment variable CLICKHOUSE_SINK_CONNECTOR_LT_IMAGE will be
# set to the latest version
echo "Setting CLICKHOUSE_SINK_CONNECTOR_LT_IMAGE to the latest version"
# Display a message to the usage of the latest_version in color green
echo -e "\e[32mCLICKHOUSE_SINK_CONNECTOR_LT_IMAGE=altinity/clickhouse-sink-connector:$latest_version-lt'\e[0m"

#export CLICKHOUSE_SINK_CONNECTOR_LT_IMAGE='altinity/clickhouse-sink-connector:'$latest_version-lt
export CLICKHOUSE_SINK_CONNECTOR_LT_IMAGE='altinity/clickhouse-sink-connector:'$latest_version-lt

#echo run docker-compose up to start sink connector in green
echo "\e[32mRun docker-compose up to start sink connector\e[0m"
#Add stars
echo "****************************************************************************************************"
33 changes: 29 additions & 4 deletions sink-connector-lightweight/docker/start-docker-compose.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
#!/bin/bash


# Replace with your GitHub repository (e.g., user/repo)
REPO="altinity/clickhouse-sink-connector"

# Fetch the latest release from GitHub API
latest_release=$(curl -s https://api.github.com/repos/$REPO/releases/latest)

# Also get the date of the latest release
latest_release_date=$(echo $latest_release | jq -r '.published_at')

# Extract the tag name (version) from the JSON response
latest_version=$(echo $latest_release | jq -r '.tag_name')


echo "****************************************************************************************************"
# Display a message to the usage of the latest_version in color green
echo -e "\e[32mThe latest release is: $latest_version published on: $latest_release_date\e[0m"
# echo that the enviroment variable CLICKHOUSE_SINK_CONNECTOR_LT_IMAGE will be
# set to the latest version
echo "Setting CLICKHOUSE_SINK_CONNECTOR_LT_IMAGE to the latest version"
# Display a message to the usage of the latest_version in color green
echo -e "\e[32mCLICKHOUSE_SINK_CONNECTOR_LT_IMAGE=altinity/clickhouse-sink-connector:$latest_version-lt'\e[0m"

#Add stars
echo "****************************************************************************************************"
sleep 5
if [ -z $1 ]
then
echo 'Using the latest tag for Sink connector'
export CLICKHOUSE_SINK_CONNECTOR_LT_IMAGE='altinityinfra/clickhouse-sink-connector:408-97b1d3d83ef93c1b76a2b1c4d9c544dc67fbbec3'
#echo 'Using the latest tag for Sink connector'
export CLICKHOUSE_SINK_CONNECTOR_LT_IMAGE='altinity/clickhouse-sink-connector:'$latest_version-lt
else
export CLICKHOUSE_SINK_CONNECTOR_LT_IMAGE=$1
fi

./stop-docker-compose.sh
#./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
docker-compose up --renew-anon-volumes

0 comments on commit 8ddd375

Please sign in to comment.