|
| 1 | +name: S390x Docker Publish |
| 2 | + |
| 3 | +# Build the native s390x Vector docker image on the self-hosted LinuxONE runner |
| 4 | +# (no QEMU), then combine it with upstream's other architectures into a single |
| 5 | +# multiarch manifest published to GHCR. Auth uses the workflow GITHUB_TOKEN |
| 6 | +# (packages: write) — no registry secrets required. |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + git_ref: |
| 12 | + description: "Git ref to check out for the Dockerfile (branch/tag/SHA)." |
| 13 | + type: string |
| 14 | + default: s390x/v0.56.0 |
| 15 | + required: false |
| 16 | + version: |
| 17 | + description: "Vector version, e.g. 0.56.0 (manifest is tagged v<version>)." |
| 18 | + type: string |
| 19 | + default: "0.56.0" |
| 20 | + required: true |
| 21 | + release_tag: |
| 22 | + description: "GitHub release holding the s390x .deb to package into the image." |
| 23 | + type: string |
| 24 | + default: v0.56.0-s390x |
| 25 | + required: true |
| 26 | + variant: |
| 27 | + description: "Base image variant (s390x supports distroless-libc or debian)." |
| 28 | + type: string |
| 29 | + default: distroless-libc |
| 30 | + required: false |
| 31 | + upstream_image: |
| 32 | + description: "Upstream multiarch image (amd64/arm64/arm) to combine with." |
| 33 | + type: string |
| 34 | + default: timberio/vector |
| 35 | + required: false |
| 36 | + |
| 37 | +permissions: |
| 38 | + contents: read |
| 39 | + packages: write |
| 40 | + |
| 41 | +env: |
| 42 | + CI: true |
| 43 | + |
| 44 | +jobs: |
| 45 | + s390x-docker: |
| 46 | + name: Build s390x image and publish multiarch manifest |
| 47 | + runs-on: [self-hosted, Linux, s390x] |
| 48 | + timeout-minutes: 60 |
| 49 | + env: |
| 50 | + IMAGE: ghcr.io/${{ github.repository_owner }}/vector |
| 51 | + VERSION: ${{ inputs.version }} |
| 52 | + VARIANT: ${{ inputs.variant }} |
| 53 | + UPSTREAM: ${{ inputs.upstream_image }} |
| 54 | + steps: |
| 55 | + - name: Checkout Vector |
| 56 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 57 | + with: |
| 58 | + ref: ${{ inputs.git_ref }} |
| 59 | + |
| 60 | + - name: Tool versions |
| 61 | + run: | |
| 62 | + docker version |
| 63 | + docker buildx version |
| 64 | +
|
| 65 | + - name: Download s390x .deb from the GitHub release |
| 66 | + env: |
| 67 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + run: | |
| 69 | + mkdir -p target/artifacts |
| 70 | + gh release download "${{ inputs.release_tag }}" \ |
| 71 | + -R "${{ github.repository }}" \ |
| 72 | + -p 'vector_*_s390x.deb' \ |
| 73 | + -D target/artifacts |
| 74 | + ls -l target/artifacts |
| 75 | +
|
| 76 | + - name: Log in to GHCR |
| 77 | + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin |
| 78 | + |
| 79 | + - name: Build and push native s390x image |
| 80 | + run: | |
| 81 | + set -x |
| 82 | + ARCH_TAG="$IMAGE:$VERSION-s390x-$VARIANT" |
| 83 | + docker build \ |
| 84 | + -f "distribution/docker/$VARIANT/Dockerfile" \ |
| 85 | + -t "$ARCH_TAG" \ |
| 86 | + target/artifacts |
| 87 | + docker push "$ARCH_TAG" |
| 88 | +
|
| 89 | + - name: Inspect upstream multiarch image |
| 90 | + run: docker buildx imagetools inspect "$UPSTREAM:$VERSION-$VARIANT" |
| 91 | + |
| 92 | + - name: Create combined multiarch manifest (v<version>) |
| 93 | + run: | |
| 94 | + set -x |
| 95 | + # imagetools create copies the referenced platform images into the |
| 96 | + # target repo, so the upstream (amd64/arm64/arm) and our native s390x |
| 97 | + # image are merged into one manifest list under GHCR. |
| 98 | + docker buildx imagetools create \ |
| 99 | + -t "$IMAGE:v$VERSION" \ |
| 100 | + "$UPSTREAM:$VERSION-$VARIANT" \ |
| 101 | + "$IMAGE:$VERSION-s390x-$VARIANT" |
| 102 | +
|
| 103 | + - name: Verify final manifest platforms |
| 104 | + run: docker buildx imagetools inspect "$IMAGE:v$VERSION" |
0 commit comments