@@ -215,91 +215,118 @@ assets::get(){
215
215
# Script
216
216
# #####################
217
217
218
- docker_args=(docker build -t test-integration --target test-integration)
219
-
220
- for dep in " ${dependencies[@]} " ; do
221
- shortname=" ${dep##*/ } "
222
- [ " $shortname " != " plugins" ] || shortname=" cni-plugins"
223
- [ " $shortname " != " fuse-overlayfs-snapshotter" ] || shortname=" containerd-fuse-overlayfs"
224
- for bl in " ${blacklist[@]} " ; do
225
- if [ " $bl " == " $shortname " ]; then
226
- log::warning " Dependency $shortname is blacklisted and will be left to its currently pinned version"
227
- break
228
- fi
229
- done
230
- [ " $bl " != " $shortname " ] || continue
231
-
232
- shortsafename=" $( printf " %s" " $shortname " | tr ' [:lower:]' ' [:upper:]' | tr ' -' ' _' ) "
233
-
234
- exclusion=" ${shortsafename} _EXCLUDE"
235
- latest::release " $dep " " ${! exclusion:- } "
236
-
237
- # XXX containerd does not display "v" in its released versions
238
- [ " ${higher_readable: 0: 1} " == v ] || higher_readable=" v$higher_readable "
239
-
240
- checksum=" ${shortsafename} _CHECKSUM"
241
- if [ " ${! checksum:- } " != " " ]; then
242
- # Checksum file
243
- checksum_file=./Dockerfile.d/SHA256SUMS.d/" ${shortname} -${higher_readable} "
244
- if [ ! -e " $checksum_file " ]; then
245
- # Get assets - try first os/arch - fallback on gnu style arch otherwise
246
- assets=()
247
-
248
- # Most well behaved go projects will tag with a go os and arch
249
- candidate=" $( assets::get " ${! checksum:- } " " amd64" ) "
250
- # Then non go projects tend to use gnu style
251
- [ " $candidate " != " " ] || candidate=" $( assets::get " " " x86_64" ) "
252
- # And then some projects which are linux only do not specify the OS
253
- [ " $candidate " != " " ] || candidate=" $( assets::get " " " amd64" ) "
254
- [ " $candidate " == " " ] || assets+=(" $candidate " )
255
-
256
- candidate=" $( assets::get " ${! checksum:- } " " arm64" ) "
257
- [ " $candidate " != " " ] || candidate=" $( assets::get " " " aarch64" ) "
258
- [ " $candidate " != " " ] || candidate=" $( assets::get " " " arm64" ) "
259
- [ " $candidate " == " " ] || assets+=(" $candidate " )
260
- # Fallback to source if there is nothing else
261
-
262
- [ " ${# assets[@]} " != 0 ] || candidate=" $( assets::get " " " source" ) "
263
- [ " $candidate " == " " ] || assets+=(" $candidate " )
264
-
265
- # XXX very special...
266
- if [ " $shortsafename " == " STARGZ_SNAPSHOTTER" ]; then
267
- assets+=(" https://raw.githubusercontent.com/containerd/stargz-snapshotter/${higher_readable} /script/config/etc/systemd/system/stargz-snapshotter.service" )
218
+ canary::build::integration (){
219
+ docker_args=(docker build -t test-integration --target test-integration)
220
+
221
+ for dep in " ${dependencies[@]} " ; do
222
+ shortname=" ${dep##*/ } "
223
+ [ " $shortname " != " plugins" ] || shortname=" cni-plugins"
224
+ [ " $shortname " != " fuse-overlayfs-snapshotter" ] || shortname=" containerd-fuse-overlayfs"
225
+ for bl in " ${blacklist[@]} " ; do
226
+ if [ " $bl " == " $shortname " ]; then
227
+ log::warning " Dependency $shortname is blacklisted and will be left to its currently pinned version"
228
+ break
268
229
fi
269
-
270
- # Write the checksum for what we found
271
- if [ " ${# assets[@]} " == 0 ]; then
272
- log::error " No asset found for this checksum-able dependency. Dropping off."
273
- exit 1
230
+ done
231
+ [ " $bl " != " $shortname " ] || continue
232
+
233
+ shortsafename=" $( printf " %s" " $shortname " | tr ' [:lower:]' ' [:upper:]' | tr ' -' ' _' ) "
234
+
235
+ exclusion=" ${shortsafename} _EXCLUDE"
236
+ latest::release " $dep " " ${! exclusion:- } "
237
+
238
+ # XXX containerd does not display "v" in its released versions
239
+ [ " ${higher_readable: 0: 1} " == v ] || higher_readable=" v$higher_readable "
240
+
241
+ checksum=" ${shortsafename} _CHECKSUM"
242
+ if [ " ${! checksum:- } " != " " ]; then
243
+ # Checksum file
244
+ checksum_file=./Dockerfile.d/SHA256SUMS.d/" ${shortname} -${higher_readable} "
245
+ if [ ! -e " $checksum_file " ]; then
246
+ # Get assets - try first os/arch - fallback on gnu style arch otherwise
247
+ assets=()
248
+
249
+ # Most well behaved go projects will tag with a go os and arch
250
+ candidate=" $( assets::get " ${! checksum:- } " " amd64" ) "
251
+ # Then non go projects tend to use gnu style
252
+ [ " $candidate " != " " ] || candidate=" $( assets::get " " " x86_64" ) "
253
+ # And then some projects which are linux only do not specify the OS
254
+ [ " $candidate " != " " ] || candidate=" $( assets::get " " " amd64" ) "
255
+ [ " $candidate " == " " ] || assets+=(" $candidate " )
256
+
257
+ candidate=" $( assets::get " ${! checksum:- } " " arm64" ) "
258
+ [ " $candidate " != " " ] || candidate=" $( assets::get " " " aarch64" ) "
259
+ [ " $candidate " != " " ] || candidate=" $( assets::get " " " arm64" ) "
260
+ [ " $candidate " == " " ] || assets+=(" $candidate " )
261
+ # Fallback to source if there is nothing else
262
+
263
+ [ " ${# assets[@]} " != 0 ] || candidate=" $( assets::get " " " source" ) "
264
+ [ " $candidate " == " " ] || assets+=(" $candidate " )
265
+
266
+ # XXX very special...
267
+ if [ " $shortsafename " == " STARGZ_SNAPSHOTTER" ]; then
268
+ assets+=(" https://raw.githubusercontent.com/containerd/stargz-snapshotter/${higher_readable} /script/config/etc/systemd/system/stargz-snapshotter.service" )
269
+ fi
270
+
271
+ # Write the checksum for what we found
272
+ if [ " ${# assets[@]} " == 0 ]; then
273
+ log::error " No asset found for this checksum-able dependency. Dropping off."
274
+ exit 1
275
+ fi
276
+ http::checksum " ${assets[@]} " > " $checksum_file "
274
277
fi
275
- http::checksum " ${assets[@]} " > " $checksum_file "
276
278
fi
277
- fi
278
279
279
- while read -r line; do
280
- # Extract value after "=" from a possible dockerfile `ARG XXX_VERSION`
281
- old_version=$( echo " $line " | grep " ARG ${shortsafename} _VERSION=" ) || true
282
- old_version=" ${old_version##* =} "
283
- [ " $old_version " != " " ] || continue
284
- # If the Dockerfile version does NOT start with a v, adapt to that
285
- [ " ${old_version: 0: 1} " == " v" ] || higher_readable=" ${higher_readable: 1} "
286
-
287
- if [ " $old_version " != " $higher_readable " ]; then
288
- log::warning " Dependency ${shortsafename} is going to use an updated version $higher_readable (currently: $old_version )"
289
- fi
290
- done < ./Dockerfile
280
+ while read -r line; do
281
+ # Extract value after "=" from a possible dockerfile `ARG XXX_VERSION`
282
+ old_version=$( echo " $line " | grep " ARG ${shortsafename} _VERSION=" ) || true
283
+ old_version=" ${old_version##* =} "
284
+ [ " $old_version " != " " ] || continue
285
+ # If the Dockerfile version does NOT start with a v, adapt to that
286
+ [ " ${old_version: 0: 1} " == " v" ] || higher_readable=" ${higher_readable: 1} "
291
287
292
- docker_args+=(--build-arg " ${shortsafename} _VERSION=$higher_readable " )
293
- done
288
+ if [ " $old_version " != " $higher_readable " ]; then
289
+ log::warning " Dependency ${shortsafename} is going to use an updated version $higher_readable (currently: $old_version )"
290
+ fi
291
+ done < ./Dockerfile
292
+
293
+ docker_args+=(--build-arg " ${shortsafename} _VERSION=$higher_readable " )
294
+ done
294
295
295
296
296
- GO_VERSION=" $( curl -fsSL " https://go.dev/dl/?mode=json&include=all" | jq -rc .[0].version) "
297
- GO_VERSION=" ${GO_VERSION##* go} "
298
- # If a release candidate, docker hub may not have the corresponding image yet.
299
- # So, soften the version to just "rc", as they provide that as an alias to the latest available rc on their side
300
- # See https://github.com/containerd/nerdctl/issues/3223
301
- ! grep -Eq " rc[0-9]+$" <<< " $GO_VERSION" || GO_VERSION=" ${GO_VERSION% rc[0-9]* } -rc"
302
- docker_args+=(--build-arg " GO_VERSION=$GO_VERSION " )
297
+ GO_VERSION=" $( curl -fsSL " https://go.dev/dl/?mode=json&include=all" | jq -rc .[0].version) "
298
+ GO_VERSION=" ${GO_VERSION##* go} "
299
+ # If a release candidate, docker hub may not have the corresponding image yet.
300
+ # So, soften the version to just "rc", as they provide that as an alias to the latest available rc on their side
301
+ # See https://github.com/containerd/nerdctl/issues/3223
302
+ ! grep -Eq " rc[0-9]+$" <<< " $GO_VERSION" || GO_VERSION=" ${GO_VERSION% rc[0-9]* } -rc"
303
+ docker_args+=(--build-arg " GO_VERSION=$GO_VERSION " )
304
+
305
+ log::debug " ${docker_args[*]} ."
306
+ " ${docker_args[@]} " " ."
307
+ }
308
+
303
309
304
- log::debug " ${docker_args[*]} ."
305
- " ${docker_args[@]} " " ."
310
+ canary::golang::latest (){
311
+ # Enable extended globbing features to use advanced pattern matching
312
+ shopt -s extglob
313
+
314
+ # Get latest golang version and split it in components
315
+ norm=()
316
+ while read -r line; do
317
+ line_trimmed=" ${line// +([[:space:]])/ } "
318
+ norm+=(" $line_trimmed " )
319
+ done < \
320
+ <( sed -E ' s/^go([0-9]+)[.]([0-9]+)([.]([0-9]+))?(([a-z]+)([0-9]+))?/\1.\2\n\4\n\6\n\7/i' \
321
+ <( curl -fsSL " https://go.dev/dl/?mode=json&include=all" | jq -rc .[0].version) \
322
+ )
323
+
324
+ # Serialize version, making sure we have a patch version, and separate possible rcX into .rc-X
325
+ [ " ${norm[1]} " != " " ] || norm[1]=" 0"
326
+ norm[1]=" .${norm[1]} "
327
+ [ " ${norm[2]} " == " " ] || norm[2]=" -${norm[2]} "
328
+ [ " ${norm[3]} " == " " ] || norm[3]=" .${norm[3]} "
329
+ # Save it
330
+ IFS=
331
+ echo " GO_VERSION=${norm[*]} " >> " $GITHUB_ENV "
332
+ }
0 commit comments