forked from containers/netavark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.cirrus.yml
216 lines (196 loc) · 6.51 KB
/
.cirrus.yml
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
---
# Format Ref: https://cirrus-ci.org/guide/writing-tasks/
# Main collection of env. vars to set for all tasks and scripts.
env:
# Actual|intended branch for this run
DEST_BRANCH: "main"
# The default is 'sh' if unspecified
CIRRUS_SHELL: "/bin/bash"
# Location where source repo. will be cloned
CIRRUS_WORKING_DIR: "/var/tmp/netavark"
# Rust package cache also lives here
CARGO_HOME: "/var/cache/cargo"
# Rust compiler output lives here (see Makefile)
CARGO_TARGET_DIR: "$CIRRUS_WORKING_DIR/targets"
# Save a little typing (path relative to $CIRRUS_WORKING_DIR)
SCRIPT_BASE: "./contrib/cirrus"
FEDORA_NAME: "fedora-35"
IMAGE_SUFFIX: "c6118659411148800"
FEDORA_NETAVARK_IMAGE: "fedora-netavark-${IMAGE_SUFFIX}"
gcp_credentials: ENCRYPTED[d6efdb7d6d4c61e3831df2193ca6348bb02f26cd931695f69d41930b1965f7dab72a838ca0902f6ed8cde66c7deddae2]
# Default VM to use unless set or modified by task
gce_instance: &standard_vm
image_project: "libpod-218412"
zone: "us-central1-c"
cpu: 2
memory: "4Gb"
disk: 200 # GB, do not set <200 per gcloud warning re: I/O performance
image_name: "${FEDORA_NETAVARK_IMAGE}"
build_task:
alias: "build"
# Compiling is very CPU intensive, make it chooch quicker for this task only
gce_instance:
<<: *standard_vm
cpu: 8
memory: "8Gb"
cargo_cache: &cargo_cache
# Populating this cache depends on execution of setup.sh, and runner.sh
# to builds of all release, debug, plus unit-tests.
folder: "$CARGO_HOME"
# Cirrus-CI will automatically store separate caches for branches vs PRs.
# We use the branch-name here mainly to distinguish PR-level caches in
# order to properly support backport-PRs to release branches. Otherwise
# all PRs & branches will share caches with other PRs and branches
# for a given $DEST_BRANCH and vX value. Adjust vX if cache schema
# changes.
fingerprint_key: "cargo_v1_${DEST_BRANCH}"
# Required to be set explicitly since fingerprint_key is also set
reupload_on_changes: true
targets_cache: &targets_cache
# Similar to cargo_cache, but holds the actual compiled artifacts. This must
# be scoped similar to bin_cache to avoid binary pollution across cache
# contexts. For example, two PRs that happen to coincidentally change
# and use cache. Adjust vX if cache schema changes.
folder: "$CARGO_TARGET_DIR"
fingerprint_key: "targets_v1_${CIRRUS_BUILD_ID}" # Cache only within same build
reupload_on_changes: true
bin_cache: &bin_cache
# This simply prevents rebuilding bin/netavark for every subsequent task.
folder: "$CIRRUS_WORKING_DIR/bin"
# Avoid binary pollution by scoping this to only this specific build.
# Adjust vX if cache schema changes.
fingerprint_key: "bin_v1_${CIRRUS_BUILD_ID}" # Cache only within same build
reupload_on_changes: true
setup_script: &setup "$SCRIPT_BASE/setup.sh"
main_script: &main "$SCRIPT_BASE/runner.sh $CIRRUS_TASK_NAME"
upload_caches: [ "cargo", "targets", "bin" ]
validate_task:
alias: "validate"
depends_on:
- "build"
# From this point forward, all cache's become read-only - meaning
# any changes made in this task aren't re-uploaded to the cache.
# This avoids some flapping between tasks, along with the upload time.
cargo_cache: &ro_cargo_cache
<<: *cargo_cache
reupload_on_changes: false
targets_cache: &ro_targets_cache
<<: *targets_cache
reupload_on_changes: false
bin_cache: &ro_bin_cache
<<: *bin_cache
reupload_on_changes: false
setup_script: *setup
main_script: *main
verify_vendor_task:
alias: "verify_vendor"
depends_on:
- "build"
cargo_cache: *ro_cargo_cache
targets_cache: *ro_targets_cache
bin_cache: *ro_bin_cache
setup_script: *setup
main_script: *main
unit_task:
alias: "unit"
depends_on:
- "build"
cargo_cache: *ro_cargo_cache
targets_cache: *ro_targets_cache
bin_cache: *ro_bin_cache
setup_script: *setup
main_script: *main
build_cross_task:
alias: "build_cross"
depends_on:
- "build"
cargo_cache: *ro_cargo_cache
targets_cache: *ro_targets_cache
bin_cache: *ro_bin_cache
setup_script: *setup
main_script: *main
integration_task:
alias: "integration"
depends_on:
- "unit"
cargo_cache: *ro_cargo_cache
targets_cache: *ro_targets_cache
bin_cache: *ro_bin_cache
setup_script: *setup
main_script: *main
# This task is critical. It updates the "last-used by" timestamp stored
# in metadata for all VM images. This mechanism functions in tandem with
# an out-of-band pruning operation to remove disused VM images.
meta_task:
alias: meta
name: "VM img. keepalive"
container:
cpu: 2
memory: 2
image: quay.io/libpod/imgts:$IMAGE_SUFFIX
env:
# Space-separated list of images used by this repository state
IMGNAMES: "${FEDORA_NETAVARK_IMAGE}"
BUILDID: "${CIRRUS_BUILD_ID}"
REPOREF: "${CIRRUS_REPO_NAME}"
GCPJSON: ENCRYPTED[e7e6e13b98eb34f480a12412a048e3fb78a02239c229659e136b7a27e2ab25a5bbb61ab6016e322cb6f777fa2c9f9520]
GCPNAME: ENCRYPTED[f3fc6da8fe283ef506d7b18467a81153ea8e18b1d3cd76e79dcd6f566f20fdd3651522432d3d232f4d69eeb1502d1f6b]
GCPPROJECT: libpod-218412
clone_script: &noop mkdir -p $CIRRUS_WORKING_DIR # source not needed
script: /usr/local/bin/entrypoint.sh
fedora36_build_task:
alias: fedora36_build
depends_on:
- "build"
container:
cpu: 2
memory: 2
image: quay.io/libpod/fedora36rust
script:
- cargo build
ubuntu20_build_task:
alias: ubuntu20_build
depends_on:
- "build"
container:
cpu: 2
memory: 2
image: quay.io/libpod/ubuntu20rust
script:
- cargo build
centos9_build_task:
alias: centos9_build
depends_on:
- "build"
container:
cpu: 2
memory: 2
image: quay.io/libpod/centos9rust
script:
- cargo build
success_task:
name: "Total success"
alias: success
depends_on:
- "build"
- "build_cross"
- "validate"
- "verify_vendor"
- "unit"
- "integration"
- "meta"
- "fedora36_build"
- "ubuntu20_build"
- "centos9_build"
env:
CIRRUS_SHELL: "/bin/sh"
clone_script: *noop
bin_cache: *ro_bin_cache
# The paths used for uploaded artifacts are relative here and in Cirrus
script:
- mv bin/* ./
- rm -rf bin
# Upload tested binary for consumption downstream
# https://cirrus-ci.org/guide/writing-tasks/#artifacts-instruction
binary_artifacts:
path: ./*netavark*