1
- # Copyright 2023 NVIDIA CORPORATION
1
+ # Copyright 2024 NVIDIA CORPORATION
2
2
#
3
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
4
# you may not use this file except in compliance with the License.
12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
- name : Images
15
+ # Run this workflow on pull requests or merge to main/release branches
16
+ name : Image
16
17
17
- # Run this workflow on pull requests
18
18
on :
19
19
pull_request :
20
20
types :
29
29
- release-*
30
30
31
31
jobs :
32
- build-image :
33
- # We trigger image builds on push events (MERGED pull requests) or on non-closed PRs that are not created against a fork.
34
- if : |
35
- (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
36
- (github.event_name == 'push')
32
+ build :
37
33
runs-on : ubuntu-latest
38
34
strategy :
39
35
matrix :
40
- dist : [ubuntu20.04]
36
+ dist : [ubuntu20.04, ubi8 ]
41
37
steps :
42
38
- uses : actions/checkout@v4
43
-
39
+ name : Check out code
44
40
- name : Calculate build vars
45
41
id : vars
46
42
run : |
@@ -49,28 +45,31 @@ jobs:
49
45
REPO_FULL_NAME="${{ github.event.pull_request.head.repo.full_name }}"
50
46
echo "${REPO_FULL_NAME}"
51
47
echo "LABEL_IMAGE_SOURCE=https://github.com/${REPO_FULL_NAME}" >> $GITHUB_ENV
48
+
49
+ GENERATE_ARTIFACTS="false"
52
50
if [[ "${{ github.actor }}" == "dependabot[bot]" ]]; then
53
- echo "PUSH_ON_BUILD=false" >> $GITHUB_ENV
54
- else
55
- echo "PUSH_ON_BUILD=true" >> $GITHUB_ENV
51
+ GENERATE_ARTIFACTS="false"
52
+ elif [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.head.repo.full_name }}" == "${{ github.repository }}" ]]; then
53
+ GENERATE_ARTIFACTS="true"
54
+ elif [[ "${{ github.event_name }}" == "push" ]]; then
55
+ GENERATE_ARTIFACTS="true"
56
56
fi
57
-
57
+ echo "PUSH_ON_BUILD=${GENERATE_ARTIFACTS}" >> $GITHUB_ENV
58
+ echo "BUILD_MULTI_ARCH_IMAGES=${GENERATE_ARTIFACTS}" >> $GITHUB_ENV
59
+ - name : Set up QEMU
60
+ uses : docker/setup-qemu-action@v3
58
61
- name : Set up Docker Buildx
59
62
uses : docker/setup-buildx-action@v3
60
-
61
63
- name : Login to GitHub Container Registry
62
64
uses : docker/login-action@v3
63
65
with :
64
66
registry : ghcr.io
65
67
username : ${{ github.actor }}
66
68
password : ${{ secrets.GITHUB_TOKEN }}
67
-
68
69
- name : Build image
69
70
env :
70
- IMAGE_NAME : ghcr.io/${LOWERCASE_REPO_OWNER}/k8s-dra-driver
71
+ IMAGE_NAME : ghcr.io/${LOWERCASE_REPO_OWNER}/k8s-device-plugin
71
72
VERSION : ${COMMIT_SHORT_SHA}
72
- # TODO: For now we only build single-arch images to speed up development.
73
- BUILD_MULTI_ARCH_IMAGES : " false"
74
73
run : |
75
74
echo "${VERSION}"
76
75
make -f deployments/container/Makefile build-${{ matrix.dist }}
0 commit comments