Skip to content

Commit e71090c

Browse files
committed
WIP: ci: Build buildox-ng on GitHub push events
Rebuild buildbox-ng and/or buildbox-thirdparty on changes to the files that define those buildboxes when pushes on master or a release branch are done.
1 parent 0c8d947 commit e71090c

File tree

3 files changed

+110
-58
lines changed

3 files changed

+110
-58
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build buildbox images
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- branch/**
7+
- camh/**
8+
9+
jobs:
10+
build:
11+
name: Check for relevant changes
12+
runs-on: ubuntu-22.04-32core
13+
permissions:
14+
contents: read
15+
packages: write
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Check changes
21+
id: changes
22+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
23+
with:
24+
base: ${{ github.ref }}
25+
filters: |
26+
buildbox:
27+
- 'build.assets/versions.mk'
28+
- 'build.assets/images.mk'
29+
- 'build.assets/buildbox/Dockerfile'
30+
- 'build.assets/buildbox/clang-12.sh'
31+
thirdparty:
32+
- 'build.assets/images.mk'
33+
- 'build.assets/buildbox/Dockerfile-thirdparty'
34+
- 'build.assets/buildbox/build-buildbox.mk'
35+
- 'build.assets/buildbox/buildbox-common.mk'
36+
- 'build.assets/buildbox/cross-compile.mk'
37+
- 'build.assets/buildbox/crosstoolng-configs/**'
38+
- 'build.assets/buildbox/crosstoolng.mk'
39+
- 'build.assets/buildbox/pkgconfg/**'
40+
- 'build.assets/buildbox/thirdparty-libs.mk'
41+
42+
- name: Build buildbox-thirdparty
43+
if: ${{ steps.changes.outputs.thirdparty }}
44+
run:
45+
make -C build.assets buildbox-thirdparty PUSH=1
46+
47+
- name: Build buildbox-ng
48+
if: ${{ steps.changes.outputs.thirdparty || steps.changes.outputs.buildbox }}
49+
run:
50+
make -C build.assets buildbox-ng PUSH=1

build.assets/Makefile

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -106,64 +106,7 @@ build-binaries-fips: buildbox-centos7-fips webassets
106106
docker run $(DOCKERFLAGS) $(NOROOT) $(BUILDBOX_CENTOS7_FIPS) \
107107
make -C $(SRCDIR)/e ADDFLAGS='$(ADDFLAGS)' VERSION=$(VERSION) GITTAG=v$(VERSION) PIV=$(PIV) FIPS=yes clean full
108108

109-
#
110-
# Build the buildbox thirdparty components. This rarely needs to be rebuilt and is
111-
# slow to build, so it is done separately from the main buildbox
112-
#
113-
.PHONY: buildbox-thirdparty
114-
buildbox-thirdparty:
115-
docker buildx build \
116-
--cache-from $(BUILDBOX_THIRDPARTY) \
117-
--cache-to type=inline \
118-
$(if $(PUSH),--push,--load) \
119-
--tag $(BUILDBOX_THIRDPARTY) \
120-
-f buildbox/Dockerfile-thirdparty \
121-
buildbox
122-
123-
#
124-
# A generic build rule to build a stage of Dockerfile-thirdparty based
125-
# on the $(STAGE) variable. These stage builds are used for development
126-
# of the thirdparty buildbox, whether to configure crosstool-NG
127-
# (see config/buildbox-ng), or when adding additional third party
128-
# libraries using either the compilers stage or libs stage.
129-
#
130-
.PHONY: buildbox-thirdparty-stage
131-
buildbox-thirdparty-stage:
132-
docker buildx build \
133-
--load \
134-
--tag buildbox-thirdparty-$(STAGE):$(BUILDBOX_VERSION) \
135-
-f buildbox/Dockerfile-thirdparty \
136-
--target $(STAGE) \
137-
buildbox
138-
139-
.PHONY: buildbox-thirdparty-crosstoolng
140-
buildbox-thirdparty-crosstoolng: STAGE=crosstoolng
141-
buildbox-thirdparty-crosstoolng: buildbox-thirdparty-stage
142-
143-
.PHONY: buildbox-thirdparty-compilers
144-
buildbox-thirdparty-compilers: STAGE=compilers
145-
buildbox-thirdparty-compilers: buildbox-thirdparty-stage
146-
147-
.PHONY: buildbox-thirdparty-libs
148-
buildbox-thirdparty-libs: STAGE=libs
149-
buildbox-thirdparty-libs: buildbox-thirdparty-stage
150-
151-
#
152-
# Build the buildbox-ng using the pre-built third party components from the
153-
# buildbox-thirdparty image
154-
#
155-
.PHONY: buildbox-ng
156-
buildbox-ng:
157-
docker buildx build \
158-
--build-arg THIRDPARTY_IMAGE=$(BUILDBOX_THIRDPARTY) \
159-
--build-arg GOLANG_VERSION=$(GOLANG_VERSION) \
160-
--build-arg RUST_VERSION=$(RUST_VERSION) \
161-
--cache-from $(BUILDBOX_NG) \
162-
--cache-to type=inline \
163-
$(if $(PUSH),--push,--load) \
164-
--tag $(BUILDBOX_NG) \
165-
-f buildbox/Dockerfile \
166-
buildbox
109+
include buildbox/build-buildbox.mk
167110

168111
# Builds a Docker container which is used for building official Teleport binaries
169112
# If running in CI and there is no image with the buildbox name:tag combination present locally,
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#
2+
# Build the buildbox-ng using the pre-built third party components from the
3+
# buildbox-thirdparty image
4+
#
5+
.PHONY: buildbox-ng
6+
buildbox-ng:
7+
docker buildx build \
8+
--build-arg THIRDPARTY_IMAGE=$(BUILDBOX_THIRDPARTY) \
9+
--build-arg GOLANG_VERSION=$(GOLANG_VERSION) \
10+
--build-arg RUST_VERSION=$(RUST_VERSION) \
11+
--cache-from $(BUILDBOX_NG) \
12+
--cache-to type=inline \
13+
$(if $(PUSH),--push,--load) \
14+
--tag $(BUILDBOX_NG) \
15+
-f buildbox/Dockerfile \
16+
buildbox
17+
18+
#
19+
# Build the buildbox thirdparty components. This rarely needs to be rebuilt and is
20+
# slow to build, so it is done separately from the main buildbox
21+
#
22+
.PHONY: buildbox-thirdparty
23+
buildbox-thirdparty:
24+
docker buildx build \
25+
--cache-from $(BUILDBOX_THIRDPARTY) \
26+
--cache-to type=inline \
27+
$(if $(PUSH),--push,--load) \
28+
--tag $(BUILDBOX_THIRDPARTY) \
29+
-f buildbox/Dockerfile-thirdparty \
30+
buildbox
31+
32+
#
33+
# A generic build rule to build a stage of Dockerfile-thirdparty based
34+
# on the $(STAGE) variable. These stage builds are used for development
35+
# of the thirdparty buildbox, whether to configure crosstool-NG
36+
# (see config/buildbox-ng), or when adding additional third party
37+
# libraries using either the compilers stage or libs stage.
38+
#
39+
.PHONY: buildbox-thirdparty-stage
40+
buildbox-thirdparty-stage:
41+
docker buildx build \
42+
--load \
43+
--tag buildbox-thirdparty-$(STAGE):$(BUILDBOX_VERSION) \
44+
-f buildbox/Dockerfile-thirdparty \
45+
--target $(STAGE) \
46+
buildbox
47+
48+
.PHONY: buildbox-thirdparty-crosstoolng
49+
buildbox-thirdparty-crosstoolng: STAGE=crosstoolng
50+
buildbox-thirdparty-crosstoolng: buildbox-thirdparty-stage
51+
52+
.PHONY: buildbox-thirdparty-compilers
53+
buildbox-thirdparty-compilers: STAGE=compilers
54+
buildbox-thirdparty-compilers: buildbox-thirdparty-stage
55+
56+
.PHONY: buildbox-thirdparty-libs
57+
buildbox-thirdparty-libs: STAGE=libs
58+
buildbox-thirdparty-libs: buildbox-thirdparty-stage
59+

0 commit comments

Comments
 (0)