Skip to content

Commit f2c1b36

Browse files
committed
fix(blocktype/container): bring back parallel image query in proviso
1 parent cca3bd9 commit f2c1b36

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/blocktypes/containers.nix

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,15 @@
7171
'';
7272
meta.images = map (tag: "${img}:${tag}") tags;
7373
proviso = l.toFile "container-proviso" ''
74+
function _scopeo_inspect() {
75+
if command &>/dev/null skopeo inspect --insecure-policy "docker://$image"; then
76+
echo "$image"
77+
fi
78+
}
79+
export -f _scopeo_inspect
80+
7481
function scopeo_inspect() {
75-
local images=("$@")
76-
for image in ''${images[@]}; do
77-
if command &>/dev/null skopeo inspect --insecure-policy "docker://$image"; then
78-
echo "$image"
79-
fi
80-
done
82+
echo "$@" | command xargs -n 1 -P 0 -I {} bash -c '_scopeo_inspect "$@"'
8183
}
8284
8385
declare -a images
@@ -88,7 +90,7 @@
8890
)"
8991
9092
command jq --raw-output \
91-
--arg available "$(scopeo_inspect ''${images[@]})" \
93+
--arg available "$(_scopeo_inspect ''${images[@]})" \
9294
' map(select(
9395
.meta.images[0] | inside($available) | not
9496
))

0 commit comments

Comments
 (0)