11
11
# Location where source repo. will be cloned
12
12
CIRRUS_WORKING_DIR : " /var/tmp/netavark"
13
13
# Rust package cache also lives here
14
- CARGO_HOME : " /usr/local/cargo"
14
+ CARGO_HOME : " /var/cache/cargo"
15
+ # Rust compiler output lives here (see Makefile)
16
+ CARGO_TARGET_DIR : " $CIRRUS_WORKING_DIR/targets"
15
17
# Save a little typing (path relative to $CIRRUS_WORKING_DIR)
16
18
SCRIPT_BASE : " ./contrib/cirrus"
17
19
FEDORA_NAME : " fedora-35"
@@ -46,35 +48,40 @@ build_task:
46
48
# okay, as the cache still provides a benefit vs constantly hitting the
47
49
# RPM repos. Use of this cache depends on dnf arguments passed in setup.sh
48
50
folder : " /var/cache/dnf"
49
- # This is significant, Cirrus-CI will automatically store separate
50
- # caches for branches & PRs. We use the branch-name here mainly to
51
- # distinguish PR-level caches in order to properly support backport-PRs
52
- # to release branches. Otherwise all PRs & branches will share caches
53
- # with other PRs and branches (for a given $DEST_BRANCH value).
54
51
fingerprint_key : " pkg_${DEST_BRANCH}"
55
52
reupload_on_changes : true # required since fingerprint_key is defined
56
53
cargo_cache : &cargo_cache
57
- # Populating this cache requires both setup.sh and `make all` to run
58
- # an actual build. It takes about 10-minutes when starting from scratch,
59
- # so caching this folder is important.
54
+ # Populating this cache depends on execution of setup.sh, and runner.sh
55
+ # to builds of all release, debug, plus unit-tests.
60
56
folder : " $CARGO_HOME"
61
- # This cache is only about 100mb, but involves compiling. Make it
62
- # available across all PR's and Branches (separately) based on the
63
- # $DEST_BRANCH value.
64
- fingerprint_key : " cargo_${DEST_BRANCH}"
57
+ # Cirrus-CI will automatically store separate caches for branches vs PRs.
58
+ # We use the branch-name here mainly to distinguish PR-level caches in
59
+ # order to properly support backport-PRs to release branches. Otherwise
60
+ # all PRs & branches will share caches with other PRs and branches
61
+ # for a given $DEST_BRANCH and vX value. Adjust vX if cache schema
62
+ # changes.
63
+ fingerprint_key : " cargo_v1_${DEST_BRANCH}"
64
+ # Required to be set explicitly since fingerprint_key is also set
65
+ reupload_on_changes : true
66
+ targets_cache : &targets_cache
67
+ # Similar to cargo_cache, but holds the actual compiled artifacts. This must
68
+ # be scoped similar to bin_cache to avoid binary pollution across cache
69
+ # contexts. For example, two PRs that happen to coincidentally change
70
+ # and use cache. Adjust vX if cache schema changes.
71
+ folder : " $CARGO_TARGET_DIR"
72
+ fingerprint_key : " targets_v1_${CIRRUS_BUILD_ID}" # Cache only within same build
65
73
reupload_on_changes : true
66
74
bin_cache : &bin_cache
67
- # This isn't very significant, it simply prevents rebuilding the
68
- # binaries for every subsequent task - Saving about 3-5 minutes.
75
+ # This simply prevents rebuilding bin/netavark for every subsequent task.
69
76
folder : " $CIRRUS_WORKING_DIR/bin"
70
- # This is likely to change frequently, keep cache limited to ONLY this
71
- # specific CI run (a.k.a. "build") .
72
- fingerprint_key : " bin_ ${CIRRUS_BUILD_ID}" # Cache only within the same build
77
+ # Avoid binary pollution by scoping this to only this specific build.
78
+ # Adjust vX if cache schema changes .
79
+ fingerprint_key : " bin_v1_ ${CIRRUS_BUILD_ID}" # Cache only within same build
73
80
reupload_on_changes : true
74
81
setup_script : &setup "$SCRIPT_BASE/setup.sh"
75
82
upload_caches : [ "pkg" ] # Upload now, in case of main_script failure
76
83
main_script : &main "$SCRIPT_BASE/runner.sh $CIRRUS_TASK_NAME"
77
- upload_caches : [ "cargo", "bin" ]
84
+ upload_caches : [ "cargo", "targets", " bin" ]
78
85
79
86
80
87
validate_task :
@@ -90,6 +97,9 @@ validate_task:
90
97
cargo_cache : &ro_cargo_cache
91
98
<< : *cargo_cache
92
99
reupload_on_changes : false
100
+ targets_cache : &ro_targets_cache
101
+ << : *targets_cache
102
+ reupload_on_changes : false
93
103
bin_cache : &ro_bin_cache
94
104
<< : *bin_cache
95
105
reupload_on_changes : false
@@ -103,6 +113,7 @@ unit_task:
103
113
- " validate"
104
114
pkg_cache : *ro_pkg_cache # TODO: Remove when packages included in static VM images
105
115
cargo_cache : *ro_cargo_cache
116
+ targets_cache : *ro_targets_cache
106
117
bin_cache : *ro_bin_cache
107
118
setup_script : *setup
108
119
main_script : *main
@@ -114,6 +125,7 @@ integration_task:
114
125
- " unit"
115
126
pkg_cache : *ro_pkg_cache # TODO: Remove when packages included in static VM images
116
127
cargo_cache : *ro_cargo_cache
128
+ targets_cache : *ro_targets_cache
117
129
bin_cache : *ro_bin_cache
118
130
setup_script : *setup
119
131
main_script : *main
@@ -137,7 +149,7 @@ meta_task:
137
149
GCPJSON : ENCRYPTED[e7e6e13b98eb34f480a12412a048e3fb78a02239c229659e136b7a27e2ab25a5bbb61ab6016e322cb6f777fa2c9f9520]
138
150
GCPNAME : ENCRYPTED[f3fc6da8fe283ef506d7b18467a81153ea8e18b1d3cd76e79dcd6f566f20fdd3651522432d3d232f4d69eeb1502d1f6b]
139
151
GCPPROJECT : libpod-218412
140
- clone_script : &noop /bin/true # source not needed
152
+ clone_script : &noop mkdir -p $CIRRUS_WORKING_DIR # source not needed
141
153
script : /usr/local/bin/entrypoint.sh
142
154
143
155
@@ -148,11 +160,17 @@ success_task:
148
160
- " build"
149
161
- " validate"
150
162
- " unit"
151
- # - "integration"
163
+ - " integration"
152
164
- " meta"
153
- container :
154
- image : quay.io/libpod/alpine:latest
155
165
env :
156
166
CIRRUS_SHELL : " /bin/sh"
157
167
clone_script : *noop
158
- script : *noop
168
+ bin_cache : *ro_bin_cache
169
+ # The paths used for uploaded artifacts are relative here and in Cirrus
170
+ script :
171
+ - mv bin/* ./
172
+ - rm -rf bin
173
+ # Upload tested binary for consumption downstream
174
+ # https://cirrus-ci.org/guide/writing-tasks/#artifacts-instruction
175
+ binary_artifacts :
176
+ path : ./*netavark*
0 commit comments