From nobody Sat Apr 27 18:52:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576087007; cv=none; d=zohomail.com; s=zohoarc; b=Dk8tQ9jKUEubwssVMz+5HGnyOQcnAgi+OUftcWIEhyvZH3NvLWVEHxOAhOtqRKKmL/naa7Yf160jsTs2q4tyKXGGdn66juhg/GvENdCt5R5Dp7QVNFQ2RbQspsiMhPDjjkhz7VLLASB4krIsUYiz61W/hJ7GqPDc6JOkr3dpWqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576087007; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=rtcqyXT9iN6zCf37H0wrjpkjifE6WOmDBstdPvgc600=; b=nUuPuzRbFf+UtXUUl9C/v0umOt5mp92sHMOQdcd0ArYZICgTFvj5w92VQwg6qn+4IAMMP0cRSlK3++WUMo/vGfka7qzE+j3+8lZHIBgwjqEogFsyax9quP38WN/IqMt1K0ebfEgHPYsyEv/61tapmefMIFfvdREjP511EZnHEts= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1576087007337700.9579906221732; Wed, 11 Dec 2019 09:56:47 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-317-vsPNBH33O0iFC-aN9sMJFg-1; Wed, 11 Dec 2019 12:56:44 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 341351005502; Wed, 11 Dec 2019 17:56:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 69F4E19C6A; Wed, 11 Dec 2019 17:56:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8A15A1809567; Wed, 11 Dec 2019 17:56:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBBHuRx7002118 for ; Wed, 11 Dec 2019 12:56:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5445B5D6AE; Wed, 11 Dec 2019 17:56:27 +0000 (UTC) Received: from kinshicho.usersys.redhat.com (ovpn-204-120.brq.redhat.com [10.40.204.120]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 799EE5D6A3 for ; Wed, 11 Dec 2019 17:56:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576087006; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rtcqyXT9iN6zCf37H0wrjpkjifE6WOmDBstdPvgc600=; b=VLQMGfcLgjIZN+pE1WQbJ3zviyRm40oICSo/Ftdyakt58KS6Xlwa6RsjuuI5FbJs+gT3E3 VgF+gjNJALwGPMDXPKaYiUYQTQYTsTZPm24R6du4IAv1m0xQ5eGx2EcJWsQczSL7XZgqu0 JDiqypA/6aqi4hA4azV6snOXg6RyQb4= From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 11 Dec 2019 18:56:19 +0100 Message-Id: <20191211175619.189870-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] ci: Fetch list of available container images dynamically X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: vsPNBH33O0iFC-aN9sMJFg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Any static list of images is destined to become outdated eventually, so let's start generating it dynamically instead. Unfortunately there doesn't seem to be a straightforward way to get Podman/Docker to list all repositories under quay.io/libvirt, so we have to resort to searching and filtering manually; and since the two tools behave slightly differently in that regard, it's more sane to have the logic in a separate shell script than it would be to keep it inline in the Makefile with all the annoying escaping that would entail. Signed-off-by: Andrea Bolognani Reviewed-by: Cole Robinson --- ci/Makefile | 37 +++++++++++++------------------------ ci/list-images.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 24 deletions(-) create mode 100644 ci/list-images.sh diff --git a/ci/Makefile b/ci/Makefile index 27c1049b38..acb655941c 100644 --- a/ci/Makefile +++ b/ci/Makefile @@ -238,6 +238,17 @@ ci-build@%: ci-check@%: $(MAKE) -C $(CI_ROOTDIR) ci-build@$* CI_MAKE_ARGS=3D"check" =20 +ci-list-images: + @echo + @echo "Available x86 container images:" + @echo + @sh list-images.sh "$(CI_ENGINE)" "$(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 + @echo + ci-help: @echo "Build libvirt inside containers used for CI" @echo @@ -246,30 +257,8 @@ ci-help: @echo " ci-build@\$$IMAGE - run a default 'make'" @echo " ci-check@\$$IMAGE - run a 'make check'" @echo " ci-shell@\$$IMAGE - run an interactive shell" - @echo - @echo "Available x86 container images:" - @echo - @echo " centos-7" - @echo " debian-9" - @echo " debian-10" - @echo " debian-sid" - @echo " fedora-29" - @echo " fedora-30" - @echo " fedora-rawhide" - @echo " ubuntu-16" - @echo " ubuntu-18" - @echo - @echo "Available cross-compiler container images:" - @echo - @echo " debian-{9,10,sid}-cross-aarch64" - @echo " debian-{9,10,sid}-cross-armv6l" - @echo " debian-{9,10,sid}-cross-armv7l" - @echo " debian-{10,sid}-cross-i686" - @echo " debian-{9,10,sid}-cross-mips64el" - @echo " debian-{9,10,sid}-cross-mips" - @echo " debian-{9,10,sid}-cross-mipsel" - @echo " debian-{9,10,sid}-cross-ppc64le" - @echo " debian-{9,10,sid}-cross-s390x" + @echo " ci-list-images - list available images" + @echo " ci-help - show this help message" @echo @echo "Available make variables:" @echo diff --git a/ci/list-images.sh b/ci/list-images.sh new file mode 100644 index 0000000000..35efdb6982 --- /dev/null +++ b/ci/list-images.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +engine=3D"$1" +prefix=3D"$2" + +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 +} + +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=3D"${prefix%%/*}" + docker search --limit 100 "$prefix" | while read repo _; do + echo "$registry/$repo" + done +} + +"do_$engine" | grep "^$prefix" | sed "s,^$prefix,,g" | while read repo; do + echo " $repo" +done | sort -u --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list