Skip to content

Commit 9e1254a

Browse files
committed
repo sanity checks
1 parent e280e95 commit 9e1254a

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed
+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Repository Sanity Checks
2+
3+
on:
4+
workflow_dispatch: # Manual trigger only
5+
6+
jobs:
7+
sanity-checks:
8+
runs-on: [self-hosted, x86, type-cx42, image-x86-app-docker-ce]
9+
strategy:
10+
fail-fast: false # Continue with other combinations if one fails
11+
matrix:
12+
include:
13+
# Production packages
14+
- env: prod
15+
type: deb
16+
base: ubuntu:22.04
17+
repo_url: https://builds.altinity.cloud/apt-repo
18+
- env: prod
19+
type: rpm
20+
base: centos:8
21+
repo_url: https://builds.altinity.cloud/yum-repo
22+
# FIPS Production packages
23+
- env: prod-fips
24+
type: deb
25+
base: ubuntu:22.04
26+
repo_url: https://builds.altinity.cloud/fips-apt-repo
27+
- env: prod-fips
28+
type: rpm
29+
base: centos:8
30+
repo_url: https://builds.altinity.cloud/fips-yum-repo
31+
# Staging packages
32+
- env: staging
33+
type: deb
34+
base: ubuntu:22.04
35+
repo_url: https://builds.staging.altinity.cloud/apt-repo
36+
- env: staging
37+
type: rpm
38+
base: centos:8
39+
repo_url: https://builds.staging.altinity.cloud/yum-repo
40+
# FIPS Staging packages
41+
- env: staging-fips
42+
type: deb
43+
base: ubuntu:22.04
44+
repo_url: https://builds.staging.altinity.cloud/fips-apt-repo
45+
- env: staging-fips
46+
type: rpm
47+
base: centos:8
48+
repo_url: https://builds.staging.altinity.cloud/fips-yum-repo
49+
50+
steps:
51+
- name: Run sanity check
52+
run: |
53+
cat << 'EOF' > sanity.sh
54+
#!/bin/bash
55+
set -e -x
56+
57+
# Package installation commands based on type
58+
if [ "${{ matrix.type }}" = "deb" ]; then
59+
export DEBIAN_FRONTEND=noninteractive
60+
apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg2 dialog sudo
61+
mkdir -p /usr/share/keyrings
62+
curl -s "${REPO_URL}/pubkey.gpg" | gpg --dearmor > /usr/share/keyrings/altinity-archive-keyring.gpg
63+
echo "deb [signed-by=/usr/share/keyrings/altinity-archive-keyring.gpg] ${REPO_URL} stable main" > /etc/apt/sources.list.d/altinity.list
64+
apt-get update
65+
apt-get install -y clickhouse-server clickhouse-client
66+
else
67+
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
68+
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
69+
yum install -y curl gnupg2 sudo
70+
if [[ "${{ matrix.env }}" == *"staging"* ]]; then
71+
curl "${REPO_URL}/altinity-staging.repo" -o /etc/yum.repos.d/altinity-staging.repo
72+
else
73+
curl "${REPO_URL}/altinity.repo" -o /etc/yum.repos.d/altinity.repo
74+
fi
75+
yum install -y clickhouse-server clickhouse-client
76+
fi
77+
78+
# Ensure correct ownership
79+
chown -R clickhouse /var/lib/clickhouse/
80+
chown -R clickhouse /var/log/clickhouse-server/
81+
82+
# Check server version
83+
server_version=$(clickhouse-server --version)
84+
echo "$server_version" | grep "altinity" || FAILED_SERVER=true
85+
86+
# Start server and test
87+
sudo -u clickhouse clickhouse-server --config-file /etc/clickhouse-server/config.xml --daemon
88+
sleep 10
89+
clickhouse-client -q 'SELECT 1'
90+
91+
# Check client version
92+
client_version=$(clickhouse-client --version)
93+
echo "$client_version" | grep "altinity" || FAILED_CLIENT=true
94+
95+
# Report results
96+
if [ "$FAILED_SERVER" = true ]; then
97+
echo "::error::Server check failed - Version: $server_version"
98+
exit 1
99+
elif [ "$FAILED_CLIENT" = true ]; then
100+
echo "::error::Client check failed - Version: $client_version"
101+
exit 1
102+
else
103+
echo "All checks passed successfully!"
104+
fi
105+
EOF
106+
107+
chmod +x sanity.sh
108+
docker run --rm \
109+
-v $(pwd)/sanity.sh:/sanity.sh \
110+
-e REPO_URL="${{ matrix.repo_url }}" \
111+
${{ matrix.base }} \
112+
/sanity.sh

0 commit comments

Comments
 (0)