-
Notifications
You must be signed in to change notification settings - Fork 88
88 lines (86 loc) · 2.96 KB
/
csi_wrapper_images.yaml
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
# (C) Copyright Confidential Containers Contributors 2023.
# SPDX-License-Identifier: Apache-2.0
#
# Build and push csi wrapper images for each arch.
---
name: (Callable) Build and push CSI wrapper images
on:
workflow_call:
inputs:
registry:
default: 'quay.io/confidential-containers'
description: 'Image registry (e.g. "ghcr.io/confidential-containers") where the built image will be pushed to'
required: false
type: string
image_tags:
description: 'Comma-separated list of tags for the dev built image (e.g. latest,ci-dev). By default uses the values from src/cloud-api-adaptor/hack/build.sh'
required: true
type: string
git_ref:
default: 'main'
description: Git ref to checkout the cloud-api-adaptor repository. Defaults to main.
required: false
type: string
jobs:
build_push_job:
name: build and push
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
binary:
- csi-controller-wrapper
- csi-node-wrapper
- csi-podvm-wrapper
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "${{ inputs.git_ref }}"
- name: Read properties from versions.yaml
run: |
go_version="$(yq '.tools.golang' src/cloud-api-adaptor/versions.yaml)"
[ -n "$go_version" ]
echo "GO_VERSION=${go_version}" >> "$GITHUB_ENV"
- name: Setup Golang version ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: "**/go.sum"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to quay Container Registry
if: ${{ startsWith(inputs.registry, 'quay.io') }}
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Login to Github Container Registry
if: ${{ startsWith(inputs.registry, 'ghcr.io') }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine tags
id: tags
run: |
tags="${{ inputs.image_tags }}"
tags_new=""
for t in ${tags/,/ }; do
tags_new+="${{ inputs.registry }}/${{matrix.binary}}:${t},"
done
echo "tags=${tags_new}" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v6
with:
tags: ${{ steps.tags.outputs.tags }}
push: true
context: src
platforms: linux/amd64, linux/s390x, linux/ppc64le
file: src/csi-wrapper/Dockerfile.csi_wrappers
build-args: |
"BINARY=${{matrix.binary}}"
"SOURCE_FROM=local"