-
Notifications
You must be signed in to change notification settings - Fork 86
102 lines (88 loc) · 3.37 KB
/
images.yaml
File metadata and controls
102 lines (88 loc) · 3.37 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
name: Build images
on:
pull_request:
branches:
- 'main'
permissions: {}
jobs:
build-images:
concurrency:
# If a previous run is ongoing with the same head_ref (it's a run on the
# same PR) then cancel it to save time. If it isn't a PR, only cancel the
# previous run if it's on the same commit SHA. This prevents a run for a
# commit push from cancelling a previous commit push's build, since we
# want an image built and tagged for each commit.
group: build-images-${{ matrix.image }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true
permissions:
contents: read # Read the repo contents.
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
- executor
- executor-debug
- executor-slim
- warmer
include:
- image: executor
target: kaniko-executor
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
image-name: gcr.io/kaniko-project/executor
tag: ${{ github.sha }}
release-tag: latest
- image: executor-debug
target: kaniko-debug
platforms: linux/amd64,linux/arm64,linux/s390x
image-name: gcr.io/kaniko-project/executor
tag: ${{ github.sha }}-debug
release-tag: debug
- image: executor-slim
target: kaniko-slim
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
image-name: gcr.io/kaniko-project/executor
tag: ${{ github.sha }}-slim
release-tag: slim
- image: warmer
target: kaniko-warmer
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
image-name: gcr.io/kaniko-project/warmer
tag: ${{ github.sha }}
release-tag: latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
# Don't build for all platforms on PRs.
- id: platforms
run: |
event="${{ github.event_name }}"
if [[ "$event" == "pull_request" ]]; then
echo "platforms=linux/amd64" >> $GITHUB_OUTPUT
else
platforms="${{ matrix.platforms }}"
echo "platforms=${platforms}" >> $GITHUB_OUTPUT
fi
# Build and push with Docker.
- uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
with:
platforms: ${{ matrix.platforms }}
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
id: build-and-push
with:
context: .
file: ./deploy/Dockerfile
platforms: ${{ steps.platforms.outputs.platforms }}
push: false
tags: ${{ matrix.image-name }}:${{ matrix.tag }}
no-cache-filters: certs
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#github-cache
cache-from: type=gha
cache-to: type=gha,mode=max
target: ${{ matrix.target }}