Build a new version
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
2026-04-19 18:24:19 +02:00
parent bd2fdce025
commit 23f8f2a3be
4 changed files with 4 additions and 102 deletions

View File

@@ -5,8 +5,6 @@ when:
matrix:
include:
# - NAME: ARM
# ARCH: arm64
- NAME: AMD
ARCH: amd64
@@ -32,11 +30,3 @@ steps:
cpu: 1000m
securityContext:
privileged: true
cleanup:
image: zot.badhouseplants.net/badhouseplants/badhouseplants-builder:latest
environment:
BUILDAH_REG: zot.badhouseplants.net/badhouseplants/badhouseplants-builder
REGISTRY_TOKEN:
from_secret: registry_token
commands:
- cleanup

View File

@@ -1,5 +1,5 @@
FROM registry.hub.docker.com/library/alpine
FROM registry.hub.docker.com/library/alpine:2.23.4
RUN apk update --no-cache &&\
apk add yq gettext openssl curl jq perl git git-lfs netavark\
buildah cni-plugins iptables ip6tables fuse-overlayfs --no-cache
apk add yq gettext openssl curl jq perl git git-lfs netavark\
buildah cni-plugins iptables ip6tables fuse-overlayfs --no-cache
COPY ./scripts/ /usr/bin/

2
build
View File

@@ -24,7 +24,7 @@
echo "Current branch: ${CI_COMMIT_BRANCH}"
echo "Default repo branch: ${CI_REPO_DEFAULT_BRANCH}"
echo "28.11.2025"
echo "19.04.2026"
apk update
apk add buildah cni-plugins iptables ip6tables fuse-overlayfs netavark

View File

@@ -1,88 +0,0 @@
#!/usr/bin/perl
# ------------------------------------------------------------------------
# -- Copyright 2023 Nikolai Rodionov (allanger)
# ------------------------------------------------------------------------
# -- Permission is hereby granted, without written agreement and without
# -- license or royalty fees, to use, copy, modify, and distribute this
# -- software and its documentation for any purpose, provided that the
# -- above copyright notice and the following two paragraphs appear in
# -- all copies of this software.
# --
# -- IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
# -- DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
# -- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
# -- IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
# -- DAMAGE.
# --
# -- THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
# -- BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# -- FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
# -- ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
# -- PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
# ---------------------------------------------------------------------------
use strict;
use warnings;
# --------------------------------------
# -- Gitea variables
# --------------------------------------
my $gitea_url=$ENV{'GITEA_URL'} || 'https://zot.badhouseplants.net/api/v1';
my $gitea_org=$ENV{'DRONE_REPO_NAMESPACE'} || 'badhouseplants';
my $gitea_package=$ENV{'DRONE_REPO_NAME'} || 'badhouseplants-net';
my $gitea_api="$gitea_url/packages/$gitea_org/container/$gitea_package";
my $gitea_list_api="$gitea_url/packages/$gitea_org?page=1&type=container&q=$gitea_package";
my $gitea_token=$ENV{'REGISTRY_TOKEN'};
my $gitea_user=$ENV{'GITEA_USER'} || $ENV{'DRONE_COMMIT_AUTHOR'};
# ---------------------------------------
# -- Get tags from Gitea
# ---------------------------------------
my $builds = "curl -X 'GET' \"$gitea_list_api\" -H 'accept: application/json' -H \"Authorization: token $gitea_token\" | jq -r '.[].version'";
my @builds_out = `$builds`;
chomp @builds_out;
# ---------------------------------------
# -- Get a list of all commits + 'latest'
# ---------------------------------------
my $commits = "";
if (defined $ENV{CLEANUP_ARGO}) {
$commits = "argocd app list -o yaml -l application=badhouseplants | yq '.[].metadata.labels.commit_sha'";
} else {
$commits = "git fetch && git log --format=format:%H --all";
}
my @commits_out = `$commits`;
chomp @commits_out;
push @commits_out, 'latest';
# --------------------------------------
# -- Rclone variables
# -------------------------------------
my $dirs = "rclone lsf badhouseplants-minio:/badhouseplants-net";
my @dirs_out = `$dirs`;
chomp @dirs_out;
# ---------------------------------------
# -- Compare builds to commits
# -- And remove obsolete imgages from
# -- registry
# ---------------------------------------
print "Cleaning up the container registry\n";
foreach my $line (@builds_out)
{
print "Checking if $line is in @commits_out\n\n";
if ( ! grep( /^$line$/, @commits_out ) ) {
my $cmd = "curl -X 'DELETE' -s \"$gitea_api/$line\" -H 'accept: application/json' -H \"Authorization: token $gitea_token\" || true";
print "Removing ${line}\n\n";
my $output = `$cmd`;
print "$output \n";
}
}
if (defined $ENV{CLEANUP_MINIO}) {
print "Cleaning up Minio\n";
foreach my $line (@dirs_out)
{
print "Checking if $line is in @commits_out\n\n";
chop($line);
if ( ! grep( /^$line$/, @commits_out ) ) {
my $cmd = "rclone purge badhouseplants-minio:/badhouseplants-net/$line";
print "Removing ${line}\n\n";
my $output = `$cmd`;
print "$output \n";
}
}
}