Skip to content

Commit

Permalink
github: Make tag specific to architecture
Browse files Browse the repository at this point in the history
Currently, we share a tag between arm64 and x86_64, which does not work
without a manifest or using 'docker buildx' with the '--platform' flag
containing multiple builds.

A manifest would be useful but it still requires separate architecture
specific tags anyways.

We cannot rely on the '--platform' flag because building arm64 on x86_64
would run through qemu-user-static, which is slower than doing the build
on a native arm64 host.

To solve this, add the architecture to the tag so that we can generate
unique tags that will work for each architecture.

Use "aarch64" instead of "arm64" for the arch value so that we can
easily use 'uname -m' in a future Makefile patch.

Link: https://docs.docker.com/engine/reference/commandline/manifest/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
  • Loading branch information
nathanchance committed Jun 9, 2022
1 parent 1a9c882 commit dcc15cd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/llvm-project-epoch-one.yml
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
include:
- arch: arm64
- arch: aarch64
os: [self-hosted, arm64]
platforms: linux/arm64
- arch: x86_64
Expand All @@ -25,7 +25,7 @@ jobs:
arch: ${{ matrix.arch }}
file: Dockerfile.epoch1
platforms: ${{ matrix.platforms }}
tags: ghcr.io/clangbuiltlinux/llvm-project:stage2
tags: ghcr.io/clangbuiltlinux/llvm-project:stage2-${{ matrix.arch }}

- name: Login to ghcr.io
if: ${{ github.repository_owner == 'ClangBuiltLinux' && github.event_name != 'pull_request' && github.ref_name == 'main' }}
Expand All @@ -38,4 +38,4 @@ jobs:
- name: Push image to ghcr.io
if: ${{ github.repository_owner == 'ClangBuiltLinux' && github.event_name != 'pull_request' && github.ref_name == 'main' }}
run: |
docker push ghcr.io/clangbuiltlinux/llvm-project:stage2
docker push ghcr.io/clangbuiltlinux/llvm-project:stage2-${{ matrix.arch }}
7 changes: 4 additions & 3 deletions .github/workflows/llvm-project-epoch-three.yml
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
include:
- arch: arm64
- arch: aarch64
os: [self-hosted, arm64]
platforms: linux/arm64
- arch: x86_64
Expand All @@ -23,9 +23,10 @@ jobs:
uses: ./.github/actions/build-test-llvm-project
with:
arch: ${{ matrix.arch }}
build-args: BASE=ghcr.io/clangbuiltlinux/llvm-project:stage2-${{ matrix.arch }}
file: Dockerfile.epoch3
platforms: ${{ matrix.platforms }}
tags: ghcr.io/clangbuiltlinux/llvm-project:stage3
tags: ghcr.io/clangbuiltlinux/llvm-project:stage3-${{ matrix.arch }}

- name: Login to ghcr.io
if: ${{ github.repository_owner == 'ClangBuiltLinux' && github.event_name != 'pull_request' && github.ref_name == 'main' }}
Expand All @@ -38,4 +39,4 @@ jobs:
- name: Push image to ghcr.io
if: ${{ github.repository_owner == 'ClangBuiltLinux' && github.event_name != 'pull_request' && github.ref_name == 'main' }}
run: |
docker push ghcr.io/clangbuiltlinux/llvm-project:stage3
docker push ghcr.io/clangbuiltlinux/llvm-project:stage3-${{ matrix.arch }}
7 changes: 4 additions & 3 deletions .github/workflows/llvm-project-epoch-two.yml
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
include:
- arch: arm64
- arch: aarch64
os: [self-hosted, arm64]
platforms: linux/arm64
- arch: x86_64
Expand All @@ -23,9 +23,10 @@ jobs:
uses: ./.github/actions/build-test-llvm-project
with:
arch: ${{ matrix.arch }}
build-args: BASE=ghcr.io/clangbuiltlinux/llvm-project:stage2-${{ matrix.arch }}
file: Dockerfile.epoch2
platforms: ${{ matrix.platforms }}
tags: ghcr.io/clangbuiltlinux/llvm-project:stage2
tags: ghcr.io/clangbuiltlinux/llvm-project:stage2-${{ matrix.arch }}

- name: Login to ghcr.io
if: ${{ github.repository_owner == 'ClangBuiltLinux' && github.event_name != 'pull_request' && github.ref_name == 'main' }}
Expand All @@ -38,4 +39,4 @@ jobs:
- name: Push image to ghcr.io
if: ${{ github.repository_owner == 'ClangBuiltLinux' && github.event_name != 'pull_request' && github.ref_name == 'main' }}
run: |
docker push ghcr.io/clangbuiltlinux/llvm-project:stage2
docker push ghcr.io/clangbuiltlinux/llvm-project:stage2-${{ matrix.arch }}
4 changes: 3 additions & 1 deletion llvm-project/Dockerfile.epoch2
@@ -1,10 +1,12 @@
ARG BASE

FROM docker.io/alpine:edge AS source
RUN wget --no-clobber \
https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.1/llvm-project-14.0.1.src.tar.xz

### START STAGE2

FROM ghcr.io/clangbuiltlinux/llvm-project:stage2 as prev_epoch
FROM ${BASE} as prev_epoch
FROM docker.io/alpine:edge as stage_two

COPY --from=prev_epoch /usr/local/bin /usr/local/bin
Expand Down
4 changes: 2 additions & 2 deletions llvm-project/Dockerfile.epoch3
@@ -1,12 +1,12 @@
ARG base=ghcr.io/clangbuiltlinux/llvm-project:stage2
ARG BASE

FROM docker.io/alpine:edge AS source
RUN wget --no-verbose https://git.kernel.org/torvalds/t/linux-5.18-rc6.tar.gz
RUN wget --no-verbose https://musl.libc.org/releases/musl-1.2.3.tar.gz
RUN wget --no-verbose https://zlib.net/zlib-1.2.12.tar.gz
RUN wget --no-verbose https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.1/llvm-project-14.0.1.src.tar.xz

FROM ${base} AS stage2
FROM ${BASE} AS stage2
FROM docker.io/alpine:edge AS stage3

### BEGIN STAGE3
Expand Down

0 comments on commit dcc15cd

Please sign in to comment.