Try using the \'app\' label in the cleanup job

This commit is contained in:
Nikolai Rodionov 2023-04-24 17:21:41 +02:00
parent 460d4fca68
commit 489e85904d
No known key found for this signature in database
GPG Key ID: 19DB54039EBF8F10
3 changed files with 10 additions and 6 deletions

6
scripts/check.pl Executable file
View File

@ -0,0 +1,6 @@
#! /usr/bin/perl
my $commits = "argocd app list -o yaml -l application=badhouseplants | yq '.[].metadata.labels.commit_sha'";
my @commits_out = `$commits`;
chomp @commits_out;
push @commits_out, 'latest';
print "@commits_out";

View File

@ -26,7 +26,7 @@ chomp @builds_out;
# ---------------------------------------
# -- Get a list of all commits + 'latest'
# ---------------------------------------
my $commits = "argocd app list -o yaml -l application=badhouseplants | yq '.[].metadata.labels.commit_sha'";
my $commits = "argocd app list -o yaml -l app=badhouseplants | yq '.[].metadata.labels.commit_sha'";
my @commits_out = `$commits`;
chomp @commits_out;
push @commits_out, 'latest';

View File

@ -8,12 +8,10 @@ my $main_bucket = "badhouseplants-minio:/badhouseplants-net-main";
chop($git_branch);
chop($git_commit_sha);
print "Creating a new hashed dir in the common bucket\n";
print `rclone copy -P static "$common_bucket/$git_commit_sha"`;
if ( $git_branch eq $main_branch) {
print "Syncing to the production bucket\n";
print `rclone copy -P static "$common_bucket/$git_commit_sha"`;
print `rclone sync -P "$common_bucket/$git_commit_sha" "$main_bucket/"`;
} else {
print "Creating a new hashed dir in the common bucket\n";
print `rclone copy -P static "$common_bucket/$git_commit_sha"`;
}