Skip to content

Commit 07232ea

Browse files
authored
Merge branch 'antalya' into feature/fix_rendezvous_hashing
2 parents 21250b5 + 033be68 commit 07232ea

File tree

27 files changed

+1507
-27
lines changed

27 files changed

+1507
-27
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: Republish Multiarch Docker Image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
docker_image:
7+
description: 'Multiarch Docker image with tag'
8+
required: true
9+
release_environment:
10+
description: 'Select release type: "staging" or "production"'
11+
type: choice
12+
default: 'staging'
13+
options:
14+
- staging
15+
- production
16+
upload_artifacts:
17+
description: 'Upload artifacts directly in this workflow'
18+
type: boolean
19+
default: true
20+
s3_upload_path:
21+
description: 'Upload artifacts to s3 path'
22+
type: string
23+
required: false
24+
workflow_call:
25+
inputs:
26+
docker_image:
27+
type: string
28+
required: true
29+
release_environment:
30+
type: string
31+
required: false
32+
default: 'staging'
33+
upload_artifacts:
34+
type: boolean
35+
required: false
36+
default: false
37+
s3_upload_path:
38+
type: string
39+
required: false
40+
outputs:
41+
image_archives_path:
42+
description: 'Path to the image archives directory'
43+
value: ${{ jobs.republish.outputs.image_archives_path }}
44+
45+
env:
46+
IMAGE: ${{ github.event.inputs.docker_image || inputs.docker_image }}
47+
48+
jobs:
49+
republish:
50+
runs-on: [self-hosted, altinity-on-demand, altinity-style-checker-aarch64]
51+
outputs:
52+
image_archives_path: ${{ steps.set_path.outputs.image_archives_path }}
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v3
56+
57+
- name: Docker Hub Login
58+
uses: docker/login-action@v2
59+
with:
60+
username: ${{ secrets.DOCKER_USERNAME }}
61+
password: ${{ secrets.DOCKER_PASSWORD }}
62+
63+
- name: Set clickhouse-server version as new tag
64+
run: |
65+
# Determine "clickhouse-server" or "clickhouse-keeper"
66+
echo "COMPONENT=$(echo "$IMAGE" | sed -E 's|.*/(clickhouse-[^:]+):.*|\1|')" >> $GITHUB_ENV
67+
echo "Component determined: $COMPONENT"
68+
69+
# Run the container to get the version
70+
CONTAINER_HASH=$(docker run -d --rm $IMAGE 2>&1)
71+
NEW_TAG=$(.github/retry.sh 30 10 docker exec $CONTAINER_HASH bash -c "$COMPONENT --version")
72+
echo "Base tag from clickhouse version: $NEW_TAG"
73+
74+
# Append "-prerelease" if necessary
75+
if [ "${{ github.event.inputs.release_type || inputs.release_type }}" = "staging" ]; then
76+
NEW_TAG="${BASE_TAG}-prerelease"
77+
fi
78+
79+
if [[ "$IMAGE" == *-alpine* ]]; then
80+
NEW_TAG="${NEW_TAG}-alpine"
81+
fi
82+
echo "New tag: $NEW_TAG"
83+
84+
# Export the new tag
85+
echo "new_tag=$NEW_TAG" >> $GITHUB_ENV
86+
87+
- name: Process multiarch manifest
88+
run: |
89+
echo "Re-tag multiarch image $IMAGE to altinity/$COMPONENT:$NEW_TAG"
90+
docker buildx imagetools create --tag "altinity/$COMPONENT:$NEW_TAG" "$IMAGE"
91+
92+
# Create directory for image archives
93+
mkdir -p image_archives
94+
95+
# Pull and save platform-specific images
96+
for PLATFORM in "linux/amd64" "linux/arm64"; do
97+
echo "Pulling and saving image for $PLATFORM..."
98+
# Pull the specific platform image
99+
docker pull --platform $PLATFORM "altinity/$COMPONENT:$NEW_TAG"
100+
101+
# Save the image to a tar file
102+
ARCH=$(echo $PLATFORM | cut -d'/' -f2)
103+
docker save "altinity/$COMPONENT:$NEW_TAG" -o "image_archives/${COMPONENT}-${NEW_TAG}-${ARCH}.tar"
104+
done
105+
106+
# Save manifest inspection
107+
docker buildx imagetools inspect "altinity/$COMPONENT:$NEW_TAG" > image_archives/manifest.txt
108+
109+
# Compress the archives
110+
cd image_archives
111+
for file in *.tar; do
112+
gzip "$file"
113+
done
114+
cd ..
115+
116+
- name: Set image archives path
117+
id: set_path
118+
run: |
119+
echo "image_archives_path=${{ github.workspace }}/image_archives" >> $GITHUB_OUTPUT
120+
121+
- name: Upload image archives
122+
if: ${{ github.event.inputs.upload_artifacts || inputs.upload_artifacts }}
123+
uses: actions/upload-artifact@v4
124+
with:
125+
name: docker-images-backup
126+
path: image_archives/
127+
retention-days: 90
128+
129+
- name: Install aws cli
130+
if: ${{ inputs.s3_upload_path != '' }}
131+
uses: unfor19/install-aws-cli-action@v1
132+
with:
133+
version: 2
134+
arch: arm64
135+
136+
- name: Upload to S3
137+
if: ${{ inputs.s3_upload_path != '' }}
138+
run: |
139+
aws s3 sync image_archives/ "${{ inputs.s3_upload_path }}"
140+

.github/workflows/reusable_build.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
### For the pure soul wishes to move it to another place
2-
# https://github.com/orgs/community/discussions/9050
3-
41
env:
52
# Force the stdout and stderr streams to be unbuffered
63
PYTHONUNBUFFERED: 1

0 commit comments

Comments
 (0)