-
Notifications
You must be signed in to change notification settings - Fork 144
189 lines (167 loc) · 6.42 KB
/
Copy pathbuild.yaml
File metadata and controls
189 lines (167 loc) · 6.42 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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Build and attest all
on:
push:
branches: [main]
pull_request:
branches: [main]
# See https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build_attest_all:
strategy:
fail-fast: false
matrix:
buildconfig:
- buildconfigs/endorscope_cli.sh
- buildconfigs/key_xor_test_app.sh
- buildconfigs/oak_containers_agent.sh
- buildconfigs/oak_containers_kernel.sh
- buildconfigs/oak_containers_orchestrator.sh
- buildconfigs/oak_containers_stage1.sh
- buildconfigs/oak_containers_syslogd.sh
- buildconfigs/oak_containers_system_image.sh
- buildconfigs/oak_containers_nvidia_system_image.sh
- buildconfigs/oak_echo_enclave_app.sh
- buildconfigs/oak_echo_raw_enclave_app.sh
- buildconfigs/oak_functions_enclave_app.sh
- buildconfigs/oak_functions_insecure_enclave_app.sh
- buildconfigs/oak_orchestrator.sh
- buildconfigs/oak_restricted_kernel_simple_io_channel.sh
- buildconfigs/oak_restricted_kernel_virtio_console_channel.sh
- buildconfigs/private_memory_server.sh
- buildconfigs/stage0_bin.sh
- buildconfigs/stage0_bin_tdx.sh
permissions:
actions: read
id-token: write
attestations: write
contents: read
runs-on: ubuntu-24.04
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
steps:
# Needed for GCS upload.
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v3
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY_JSON }}
# Needed for GCS upload.
- name: Setup Google Cloud
uses: google-github-actions/setup-gcloud@v3
- name: Mount main branch
uses: actions/checkout@v4
# The following needs review, since we migrated to Ubuntu2404.
#
# The runner comes with all this software pre-installed:
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2004-Readme.md
# To avoid failures due to lack of disk space, we delete some large packages
# which are irrelevant for building. Sources:
# https://github.com/jens-maus/RaspberryMatic/blob/ea6b8ce0dd2d53ea88b2766ba8d7f8e1d667281f/.github/workflows/ci.yml#L34-L40
# https://github.com/actions/runner-images/issues/2875
# https://github.com/actions/runner-images/issues/10386
- name: Free disk space
run: |
set -o errexit
set -o xtrace
df --human-readable
sudo apt-get remove --yes \
'^dotnet-.*' '^llvm-.*' 'php.*' \
'^haskell-.*' '^ghc-.*' '^cabal-.*' \
google-chrome-stable firefox microsoft-edge-stable \
azure-cli powershell
df --human-readable
sudo apt-get autoremove --yes
df --human-readable
sudo apt clean
df --human-readable
sudo rm --recursive --force "${AGENT_TOOLSDIRECTORY}"
df --human-readable
sudo rm --recursive --force /usr/local/.ghcup
df --human-readable
sudo rm --recursive --force /opt/ghc
df --human-readable
sudo rm --recursive --force /usr/share/dotnet
df --human-readable
dpkg --list
# Keeps two versions of SUBJECT_PATHS, with space resp. comma as
# path separator. Both are needed in later steps.
- name: Parse buildconfig
id: parse
run: |
set -o errexit
set -o nounset
set -o pipefail
source ${{ matrix.buildconfig }}
echo "package-name=${PACKAGE_NAME}" >> "${GITHUB_OUTPUT}"
paths="${SUBJECT_PATHS[@]}"
echo "subject-paths=${paths}" >> "${GITHUB_OUTPUT}"
echo "subject-paths-commas=${paths// /,}" >> "${GITHUB_OUTPUT}"
- name: Show values
run: |
set -o errexit
set -o nounset
set -o pipefail
gsutil --version
echo "package_name: ${{ steps.parse.outputs.package-name }}"
echo "subject_paths: ${{ steps.parse.outputs.subject-paths }}"
echo "subject_paths_commas: ${{ steps.parse.outputs.subject-paths-commas }}"
echo "GITHUB_SHA: ${GITHUB_SHA}"
- name: Build
id: build
run: |
set -o errexit
set -o nounset
set -o pipefail
source ${{ matrix.buildconfig }}
KOKORO_JOB_TYPE=CONTINUOUS_INTEGRATION
source kokoro/helpers/common.sh
configure_common_env
configure_bazelrc
scripts/docker_pull
scripts/docker_run "${BUILD_COMMAND[@]}"
- name: Show build artifacts
run: |
echo "${{ steps.parse.outputs.subject-paths }}"
ls -la ${{ steps.parse.outputs.subject-paths }}
for output in ${{ steps.parse.outputs.subject-paths }}
do
sha256sum "$output"
done
- name: Attest
id: attest
uses: actions/attest-build-provenance@v2
with:
subject-path: ${{ steps.parse.outputs.subject-paths-commas }}
- name: Show bundle
run: |
echo "${{ steps.attest.outputs.bundle-path }}"
ls -la "${{ steps.attest.outputs.bundle-path }}"
cat "${{ steps.attest.outputs.bundle-path }}"
# Upload binary and provenance to GitHub.
- name: Upload to GitHub
uses: actions/upload-artifact@v4
with:
name: ${{ steps.parse.outputs.package-name }}
path: |
${{ steps.parse.outputs.subject-paths }}
${{ steps.attest.outputs.bundle-path }}
retention-days: 7
# Upload binary and provenance to GCS.
- name: Upload
id: upload
run: |
set -o errexit
set -o nounset
set -o pipefail
set -o xtrace
package_name=${{ steps.parse.outputs.package-name }}
subject_paths=( ${{ steps.parse.outputs.subject-paths }} )
binary_path="${subject_paths[0]}"
provenance_path=${{ steps.attest.outputs.bundle-path }}
scripts/publish \
"${binary_path}" \
"${provenance_path}" \
"sha1:${GITHUB_SHA}" \
"${package_name}"