Skip to content

Commit 25396bb

Browse files
committed
Add Multiplatform Nightly musl Images
This introduces a number of changes for our container image building. It introduces the eventual deprecation of `latest` as a tag. At the moment, our use of `latest` is misleading. That is supposed to be "most recent" but we don't use it as such. For us it is "most recently nightly". This commit will be the start of us having "nightly" images that are explicitly a nightly build. Additionally, our tags will have a qualifier for the libc version. In the case of this musl image the tag would be "musl-nightly". When we do the same for GNU libc, the tag would be "gnu-nightly". This same name scheme will end up being carried over to releases: "musl-release" and "gnu-release" as well as "by version" tags "musl-0.60.0" and "gnu-0.60.0". The older tags will be dropped as this rolls out. We can if we want then start using a variation on latest with "musl-latest" and "gnu-latest" should we want, or for ponyc images we can ditch the entire concept of "latest" as "nightly" and "release" versions will always be for a given library the latest nightly and latest release. In addition the tag name changes, this also is our first multiplatform image. The build process for this is as simple as I could make it. We have a new workflow for building the nightly image. It is set to have a concurrency of 1 so, as events arrive from Cloudsmith, we will build a new version of the image with whatever is the latest nightly arm64 and latest nightly am64 version of ponyc that is available in Cloudsmith. This means that as we upload to Cloudsmith each night we will create the image twice. If the arm64 synchronized message arrives first and then the amd64 one we will have the following happen: - arm64 message arrives - Build a new "nightly image" with today's arm64 and yesterday's amd64 - amd64 message arrives - Build a new "nightly image" with today's arm64 and today's arm64 The same pattern would be applied to releases. At the time the message arrives, the image will be built using the most recent version of ponyc for each platform that is available. This has a couple nice qualities to it: - If one failed to build, we still make the one that succeeded available. - It makes our configuration relatively simple Without this "cross over", we would need to wait for each message to have arrived and then build the final image. That is some tricky yaml that we should want to avoid doing if possible.
1 parent 53a4641 commit 25396bb

File tree

5 files changed

+140
-0
lines changed

5 files changed

+140
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM alpine:3.21
2+
3+
LABEL org.opencontainers.image.source="https://github.com/ponylang/ponyc"
4+
5+
ENV PATH="/root/.local/share/ponyup/bin:$PATH"
6+
7+
RUN apk add --update --no-cache \
8+
clang \
9+
curl \
10+
build-base \
11+
binutils-gold \
12+
git
13+
14+
RUN sh -c "$(curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ponylang/ponyup/latest-release/ponyup-init.sh)" \
15+
&& ponyup update ponyc nightly \
16+
&& ponyup update corral nightly \
17+
&& ponyup update changelog-tool nightly
18+
19+
WORKDIR /src/main
20+
21+
CMD ["ponyc"]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
set -o nounset
5+
6+
#
7+
# *** You should already be logged in to GitHub Container Registry when you run
8+
# this ***
9+
#
10+
11+
DOCKERFILE_DIR="$(dirname "$0")"
12+
NAME="ghcr.io/ponylang/ponyc:musl-nightly"
13+
BUILDER="ponyc-musl-nightly-builder-$(date +%s)"
14+
15+
docker buildx create --use --name "${BUILDER}"
16+
docker buildx build --provenance false --sbom false --platform linux/arm64,linux/amd64 --pull --push -t "${NAME}" "${DOCKERFILE_DIR}"
17+
docker buildx rm "${BUILDER}"
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Build Nightly musl Image
2+
3+
on:
4+
repository_dispatch:
5+
types:
6+
- cloudsmith-package-synchronised
7+
8+
concurrency:
9+
group: build-nightly-musl-image
10+
cancel-in-progress: false
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
jobs:
17+
build-nightly-musl-docker-image:
18+
if: |
19+
github.event.client_payload.data.repository == 'nightlies' &&
20+
(github.event.client_payload.data.name == 'ponyc-x86-64-unknown-linux-musl.tar.gz' ||
21+
github.event.client_payload.data.name == 'ponyc-arm64-unknown-linux-musl.tar.gz')
22+
23+
name: Build latest musl image
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4.1.1
28+
- name: Set up Docker Buildx
29+
# v3.10.0
30+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
31+
with:
32+
version: v0.23.0
33+
- name: Login to GitHub Container Registry
34+
# v2.2.0
35+
uses: docker/login-action@5139682d94efc37792e6b54386b5b470a68a4737
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.repository_owner }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
- name: Build and push
41+
run: bash .dockerfiles/nightly/musl/build-and-push.bash
42+
- name: Alert on failure
43+
if: ${{ failure() }}
44+
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5
45+
with:
46+
api-key: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_API_KEY }}
47+
email: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_EMAIL }}
48+
organization-url: 'https://ponylang.zulipchat.com/'
49+
to: notifications
50+
type: stream
51+
topic: ${{ github.repository }} scheduled job failure
52+
content: ${{ github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }} failed.
53+
54+
send-repository-dispatch-event:
55+
needs:
56+
- build-nightly-musl-docker-image
57+
58+
name: Send
59+
runs-on: ubuntu-latest
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
repo:
64+
- ponylang/library-documentation-action-v2
65+
- ponylang/shared-docker
66+
steps:
67+
- name: Send
68+
# v2.1.1
69+
uses: peter-evans/repository-dispatch@8324ecf35877f9b02961dd5aaf43ed7be7db9373
70+
with:
71+
token: ${{ secrets.PONYLANG_MAIN_API_TOKEN }}
72+
repository: ${{ matrix.repo }}
73+
event-type: ponyc-musl-nightly-released
74+
client-payload: '{"version": "${{ github.event.client_payload.data.version }}"}'
75+
- name: Alert on failure
76+
if: ${{ failure() }}
77+
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5
78+
with:
79+
api-key: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_API_KEY }}
80+
email: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_EMAIL }}
81+
organization-url: 'https://ponylang.zulipchat.com/'
82+
to: notifications
83+
type: stream
84+
topic: ${{ github.repository }} scheduled job failure
85+
content: ${{ github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }} failed.

.github/workflows/pr.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ jobs:
2525
VALIDATE_MD: true
2626
VALIDATE_YAML: true
2727

28+
validate-nightly-musl-image-builds:
29+
name: Validate nightly musl image builds
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4.1.1
34+
- name: Set up Docker Buildx
35+
# v3.10.0
36+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
37+
- name: Docker build
38+
run: |
39+
docker buildx create --name multiplatform --driver docker-container --use --bootstrap
40+
docker buildx build --platform linux/amd64,linux/arm64 --pull --file=.dockerfiles/nightly/musl/Dockerfile .
41+
2842
validate-x86_64-musl-docker-latest-image-builds:
2943
name: Validate x86_64 musl Docker image builds
3044
runs-on: ubuntu-latest

.release-notes/musl-nightly-mp.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Add Multiplatform Nightly musl Images
2+
3+
We've added new nightly images for musl that support multiple architectures. The images will be available with the tag `musl-nightly`. They will be available for GitHub Container Registry the same as our [other ponyc images](https://github.com/ponylang/ponyc/pkgs/container/ponyc).

0 commit comments

Comments
 (0)