Skip to content

Commit f2bd6f3

Browse files
authored
Merge pull request #208 from code0-tech/200-setup-multi-arch-builds
Setup multi arch builds
2 parents 10ad641 + a0c3264 commit f2bd6f3

File tree

7 files changed

+260
-38
lines changed

7 files changed

+260
-38
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ stages:
22
- container
33
- container:boot
44

5-
default:
5+
.default-retry:
66
retry:
77
max: 2
88
when:

.gitlab/ci/container-boot.gitlab-ci.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
11
.container:boot:
22
extends:
33
- .dind
4+
- .default-retry
5+
tags:
6+
- c0-$PLATFORM
47
stage: container:boot
5-
image: ghcr.io/code0-tech/build-images/reticulum-builder:207.1-ruby-3.2.2
8+
image: ghcr.io/code0-tech/build-images/reticulum-builder:227.1-ruby-3.4.7-$PLATFORM
69
variables:
710
COMPOSE_FILE: support/docker-compose.yml
11+
parallel:
12+
matrix:
13+
- PLATFORM:
14+
- amd64
15+
- arm64
816

917
.container:boot:sagittarius:
1018
extends:
1119
- .container:boot
1220
needs:
13-
- container:sagittarius
21+
- manifest:sagittarius
1422
parallel:
1523
matrix:
1624
- SAGITTARIUS_VARIANT:
1725
- ce
1826
- ee
27+
PLATFORM:
28+
- amd64
29+
- arm64
1930
before_script:
2031
- docker compose up postgres -d
2132
- docker compose up sagittarius-$SAGITTARIUS_SERVICE -d
@@ -46,8 +57,8 @@ container:boot:aquila:
4657
extends:
4758
- .container:boot
4859
needs:
49-
- container:aquila
50-
- container:sagittarius
60+
- manifest:aquila
61+
- manifest:sagittarius
5162
variables:
5263
SAGITTARIUS_VARIANT: ce
5364
script:
@@ -67,7 +78,7 @@ container:boot:taurus:
6778
extends:
6879
- .container:boot
6980
needs:
70-
- container:taurus
81+
- manifest:taurus
7182
script:
7283
- bundle install
7384
- docker compose up nats -d
@@ -80,11 +91,14 @@ container:boot:draco:
8091
extends:
8192
- .container:boot
8293
needs:
83-
- container:draco
94+
- manifest:draco
8495
parallel:
8596
matrix:
8697
- DRACO_VARIANT:
8798
- rest
99+
PLATFORM:
100+
- amd64
101+
- arm64
88102
script:
89103
- bundle install
90104
- docker compose up nats -d
Lines changed: 122 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
.image-build-base:
22
extends:
33
- .dind
4-
image: ghcr.io/code0-tech/build-images/reticulum-builder:207.1-ruby-3.2.2
4+
- .default-retry
5+
tags:
6+
- c0-$PLATFORM
7+
image: ghcr.io/code0-tech/build-images/reticulum-builder:227.1-ruby-3.4.7-$PLATFORM
58
stage: container
6-
script:
9+
before_script:
710
- source support/helpers.sh
811
- docker_login
12+
- docker_setup_builder
913
- 'image=$(echo "$CI_JOB_NAME" | cut -d : -f 2)'
1014
- '[ -z "$NEED_PROJECT_DOWNLOAD" ] || download_project $image'
1115
retry:
@@ -15,81 +19,181 @@
1519
.single-image-build-base:
1620
extends:
1721
- .image-build-base
22+
parallel:
23+
matrix:
24+
- PLATFORM:
25+
- amd64
26+
- arm64
1827
script:
19-
- !reference [.image-build-base, script]
20-
- build_image $image $CI_PIPELINE_ID
21-
- push_image $image $CI_PIPELINE_ID
28+
- >
29+
build_image
30+
$image
31+
$CI_PIPELINE_ID
32+
"--output type=registry,push-by-digest=true --metadata-file manifest-${CI_JOB_ID}.json"
33+
""
34+
artifacts:
35+
paths:
36+
- manifest-*.json
37+
expire_in: 1 day
2238

2339
.variant-image-build-base:
2440
extends:
2541
- .image-build-base
2642
script:
27-
- !reference [.image-build-base, script]
28-
- build_image $image $CI_PIPELINE_ID "--build-arg VARIANT=$VARIANT"
29-
- image_tag=$(get_image_tag $CI_PIPELINE_ID $VARIANT)
30-
- retag_image $image $CI_PIPELINE_ID $image_tag
31-
- push_image $image $image_tag
43+
- >
44+
build_image
45+
$image
46+
$CI_PIPELINE_ID
47+
"--build-arg VARIANT=$VARIANT --output type=registry,push-by-digest=true --metadata-file manifest-${CI_JOB_ID}.json"
48+
""
49+
artifacts:
50+
paths:
51+
- manifest-*.json
52+
expire_in: 1 day
53+
54+
.manifest-create-base:
55+
extends:
56+
- .image-build-base
57+
variables:
58+
PLATFORM: amd64
59+
script:
60+
- create_manifest $image $(get_image_tag $CI_PIPELINE_ID $VARIANT)
3261

