From nobody Sun Feb 8 17:03:25 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1612977913; cv=none; d=zohomail.com; s=zohoarc; b=ZJX7Xr11XnpdpUbIf8Zyxi1lzs8BfnB8bSP0uexSa9Cvyy4teNa3SIoDqzb+b4gVWAU7M7P+rCqofuoL/OS3ry+NdhOS/rr+hL/I3geniMsxoRFvc5DgQp74PBbE2lN67BD2dnTsy1Kn/jv5kEEBx82v1ICjBfswOPVbIJAEqI4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612977913; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y5eCCXzzI5LnUY+bUSoukTFnNyC6mI7ma3QuBS5ehVc=; b=Te81vFkjQZVnHDlGtrP60IF8liO49inKqbxRA+XusGqaUsx+6E9e8QXT0r4l9soau7lXgRziptfQ7fhqqYzPL03aVyPzXaXHXd0NroU6iThD+y251bR+dWEmdOhNqP9Xy3YvLIFBKfQ+mIP3tXoLZ7RPWsnSpuZmqd8zUQnulqA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612977913333808.0917428623126; Wed, 10 Feb 2021 09:25:13 -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-357-4mlC-pzONMKg-e4TZEAuUA-1; Wed, 10 Feb 2021 12:25:09 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ADFE2835E28; Wed, 10 Feb 2021 17:25:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 832485D9DC; Wed, 10 Feb 2021 17:25:03 +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 38DD04EEF6; Wed, 10 Feb 2021 17:25:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11AHOiOX019439 for ; Wed, 10 Feb 2021 12:24:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 33F755D9E8; Wed, 10 Feb 2021 17:24:44 +0000 (UTC) Received: from nautilus.redhat.com (unknown [10.40.192.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EBA45D9E3; Wed, 10 Feb 2021 17:24:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612977912; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=y5eCCXzzI5LnUY+bUSoukTFnNyC6mI7ma3QuBS5ehVc=; b=hVgimlyzI9xR2JD+g7sYyXkklObD8X/p7ar75hyDxHpF4jq0Au7HV2f6/D/Du5OOP2TBSt FJRcq6fyf+vxYdm1SHmHW+w7fqwYD116WbcukwqNBSrTMrBa+W8d94FVOREPZnbeV2H/v6 NEAi6adtKOmkmXChrvRVXCRx5ZzMhjs= X-MC-Unique: 4mlC-pzONMKg-e4TZEAuUA-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] ci: Rewrite list-images from Bash to Python Date: Wed, 10 Feb 2021 18:24:34 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: eskultet@redhat.com 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.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Convert the script to some human readable form. Speed-wise, both are comparable. Signed-off-by: Erik Skultety --- ci/Makefile | 8 +------- ci/list-images.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 ci/list-images.py diff --git a/ci/Makefile b/ci/Makefile index 1f71701047..92032e8ca0 100644 --- a/ci/Makefile +++ b/ci/Makefile @@ -217,13 +217,7 @@ ci-test@%: =20 ci-list-images: @echo - @echo "Available x86 container images:" - @echo - @sh list-images.sh "$(CI_IMAGE_PREFIX)" | grep -v cross - @echo - @echo "Available cross-compiler container images:" - @echo - @sh list-images.sh "$(CI_IMAGE_PREFIX)" | grep cross + @python3 list-images.py @echo =20 help: diff --git a/ci/list-images.py b/ci/list-images.py new file mode 100644 index 0000000000..6862ac347f --- /dev/null +++ b/ci/list-images.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +import json +import urllib.request as urllib + +PROJECT_ID =3D 192693 +DOMAIN =3D "https://gitlab.com" +API =3D "api/v4" + +uri =3D f"{DOMAIN}/{API}/projects/{PROJECT_ID}/registry/repositories" +r =3D urllib.urlopen(uri + "?per_page=3D100") + +# read the HTTP response and load the JSON part of it +data =3D json.loads(r.read().decode()) + +# skip the "ci-" prefix each of our container images' name has +names =3D [i["name"][3:] for i in data] +names.sort() + +names_native =3D [name for name in names if "cross" not in name] +names_cross =3D [name for name in names if "cross" in name] + +print("Available x86 container images:\n") +print("\t" + "\n\t".join(names_native)) + +if names_cross: + print() + print("Available cross-compiler container images:\n") + print("\t" + "\n\t".join(names_cross)) --=20 2.29.2