The ci-* targets need to know where our container images are stored
and how they are called to work, so now that we use the GitLab
container registry instead of Quay some changes are necessary.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
ci/Makefile | 16 ++++++++++++----
ci/list-images.sh | 24 ++++++------------------
2 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/ci/Makefile b/ci/Makefile
index bc1dac11e3..e1a5faaba6 100644
--- a/ci/Makefile
+++ b/ci/Makefile
@@ -47,10 +47,13 @@ CI_PREPARE_SCRIPT = $(CI_ROOTDIR)/prepare.sh
# Script containing build instructions
CI_BUILD_SCRIPT = $(CI_ROOTDIR)/build.sh
+# Registry where container images are stored
+CI_IMAGE_REGISTRY =
registry.gitlab.com
+
# Location of the container images we're going to pull
# Can be useful to overridde to use a locally built
# image instead
-CI_IMAGE_PREFIX = quay.io/libvirt/buildenv-libvirt-
+CI_IMAGE_PREFIX = libvirt/libvirt/ci-
# The default tag is ':latest' but if the container
# repo above uses different conventions this can override it
@@ -213,7 +216,12 @@ ci-prepare-tree: ci-check-engine
fi
ci-run-command@%: ci-prepare-tree
- $(CI_ENGINE) run $(CI_ENGINE_ARGS) $(CI_IMAGE_PREFIX)$*$(CI_IMAGE_TAG) \
+ image=; \
+ if test "$(CI_IMAGE_REGISTRY)"; then \
+ image="$${image}$(CI_IMAGE_REGISTRY)/"; \
+ fi; \
+ image="$${image}$(CI_IMAGE_PREFIX)$*$(CI_IMAGE_TAG)"; \
+ $(CI_ENGINE) run $(CI_ENGINE_ARGS) "$$image" \
/bin/bash -c ' \
$(CI_USER_HOME)/prepare || exit 1; \
sudo \
@@ -243,11 +251,11 @@ ci-list-images:
@echo
@echo "Available x86 container images:"
@echo
- @sh list-images.sh "$(CI_ENGINE)" "$(CI_IMAGE_PREFIX)" | grep -v
cross
+ @sh list-images.sh "$(CI_IMAGE_PREFIX)" | grep -v cross
@echo
@echo "Available cross-compiler container images:"
@echo
- @sh list-images.sh "$(CI_ENGINE)" "$(CI_IMAGE_PREFIX)" | grep cross
+ @sh list-images.sh "$(CI_IMAGE_PREFIX)" | grep cross
@echo
ci-help:
diff --git a/ci/list-images.sh b/ci/list-images.sh
index 35efdb6982..9ae2f60a95 100644
--- a/ci/list-images.sh
+++ b/ci/list-images.sh
@@ -1,26 +1,14 @@
#!/bin/sh
-engine="$1"
-prefix="$2"
+prefix="$1"
-do_podman() {
- # Podman freaks out if the search term ends with a dash, which ours
- # by default does, so let's strip it. The repository name is the
- # second field in the output, and it already starts with the registry
- podman search --limit 100 "${prefix%-}" | while read _ repo _; do
- echo "$repo"
- done
-}
+PROJECT_ID=192693
-do_docker() {
- # Docker doesn't include the registry name in the output, so we have
- # to add it. The repository name is the first field in the output
- registry="${prefix%%/*}"
- docker search --limit 100 "$prefix" | while read repo _; do
- echo "$registry/$repo"
- done
+all_repos() {
+ curl -s
"https://gitlab.com/api/v4/projects/$PROJECT_ID/registry/repositories?per_page=100"
\
+ | tr , '\n' | grep '"path":' | sed
's,"path":",,g;s,"$,,g'
}
-"do_$engine" | grep "^$prefix" | sed "s,^$prefix,,g" |
while read repo; do
+all_repos | grep "^$prefix" | sed "s,^$prefix,,g" | while read repo;
do
echo " $repo"
done | sort -u
--
2.25.4