3362
container:mise:
3463
extends:
3564
- .single-image-build-base
3665

66+
manifest:mise:
67+
extends:
68+
- .manifest-create-base
69+
needs:
70+
- container:mise
71+
3772
container:rust:
3873
extends:
3974
- .single-image-build-base
4075
needs:
41-
- container:mise
76+
- manifest:mise
77+
78+
manifest:rust:
79+
extends:
80+
- .manifest-create-base
81+
needs:
82+
- container:rust
4283

4384
container:aquila:
4485
extends:
4586
- .single-image-build-base
4687
needs:
47-
- container:rust
88+
- manifest:rust
4889
variables:
4990
NEED_PROJECT_DOWNLOAD: 'true'
5091

92+
manifest:aquila:
93+
extends:
94+
- .manifest-create-base
95+
needs:
96+
- container:aquila
97+
5198
container:draco:
5299
extends:
53100
- .variant-image-build-base
54101
needs:
55-
- container:rust
102+
- manifest:rust
56103
variables:
57104
NEED_PROJECT_DOWNLOAD: 'true'
58105
parallel:
59106
matrix:
60107
- VARIANT:
61108
- rest
109+
PLATFORM:
110+
- amd64
111+
- arm64
112+
113+
manifest:draco:
114+
extends:
115+
- .manifest-create-base
116+
parallel:
117+
matrix:
118+
- VARIANT:
119+
- rest
120+
needs:
121+
- job: container:draco
122+
parallel:
123+
matrix:
124+
- VARIANT: ['$[[ matrix.VARIANT ]]']
125+
PLATFORM:
126+
- amd64
127+
- arm64
62128

63129
container:taurus:
64130
extends:
65131
- .single-image-build-base
66132
needs:
67-
- container:rust
133+
- manifest:rust
68134
variables:
69135
NEED_PROJECT_DOWNLOAD: 'true'
70136

137+
manifest:taurus:
138+
extends:
139+
- .manifest-create-base
140+
needs:
141+
- container:taurus
142+
71143
container:ruby:
72144
extends:
73145
- .single-image-build-base
74146
needs:
75-
- container:mise
147+
- manifest:mise
148+
149+
manifest:ruby:
150+
extends:
151+
- .manifest-create-base
152+
needs:
153+
- container:ruby
76154

77155
container:postgresql:
78156
extends:
79157
- .single-image-build-base
80158
needs:
81-
- container:mise
159+
- manifest:mise
160+
161+
manifest:postgresql:
162+
extends:
163+
- .manifest-create-base
164+
needs:
165+
- container:postgresql
82166

83167
container:sagittarius:
84168
extends:
85169
- .variant-image-build-base
86170
needs:
87-
- container:ruby
88-
- container:postgresql
171+
- manifest:ruby
172+
- manifest:postgresql
89173
variables:
90174
NEED_PROJECT_DOWNLOAD: 'true'
91175
parallel:
92176
matrix:
93177
- VARIANT:
94178
- ce
95179
- ee
180+
PLATFORM:
181+
- amd64
182+
- arm64
183+
184+
manifest:sagittarius:
185+
extends:
186+
- .manifest-create-base
187+
parallel:
188+
matrix:
189+
- VARIANT:
190+
- ce
191+
- ee
192+
needs:
193+
- job: container:sagittarius
194+
parallel:
195+
matrix:
196+
- VARIANT: [ '$[[ matrix.VARIANT ]]' ]
197+
PLATFORM:
198+
- amd64
199+
- arm64

container/ruby/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ ARG RETICULUM_IMAGE_TAG=local
22

33
FROM ghcr.io/code0-tech/reticulum/ci-builds/mise:$RETICULUM_IMAGE_TAG
44

5-
ARG RUBY_VERSION=3.2.2
5+
ARG RUBY_VERSION=3.4.7
66

77
RUN apk add --update --no-cache build-base tzdata zlib-dev perl linux-headers libffi readline yaml-dev
8-
RUN mise install-into ruby@$RUBY_VERSION /usr/local/share/ruby
8+
COPY container/ruby/patches /ruby-patches
9+
ENV MISE_RUBY_APPLY_PATCHES=/ruby-patches/0001-thread_pthread.c-make-get_main_stack-portable-on-lin.patch
10+
RUN mise install-into ruby@$RUBY_VERSION /usr/local/share/ruby; exit_code=$?; rm -rf /ruby-patches; [ $exit_code -ne 0 ] && tail -n 500 /tmp/ruby-build.*.log; exit $exit_code
911
ENV PATH=/usr/local/share/ruby/bin:$PATH

0 commit comments

Comments
 (0)