-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (118 loc) · 3.59 KB
/
build.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Copyright (C) Nicolas Lamirault <nicolas.lamirault@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
---
name: Image / Build
on: # yamllint disable-line rule:truthy
merge_group:
workflow_dispatch:
schedule:
- cron: "0 6,18 * * *" # 6am and 6pm every day
pull_request:
paths:
- apko.yaml
- melange.yaml
- "hack/scripts/**"
- "deps.sh"
push:
paths:
- apko.yaml
- melange.yaml
- "hack/scripts/**"
- "deps.sh"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
ARCHS: x86_64,aarch64 #,armv7
FULCIO_URL: https://fulcio.sigstore.dev
REKOR_URL: https://rekor.sigstore.dev
jobs:
build:
name: Build OCI image
runs-on: ubuntu-latest
# https://docs.github.com/en/actions/reference/authentication-in-a-workflow
permissions:
contents: read
packages: write
# Required for keyless signing with fulcio
id-token: write
steps:
- uses: actions/checkout@v4
- name: Populate workspace
shell: bash
run: |
echo ".github/" >> .melangeignore && tree -a . \
&& sudo rm -rf /work && sudo mkdir /work
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
sep-tags: ' '
- name: Dependencies
run: ./deps.sh
- name: Install Cosign
uses: sigstore/cosign-installer@main
- name: Run Melange
uses: chainguard-dev/actions/melange-build@main
with:
config: melange.yaml
archs: ${{ env.ARCHS }}
signing-key-path: /work/melange.rsa
repository-path: /work/packages
empty-workspace: false
sign-with-temporary-key: true
- name: Create temp copy of /work directory (used in next step)
shell: bash
run: |
rm -rf .apko-automount && cp -r /work .apko-automount
- name: Run Apko
uses: chainguard-images/actions/apko-build@main
id: apko-build
with:
config: apko.yaml
archs: ${{ env.ARCHS }}
tag: ${{ steps.meta.outputs.tags }}
keyring-append: /work/melange.rsa.pub
automount-src: .apko-automount/.
automount-dest: /work
- name: Load image from apko-produced tarball
shell: bash
run: |
docker load < output.tar
- name: Run apko publish
uses: chainguard-images/actions/apko-publish@main
id: apko-publish
with:
config: apko.yaml
archs: ${{ env.ARCHS }}
tag: ${{ steps.meta.outputs.tags }}
keyring-append: /work/melange.rsa.pub
automount-src: .apko-automount/.
automount-dest: /work
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: image
image-ref: ${{ steps.apko-publish.outputs.digest }}
format: table
exit-code: '1'
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'