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