Skip to content

Commit 778fcba

Browse files
Build images with deps versions (#19)
* Fixed building Alpine Linux APK packaged for x86_64 and arm64 * Removed job depedency * Fixed permissions * Fixed directory ownership * Fixed building APK as root * Use qemu to build arm64 package * fixed copying the APK package to artifacts * Build images with fixed dependencies * Apply suggestions from code review Co-authored-by: Yunze Xu <xyzinfernity@163.com> * Fixed docker tag names * Added load: true * Fixed overriding image name Co-authored-by: Yunze Xu <xyzinfernity@163.com>
1 parent dc2d71e commit 778fcba

22 files changed

Lines changed: 603 additions & 150 deletions

.github/workflows/ci-build-binary-artifacts.yaml

Lines changed: 130 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
name: CI - Build binary artifacts
2121
on:
2222
push:
23-
branches:
24-
- '*'
2523
tags:
2624
- '*'
2725

@@ -43,8 +41,21 @@ jobs:
4341
- name: Package Pulsar source
4442
run: build-support/generate-source-archive.sh
4543

44+
- uses: docker/setup-buildx-action@v2
45+
- run: build-support/copy-deps-versionfile.sh
46+
47+
- name: Build dependencies Docker image
48+
uses: docker/build-push-action@v3
49+
with:
50+
context: ./pkg/deb
51+
load: true
52+
tags: build-deb-x86_64:latest
53+
build-args: PLATFORM=x86_64
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max
56+
4657
- name: Build Debian packages
47-
run: pkg/deb/docker-build-deb-x86_64.sh
58+
run: pkg/deb/docker-build-deb-x86_64.sh build-deb-x86_64:latest
4859

4960
- name: Upload artifacts
5061
uses: actions/upload-artifact@v3
@@ -67,8 +78,22 @@ jobs:
6778
- name: Package Pulsar source
6879
run: build-support/generate-source-archive.sh
6980

81+
- uses: docker/setup-buildx-action@v2
82+
- run: build-support/copy-deps-versionfile.sh
83+
84+
- name: Build dependencies Docker image
85+
uses: docker/build-push-action@v3
86+
with:
87+
context: ./pkg/deb
88+
load: true
89+
tags: build-deb-arm64:latest
90+
build-args: PLATFORM=aarch64
91+
platforms: linux/arm64
92+
cache-from: type=gha
93+
cache-to: type=gha,mode=max
94+
7095
- name: Build Debian packages
71-
run: pkg/deb/docker-build-deb-arm64.sh
96+
run: pkg/deb/docker-build-deb-arm64.sh build-deb-arm64:latest
7297

7398
- name: Upload artifacts
7499
uses: actions/upload-artifact@v3
@@ -88,8 +113,21 @@ jobs:
88113
- name: Package Pulsar source
89114
run: build-support/generate-source-archive.sh
90115

116+
- uses: docker/setup-buildx-action@v2
117+
- run: build-support/copy-deps-versionfile.sh
118+
119+
- name: Build dependencies Docker image
120+
uses: docker/build-push-action@v3
121+
with:
122+
context: ./pkg/rpm
123+
load: true
124+
tags: build-rpm-x86_64:latest
125+
build-args: PLATFORM=x86_64
126+
cache-from: type=gha
127+
cache-to: type=gha,mode=max
128+
91129
- name: Build RPM packages
92-
run: pkg/rpm/docker-build-rpm-x86_64.sh
130+
run: pkg/rpm/docker-build-rpm-x86_64.sh build-rpm-x86_64:latest
93131

94132
- name: Upload artifacts
95133
uses: actions/upload-artifact@v3
@@ -112,11 +150,97 @@ jobs:
112150
- name: Package Pulsar source
113151
run: build-support/generate-source-archive.sh
114152

153+
- uses: docker/setup-buildx-action@v2
154+
- run: build-support/copy-deps-versionfile.sh
155+
156+
- name: Build dependencies Docker image
157+
uses: docker/build-push-action@v3
158+
with:
159+
context: ./pkg/rpm
160+
load: true
161+
tags: build-rpm-arm64:latest
162+
build-args: PLATFORM=aarch64
163+
platforms: linux/arm64
164+
cache-from: type=gha
165+
cache-to: type=gha,mode=max
166+
115167
- name: Build RPM packages
116-
run: pkg/rpm/docker-build-rpm-arm64.sh
168+
run: pkg/rpm/docker-build-rpm-arm64.sh build-rpm-arm64:latest
117169

118170
- name: Upload artifacts
119171
uses: actions/upload-artifact@v3
120172
with:
121173
name: rpm-arm64
122174
path: pkg/rpm/RPMS
175+
176+
apk-packaging-x86_64:
177+
name: Build Alpine Linux APK Package - x86_64
178+
runs-on: ubuntu-20.04
179+
timeout-minutes: 120
180+
181+
steps:
182+
- name: checkout
183+
uses: actions/checkout@v2
184+
185+
- name: Package Pulsar source
186+
run: build-support/generate-source-archive.sh
187+
188+
- uses: docker/setup-buildx-action@v2
189+
- run: build-support/copy-deps-versionfile.sh
190+
191+
- name: Build dependencies Docker image
192+
uses: docker/build-push-action@v3
193+
with:
194+
context: ./pkg/apk
195+
load: true
196+
tags: build-apk-x86_64:latest
197+
build-args: PLATFORM=x86_64
198+
cache-from: type=gha
199+
cache-to: type=gha,mode=max
200+
201+
- name: Build APK packages
202+
run: pkg/apk/docker-build-apk-x86_64.sh build-apk-x86_64:latest
203+
204+
- name: Upload artifacts
205+
uses: actions/upload-artifact@v3
206+
with:
207+
name: apk-x86_64
208+
path: pkg/apk/build/x86_64
209+
210+
apk-packaging-arm64:
211+
name: Build Alpine Linux APK Package - arm64
212+
runs-on: ubuntu-20.04
213+
timeout-minutes: 120
214+
215+
steps:
216+
- name: checkout
217+
uses: actions/checkout@v2
218+
219+
- name: Set up QEMU
220+
uses: docker/setup-qemu-action@v1
221+
222+
- name: Package Pulsar source
223+
run: build-support/generate-source-archive.sh
224+
225+
- uses: docker/setup-buildx-action@v2
226+
- run: build-support/copy-deps-versionfile.sh
227+
228+
- name: Build dependencies Docker image
229+
uses: docker/build-push-action@v3
230+
with:
231+
context: ./pkg/apk
232+
load: true
233+
tags: build-apk-arm64:latest
234+
build-args: PLATFORM=aarch64
235+
platforms: linux/arm64
236+
cache-from: type=gha
237+
cache-to: type=gha,mode=max
238+
239+
- name: Build APK packages
240+
run: pkg/apk/docker-build-apk-arm64.sh build-apk-arm64:latest
241+
242+
- name: Upload artifacts
243+
uses: actions/upload-artifact@v3
244+
with:
245+
name: apk-arm64
246+
path: pkg/apk/build/aarch64

.github/workflows/ci-pr-validation.yaml

Lines changed: 59 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ on:
2222
pull_request:
2323
branches:
2424
- main
25-
push:
26-
branches:
27-
- main
2825

2926
concurrency:
3027
group: ${{ github.workflow }}-${{ github.ref }}
@@ -209,10 +206,22 @@ jobs:
209206
- name: Package Pulsar source
210207
run: build-support/generate-source-archive.sh
211208

209+
- uses: docker/setup-buildx-action@v2
210+
- run: build-support/copy-deps-versionfile.sh
211+
212+
- name: Build dependencies Docker image
213+
uses: docker/build-push-action@v3
214+
with:
215+
context: ./pkg/deb
216+
load: true
217+
tags: build-deb-x86_64:latest
218+
build-args: PLATFORM=x86_64
219+
cache-from: type=gha
220+
cache-to: type=gha,mode=max
221+
212222
- name: Build Debian packages
213-
run: |
214-
echo "Build Debian packages"
215-
BUILD_IMAGE=1 pkg/deb/docker-build-deb-x86_64.sh
223+
run: pkg/deb/docker-build-deb-x86_64.sh build-deb-x86_64:latest
224+
216225

217226
rpm-packaging:
218227
name: Build RPM Package
@@ -227,25 +236,48 @@ jobs:
227236
- name: Package Pulsar source
228237
run: build-support/generate-source-archive.sh
229238

239+
- uses: docker/setup-buildx-action@v2
240+
- run: build-support/copy-deps-versionfile.sh
241+
242+
- name: Build dependencies Docker image
243+
uses: docker/build-push-action@v3
244+
with:
245+
context: ./pkg/rpm
246+
load: true
247+
tags: build-rpm-x86_64:latest
248+
build-args: PLATFORM=x86_64
249+
cache-from: type=gha
250+
cache-to: type=gha,mode=max
251+
230252
- name: Build RPM packages
231-
run: |
232-
echo "Build RPM packages"
233-
BUILD_IMAGE=1 pkg/rpm/docker-build-rpm-x86_64.sh
234-
235-
# apk-packaging:
236-
# name: Build Alpine Linux APK Package
237-
# runs-on: ubuntu-20.04
238-
# needs: unit-tests
239-
# timeout-minutes: 120
240-
#
241-
# steps:
242-
# - name: checkout
243-
# uses: actions/checkout@v2
244-
#
245-
# - name: Package Pulsar source
246-
# run: build-support/generate-source-archive.sh
247-
#
248-
# - name: Build APK packages
249-
# run: |
250-
# echo "Build APK packages"
251-
# BUILD_IMAGE=1 pkg/apk/docker-build-apk.sh
253+
run: pkg/rpm/docker-build-rpm-x86_64.sh build-rpm-x86_64:latest
254+
255+
256+
apk-packaging:
257+
name: Build Alpine Linux APK Package
258+
runs-on: ubuntu-20.04
259+
needs: unit-tests
260+
timeout-minutes: 120
261+
262+
steps:
263+
- name: checkout
264+
uses: actions/checkout@v2
265+
266+
- name: Package Pulsar source
267+
run: build-support/generate-source-archive.sh
268+
269+
- uses: docker/setup-buildx-action@v2
270+
- run: build-support/copy-deps-versionfile.sh
271+
272+
- name: Build dependencies Docker image
273+
uses: docker/build-push-action@v3
274+
with:
275+
context: ./pkg/apk
276+
load: true
277+
tags: build-apk-x86_64:latest
278+
build-args: PLATFORM=x86_64
279+
cache-from: type=gha
280+
cache-to: type=gha,mode=max
281+
282+
- name: Build APK packages
283+
run: pkg/apk/docker-build-apk-x86_64.sh build-apk-x86_64:latest
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
21+
set -e -x
22+
23+
ROOT_DIR=$(git rev-parse --show-toplevel)
24+
25+
for dir in apk deb rpm; do
26+
mkdir -p pkg/$dir/.build
27+
cp $ROOT_DIR/dependencies.yaml pkg/$dir/.build
28+
cp $ROOT_DIR/build-support/dep-version.py pkg/$dir/.build
29+
done

build-support/dep-version.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
21+
import yaml, sys
22+
23+
deps = yaml.safe_load(open('dependencies.yaml'))
24+
print(deps[sys.argv[1]])

dependencies.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
boost : 1.80.0
21+
cmake: 3.24.2
22+
protobuf: 3.20.0
23+
zlib: 1.2.12
24+
zstd: 1.5.2
25+
snappy: 1.1.9
26+
openssl: 1.1.1q
27+
curl: 7.85.0

pkg/apk/.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
pkg
2-
perf
3-
examples
4-
lib
5-
src
2+
build
3+
.build

pkg/apk/APKBUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ url="https://pulsar.apache.org"
2727
arch="all"
2828
license="https://www.apache.org/licenses/LICENSE-2.0.txt"
2929
depends=""
30-
makedepends="cmake"
30+
makedepends=""
3131
install=""
3232
subpackages="$pkgname-dev"
3333
source=""
@@ -48,7 +48,7 @@ build() {
4848
-DBUILD_TESTS=OFF \
4949
-DLINK_STATIC=ON \
5050
${CMAKE_CROSSOPTS} ${ROOT_DIR}
51-
make
51+
make -j6
5252
}
5353

5454
package() {

0 commit comments

Comments
 (0)