19
19
REGISTRY : ghcr.io
20
20
# Where to push an image of the CSI driver that will be retained (for master builds or releases) without a specific tag:
21
21
IMAGE_NAME : ghcr.io/thinkparq/beegfs-csi-driver
22
+ # Equivalent of BUILD_PLATFORMS in the Makefile and release-tools build.make. We cannot just set
23
+ # this as a default inside the project Makefile because it will be overridden by the release-tools
24
+ # build.make. We can't update release-tools because it there is a check to prevent modifying
25
+ # release-tools. Note release-tools specifies the buildx_platform without the os (i.e., arm64
26
+ # instead of linux/arm64).
27
+ RELEASE_TOOLS_BUILD_PLATFORMS : " linux amd64 amd64 amd64;linux arm64 arm64 arm64"
28
+ # Used as the list of platforms for Docker buildx when it is not called through release-tools.
29
+ DOCKER_BUILDX_BUILD_PLATFORMS : " linux/amd64,linux/arm64"
22
30
# Where to push an image of the CSI driver for testing (including the operator) without a specific tag:
23
31
TEST_IMAGE_NAME : ghcr.io/thinkparq/test-beegfs-csi-driver
24
32
# Where to push an image of the operator that will be retained (for master builds or releases) without a specific tag:
@@ -50,12 +58,12 @@ jobs:
50
58
# Dependencies are cached by default: https://github.com/actions/setup-go#v4
51
59
# This can be explicitly disabled if it ever causes problems.
52
60
53
- - name : Build the container image
61
+ - name : Build the BeeGFS CSI driver binaries and assemble chwrap tar files for each architecture
54
62
run : |
55
63
export SHELL=/bin/bash
56
- make container
57
- echo -n "verifying images :"
58
- docker images
64
+ make BUILD_PLATFORMS="${{ env.RELEASE_TOOLS_BUILD_PLATFORMS }}" all
65
+ echo -n "built artifacts :"
66
+ ls -alh bin/
59
67
60
68
- name : Install test dependencies
61
69
run : |
75
83
# TODO: Can we cache anything here? test-vendor downloads a lot of stuff.
76
84
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go#caching-dependencies
77
85
86
+ - name : Set up Docker Buildx
87
+ uses : docker/setup-buildx-action@v3
88
+
78
89
- name : Log into the GitHub Container Registry
79
90
uses : docker/login-action@v2
80
91
with :
@@ -84,10 +95,58 @@ jobs:
84
95
85
96
# Push the image for reuse in subsequent steps, jobs, and workflows.
86
97
# For now just tag with the commit ID to ensure subsequent jobs in this workflow run use the correct image.
87
- - name : Tag and push the CSI driver as a test package
98
+ # This uses the Git sha: https://github.com/docker/metadata-action?tab=readme-ov-file#typesha
99
+ - name : Extract metadata for test CSI driver container image
100
+ id : meta
101
+ uses : docker/metadata-action@v4
102
+ with :
103
+ images : |
104
+ ${{ env.TEST_IMAGE_NAME }}
105
+ tags : |
106
+ type=sha,enable=true,priority=100,prefix=,suffix=,format=long
107
+
108
+ - name : Build and push test container images for each supported platform
109
+
110
+ id : build-and-push
111
+ with :
112
+ context : .
113
+ platforms : " ${{ env.DOCKER_BUILDX_BUILD_PLATFORMS }}"
114
+ push : true
115
+ tags : ${{ steps.meta.outputs.tags }}
116
+ labels : ${{ steps.meta.outputs.labels }}
117
+ # If provenance is not set to false then the manifest list will contain unknown platform
118
+ # entries that are also displayed in GitHub. Some detail on why this is needed in:
119
+ # https://github.com/docker/buildx/issues/1509 and
120
+ # https://github.com/docker/build-push-action/issues/755#issuecomment-1607792956.
121
+ provenance : false
122
+ # Reference: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#adding-a-description-to-multi-arch-images
123
+ outputs : type=image,name=target,annotation-index.org.opencontainers.image.description=The BeeGFS Container Storage Interface (CSI) driver provides high performing and scalable storage for workloads running in Kubernetes,org.opencontainers.image.source=https://github.com/ThinkParQ/beegfs-csi-driver,org.opencontainers.image.licenses=Apache-2.0
124
+
125
+
126
+ - name : Install Cosign
127
+
128
+ with :
129
+ cosign-release : " v2.1.1"
130
+
131
+ # Adapted from:
132
+ # https://github.blog/2021-12-06-safeguard-container-signing-capability-actions/
133
+ # https://github.com/sigstore/cosign-installer#usage
134
+ - name : Sign CSI driver images for each platform with Cosign
88
135
run : |
89
- docker tag beegfs-csi-driver:latest ${{ env.TEST_IMAGE_NAME }}:${{ github.sha }}
90
- docker push ${{ env.TEST_IMAGE_NAME }}:${{ github.sha }}
136
+ images=""
137
+ for tag in ${TAGS}; do
138
+ images+="${tag}@${DIGEST} "
139
+ done
140
+ cosign sign --yes --key env://COSIGN_PRIVATE_KEY \
141
+ -a "repo=${{ github.repository }}" \
142
+ -a "run=${{ github.run_id }}" \
143
+ -a "ref=${{ github.sha }}" \
144
+ ${images}
145
+ env :
146
+ TAGS : ${{ steps.meta.outputs.tags }}
147
+ COSIGN_PRIVATE_KEY : ${{ secrets.COSIGN_PRIVATE_KEY }}
148
+ COSIGN_PASSWORD : ${{ secrets.COSIGN_PASSWORD }}
149
+ DIGEST : ${{ steps.build-and-push.outputs.digest }}
91
150
92
151
# TODO: Cache this dependency for reuse here and in e2e tests.
93
152
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go#caching-dependencies
@@ -128,6 +187,12 @@ jobs:
128
187
cd operator
129
188
make -e IMG=${{ env.OPERATOR_TEST_IMAGE_NAME }}:${{ github.sha }} -e BUNDLE_IMG=${{ env.OPERATOR_TEST_BUNDLE_NAME }}:${{ github.sha }} bundle bundle-build bundle-push
130
189
190
+ - name : Upload artifacts
191
+ uses : actions/upload-artifact@v4
192
+ with :
193
+ name : beegfs-csi-driver-artifacts
194
+ path : bin/
195
+
131
196
e2e-tests :
132
197
runs-on : ubuntu-22.04
133
198
timeout-minutes : 10
0 commit comments