From 489e85904dc38c17075f84c06ba262feb13e912c Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Mon, 24 Apr 2023 17:21:41 +0200 Subject: [PATCH] Try using the \'app\' label in the cleanup job --- scripts/check.pl | 6 ++++++ scripts/cleanup.pl | 2 +- scripts/upload-media.pl | 8 +++----- 3 files changed, 10 insertions(+), 6 deletions(-) create mode 100755 scripts/check.pl diff --git a/scripts/check.pl b/scripts/check.pl new file mode 100755 index 0000000..8457a56 --- /dev/null +++ b/scripts/check.pl @@ -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"; diff --git a/scripts/cleanup.pl b/scripts/cleanup.pl index 29d4c81..c19bb89 100755 --- a/scripts/cleanup.pl +++ b/scripts/cleanup.pl @@ -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'; diff --git a/scripts/upload-media.pl b/scripts/upload-media.pl index 077e572..cc0bc40 100755 --- a/scripts/upload-media.pl +++ b/scripts/upload-media.pl @@ -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"`; } -