Skip to content

Commit 1bd3a35

Browse files
authored
Merge pull request #699 from Altinity/repo-sanity-checks
Repo Sanity Checks Workflow
2 parents 2b9ed27 + 365e061 commit 1bd3a35

File tree

1 file changed

+150
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)