Add additional logic for tagging
This commit is contained in:
parent
2449b73b13
commit
eeea22991e
@ -36,12 +36,14 @@ chomp($git_commit_sha);
|
|||||||
# -- my main build system is DRONE, so I'm using DRONE variables a lot
|
# -- my main build system is DRONE, so I'm using DRONE variables a lot
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
my $container_registry = $ENV{'CONTAINER_REGISTRY'} || 'git.badhouseplants.net';
|
my $container_registry = $ENV{'CONTAINER_REGISTRY'} || 'git.badhouseplants.net';
|
||||||
my $image_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 $username = $ENV{'DRONE_USERNAME'} || "allanger";
|
my $username = $ENV{'DRONE_USERNAME'} || "allanger";
|
||||||
my $password = $ENV{'GITEA_TOKEN'} || "YOU NOT AUTHORIZED, PAL";
|
my $password = $ENV{'GITEA_TOKEN'} || "YOU NOT AUTHORIZED, PAL";
|
||||||
|
my $containerfile = $ENV{'CONTAINERFILE'} || ".";
|
||||||
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 build -t $tag .") or die $!;
|
0 == system ("buildah bud -t $tag $containerfile") or die $!;
|
||||||
0 == system ("buildah push $tag") or die $!;
|
0 == system ("buildah push $tag") or die $!;
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# -- Push the latest if the branch is main
|
# -- Push the latest if the branch is main
|
||||||
@ -51,5 +53,10 @@ if ( $git_branch eq $main_branch) {
|
|||||||
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 $!;
|
||||||
}
|
}
|
||||||
|
if ( $custom_tag ne "" ) {
|
||||||
|
my $custom_tag_final = "$container_registry/$image_name:$custom_tag";
|
||||||
|
0 == system ("buildah tag $tag $custom_tag_final") or die $!;
|
||||||
|
0 == system ("buildah push $custom_tag_final") or die $!;
|
||||||
|
}
|
||||||
|
|
||||||
print "Thanks!\n";
|
print "Thanks!\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user