Init branch

WIP: Nothing really

Check pre-commit hook

Test

Get static from another bucket

Check the job

Check the job

Test the script again

Test the script again

Test the script again

feat: start using git lfs

build: upload media to minio

fix: Add more rules to .dockerignore

fix: Add more rules to .dockerignore

fix: Add more rules to .dockerignore

fix: Check if script is working

fix: Check if script is working
This commit is contained in:
Nikolai Rodionov
2023-03-06 21:42:35 +01:00
committed by Nikolai Rodionov
parent b4b0bf883b
commit dc364aaba9
74 changed files with 420 additions and 136 deletions

View File

@ -30,18 +30,39 @@ my $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";
foreach my $line (@builds_out)
{
if ( ! grep( /^$line$/, @commits_out ) ) {
my $cmd = "curl -X 'DELETE' -s \"$gitea_api/$line\" -H 'accept: application/json' -u $gitea_user:$gitea_token || true";
print "Removing ${line}\n\n";
my $output = `$cmd`;
print "$output \n";
}
print "Checking if $line is in @commits_out";
if ( ! grep( /^$line$/, @commits_out ) ) {
my $cmd = "curl -X 'DELETE' -s \"$gitea_api/$line\" -H 'accept: application/json' -u $gitea_user:$gitea_token || true";
print "Removing ${line}\n\n";
my $output = `$cmd`;
print "$output \n";
}
}
print "Cleaning up Minio";
foreach my $line (@dirs_out)
{
print "Checking if $line is in @commits_out";
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";
}
}

10
scripts/upload-media.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
#=== 'prev-commit' solution by o_O Tync
#commit_hash=$(git rev-parse --verify HEAD)
commit=$(git log -1 --pretty="%H%n%ci") # hash \n date
commit_date=$(echo "$commit" | head -2 | tail -1) # 2010-12-28 05:16:23 +0300
commit_hash=$(echo "$commit" | head -1)
echo "$(git rev-parse HEAD)" > /tmp/test
echo "prev_commit='$commit_hash'\ndate='$commit_date'\nbranch='$branch'\n" > /tmp/test.txt