Make it possible not to push hashed versions of images
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
2026-01-02 15:01:59 +01:00
parent 4eb9368f1c
commit 3e135eda56

View File

@@ -39,17 +39,20 @@ my $container_registry = $ENV{'CONTAINER_REGISTRY'} || 'gitea.badhouseplants.net
my $image_name = $ENV{'PACKAGE_NAME'} | $ENV{'DRONE_REPO'} || "badhouseplants/badhouseplants-net"; my $image_name = $ENV{'PACKAGE_NAME'} | $ENV{'DRONE_REPO'} || "badhouseplants/badhouseplants-net";
my $tag = "$container_registry/$image_name:$git_commit_sha"; my $tag = "$container_registry/$image_name:$git_commit_sha";
my $custom_tag = $ENV{'CUSTOM_TAG'} || ""; my $custom_tag = $ENV{'CUSTOM_TAG'} || "";
my $skip_sha_push = $ENV{'SKIP_SHA_PUSH'} || "";
my $username = "woody"; my $username = "woody";
my $password = $ENV{'REGISTRY_TOKEN'} || "YOU NOT AUTHORIZED, PAL"; my $password = $ENV{'REGISTRY_TOKEN'} || "YOU NOT AUTHORIZED, PAL";
my $containerfile = $ENV{'CONTAINERFILE'} || "Containerfile"; my $containerfile = $ENV{'CONTAINERFILE'} || "Containerfile";
my $args = $ENV{'BUILD_ARGS'}; my $args = $ENV{'BUILD_ARGS'};
0 == system ("buildah login --username $username --password $password $container_registry") or die $!; 0 == system ("buildah login --username $username --password $password $container_registry") or die $!;
0 == system ("buildah bud -t $tag -f $containerfile $args .") or die $!; 0 == system ("buildah bud -t $tag -f $containerfile $args .") or die $!;
0 == system ("buildah push $tag") or die $!; if ( $skip_sha_push eq "" ) {
0 == system ("buildah push $tag") or die $!;
}
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# -- Push the latest if the branch is main # -- Push the latest if the branch is main
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
if ( $git_branch eq $main_branch) { if ( $git_branch eq $main_branch ) {
my $latest_tag = "$container_registry/$image_name:latest"; my $latest_tag = "$container_registry/$image_name:latest";
0 == system ("buildah tag $tag $latest_tag") or die $!; 0 == system ("buildah tag $tag $latest_tag") or die $!;
0 == system ("buildah push $latest_tag") or die $!; 0 == system ("buildah push $latest_tag") or die $!;