From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 40CC21FF183 for ; Wed, 8 Oct 2025 19:14:36 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E7FACEA7E; Wed, 8 Oct 2025 19:14:41 +0200 (CEST) From: Filip Schauer To: pve-devel@lists.proxmox.com Date: Wed, 8 Oct 2025 19:10:21 +0200 Message-ID: <20251008171028.196998-16-f.schauer@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251008171028.196998-1-f.schauer@proxmox.com> References: <20251008171028.196998-1-f.schauer@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1759943647765 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.007 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager v5 15/17] api: add nodes/{node}/query-oci-repo-tags method X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Add an API method for querying the tags of a reference from an OCI registry. Signed-off-by: Filip Schauer --- Introduced in v5 PVE/API2/Nodes.pm | 47 +++++++++++++++++++++++++++++++++++++++++++++++ debian/control | 1 + 2 files changed, 48 insertions(+) diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm index 4590b618..8f86afd9 100644 --- a/PVE/API2/Nodes.pm +++ b/PVE/API2/Nodes.pm @@ -279,6 +279,7 @@ __PACKAGE__->register_method({ { name => 'netstat' }, { name => 'network' }, { name => 'qemu' }, + { name => 'query-oci-repo-tags' }, { name => 'query-url-metadata' }, { name => 'replication' }, { name => 'report' }, @@ -1761,6 +1762,52 @@ __PACKAGE__->register_method({ }, }); +__PACKAGE__->register_method({ + name => 'query_oci_repo_tags', + path => 'query-oci-repo-tags', + method => 'GET', + description => "List all tags for an OCI repository reference.", + proxyto => 'node', + permissions => { + check => ['perm', '/nodes/{node}', ['Sys.AccessNetwork']], + }, + parameters => { + additionalProperties => 0, + properties => { + node => get_standard_option('pve-node'), + reference => { + description => "The reference to the repository to query tags from.", + type => 'string', + pattern => '^(?:(?:[a-zA-Z\d]|[a-zA-Z\d][a-zA-Z\d-]*[a-zA-Z\d])' + . '(?:\.(?:[a-zA-Z\d]|[a-zA-Z\d][a-zA-Z\d-]*[a-zA-Z\d]))*(?::\d+)?/)?[a-z\d]+' + . '(?:(?:[._]|__|[-]*)[a-z\d]+)*(?:/[a-z\d]+(?:(?:[._]|__|[-]*)[a-z\d]+)*)*$', + }, + }, + }, + returns => { + type => 'array', + items => { + type => 'string', + }, + }, + code => sub { + my ($param) = @_; + + die "Install 'skopeo' to list tags from OCI registries.\n" if (!-f '/usr/bin/skopeo'); + + my $reference = $param->{reference}; + my $tags_json = ""; + PVE::Tools::run_command( + ["skopeo", "list-tags", "docker://$reference"], + outfunc => sub { + $tags_json = $tags_json . shift; + }, + ); + my $tags = decode_json($tags_json); + return $tags->{Tags}; + }, +}); + __PACKAGE__->register_method({ name => 'query_url_metadata', path => 'query-url-metadata', diff --git a/debian/control b/debian/control index 64b942ce..afd0386a 100644 --- a/debian/control +++ b/debian/control @@ -105,6 +105,7 @@ Depends: apt (>= 1.5~), Recommends: proxmox-firewall, proxmox-offline-mirror-helper, pve-nvidia-vgpu-helper, + skopeo, Conflicts: vlan, vzdump, Replaces: vlan, vzdump, Provides: vlan, vzdump, -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel