Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify management of ClickHouse versions #22

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- "22.3.20.29"
- "22.8.20.11"
- "23.3.8.21"
- "23.7.1.2470"
- "latest"
runs-on: ubuntu-${{ matrix.target.ubuntu }}
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export PYTHON?=python3
export PYTHONIOENCODING?=utf8
export NO_VENV?=
export COMPOSE_HTTP_TIMEOUT?=300
export CLICKHOUSE_VERSION?=23.3.7.5
export CLICKHOUSE_VERSION?=latest

ifndef NO_VENV
export PATH := venv/bin:${PATH}
Expand Down
20 changes: 14 additions & 6 deletions images/clickhouse/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ubuntu:bionic
ENV TZ=Europe/Moscow
ENV CH_TMP_DIR /var/tmp/ch-backup

ARG CLICKHOUSE_VERSION
ARG CLICKHOUSE_VERSION=latest

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
apt-get update -qq && \
Expand All @@ -15,7 +15,8 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone &
locales \
python3-pip \
openssh-server \
supervisor && \
supervisor \
less && \
pip3 install --upgrade pip && \
pip3 install kazoo && \
echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen && \
Expand All @@ -39,10 +40,17 @@ RUN cd ${CH_TMP_DIR} && \
mkdir -p /etc/apt/sources.list.d && \
echo "deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] https://packages.clickhouse.com/deb stable main" | tee /etc/apt/sources.list.d/clickhouse.list && \
apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
clickhouse-common-static=$CLICKHOUSE_VERSION \
clickhouse-server=$CLICKHOUSE_VERSION \
clickhouse-client=$CLICKHOUSE_VERSION && \
if [ "${CLICKHOUSE_VERSION}" = "latest" ]; then \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
clickhouse-server \
clickhouse-client \
clickhouse-common-static; \
else \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
clickhouse-server=${CLICKHOUSE_VERSION} \
clickhouse-client=${CLICKHOUSE_VERSION} \
clickhouse-common-static=${CLICKHOUSE_VERSION}; \
fi && \
rm -rf /var/lib/apt/lists/* /var/cache/debconf && \
apt-get clean

Expand Down
20 changes: 14 additions & 6 deletions images/clickhousenozk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ubuntu:bionic
ENV TZ=Europe/Moscow
ENV CH_TMP_DIR /var/tmp/ch-backup

ARG CLICKHOUSE_VERSION
ARG CLICKHOUSE_VERSION=latest

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
apt-get update -qq && \
Expand All @@ -15,7 +15,8 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone &
locales \
python3-pip \
openssh-server \
supervisor && \
supervisor \
less && \
pip3 install --upgrade pip && \
pip3 install kazoo && \
echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen && \
Expand All @@ -39,10 +40,17 @@ RUN cd ${CH_TMP_DIR} && \
mkdir -p /etc/apt/sources.list.d && \
echo "deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] https://packages.clickhouse.com/deb stable main" | tee /etc/apt/sources.list.d/clickhouse.list && \
apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
clickhouse-common-static=$CLICKHOUSE_VERSION \
clickhouse-server=$CLICKHOUSE_VERSION \
clickhouse-client=$CLICKHOUSE_VERSION && \
if [ "${CLICKHOUSE_VERSION}" = "latest" ]; then \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
clickhouse-server \
clickhouse-client \
clickhouse-common-static; \
else \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
clickhouse-server=${CLICKHOUSE_VERSION} \
clickhouse-client=${CLICKHOUSE_VERSION} \
clickhouse-common-static=${CLICKHOUSE_VERSION}; \
fi && \
rm -rf /var/lib/apt/lists/* /var/cache/debconf && \
apt-get clean

Expand Down
4 changes: 1 addition & 3 deletions tests/integration/features/metadata.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Feature: Metadata
Then metadata of clickhouse01 backup #0 contains
"""
version: {{ version }}
ch_version: {{ conf.ch_version }}
labels:
environment: testing
name: test_backup
Expand All @@ -41,6 +40,5 @@ Feature: Metadata
Then metadata of clickhouse01 backup #0 contains
"""
version: {{ version }}
ch_version: {{ conf.ch_version }}
schema_only: true
"""
"""
24 changes: 18 additions & 6 deletions tests/integration/modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,23 @@ def normalize_create_query(create_query):
return create_query


def version_ge(version1, version2):
"""Return True if version1 is greater or equal than version2, or False otherwise."""
return parse_version(version1) >= parse_version(version2) # type: ignore
def version_ge(current_version, comparing_version):
aalexfvk marked this conversation as resolved.
Show resolved Hide resolved
"""
Return True if `current_version` is greater or equal than `comparing_version`, or False otherwise.
"""
# "latest" is greater or equal than any known version
if current_version == "latest":
return True

return parse_version(current_version) >= parse_version(comparing_version) # type: ignore


def version_lt(version1, version2):
"""Return True if version1 is less than version2, or False otherwise."""
return parse_version(version1) < parse_version(version2) # type: ignore
def version_lt(current_version, comparing_version):
"""
Return True if `current_version` is less than `comparing_version`, or False otherwise.
"""
# "latest" is not less than any known version
if current_version == "latest":
return False

return parse_version(current_version) < parse_version(comparing_version) # type: ignore