fix: badge and add an annotation to istio resource
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Nikolai Rodionov 2023-02-26 10:06:41 +01:00
parent c1b7262a14
commit 1f3496d13a
6 changed files with 47 additions and 15 deletions

View File

@ -46,6 +46,11 @@ spec:
resources:
{{- toYaml .Values.rclone.container.resources | nindent 12 }}
- name: {{ .Values.hugo.container.name }}
env:
{{- range $key, $value := .Values.hugo.env}}
- key: {{ $key }}
value: {{ $value }}
{{- end}}
args:
- --baseURL
- {{ .Values.hugo.baseURL }}

View File

@ -22,6 +22,7 @@ menu:
taxonomies:
tag: tags
params:
GitBranch: main
ShowBreadCrumbs: true
ShowReadingTime: true
ShowPostNavLinks: true

View File

@ -6,9 +6,10 @@ draft: false
> It was supposed to be just yet another web page with musical releases reviews, but after trying to write something about them, I've found out that I'm not good at it. So it's just a blog where I'm talking about everything that comes to my mind.
[![Build Status](https://drone.badhouseplants.net/api/badges/allanger/badhouseplants-net/status.svg?ref=refs/heads/main)](https://drone.badhouseplants.net/allanger/badhouseplants-net/latest)
[![Build Status](https://drone.badhouseplants.net/api/badges/badhouseplants/badhouseplants-net/status.svg?ref=refs/heads/{{< param GitBranch >}})](https://drone.badhouseplants.net/badhouseplants/badhouseplants-net)
{{< param GitBranch >}}
### Who am I?
> If you're hiring, you can find [my CV here]({{< ref "cv" >}} )

View File

@ -4,6 +4,12 @@
chart_version: $ARGO_APP_CHART_VERSION
repo_url: https://git.badhouseplants.net/api/packages/badhouseplants/helm
value: |
namespace:
hugo:
image:
tag: $ARGO_APP_IMAGE_TAG
istio:
annotations:
link.argocd.argoproj.io/env: https://badhouseplants.net/
link.argocd.argoproj.io/build: $DRONE_BUILD_LINK

View File

@ -10,6 +10,9 @@
istio:
hosts:
- $ARGO_APP_HOSTNAME
annotations:
link.argocd.argoproj.io/env: https://$ARGO_APP_HOSTNAME/
link.argocd.argoproj.io/build: $DRONE_BUILD_LINK
hugo:
image:
tag: $ARGO_APP_IMAGE_TAG

View File

@ -1,32 +1,48 @@
#!/usr/bin/perl
# Modules used
use strict;
use warnings;
use Carp;
# --------------------------------------
# -- Drone variables
# --------------------------------------
my $drone_url="$ENV{'DRONE_SYSTEM_PROTO'}://$ENV{'DRONE_SYSTEM_HOST'}";
my $drone_project=$ENV{'DRONE_REPO'};
my $drone_api="$drone_url/api/repos/$drone_project/builds";
# --------------------------------------
# -- Gitea variables
# --------------------------------------
my $gitea_url=$ENV{'GITEA_URL'} || 'https://git.badhouseplants.net/api/v1';
my $gitea_org=$ENV{'GITEA_ORG'} || 'badhouseplants';
my $gitea_package=$ENV{'GITEA_PACKAGE'} || 'badhouseplants-net';
my $gitea_api="$gitea_url/packages/$gitea_org/container/$gitea_package";
my $gitea_token=$ENV{'GITEA_TOKEN'};
my $commits = "git log --format=format:%H --all";
my @commits_out = `$commits`;
chomp @commits_out;
push @commits_out, 'latest';
my $gitea_user=$ENV{'GITEA_USER'} || $ENV{'DRONE_COMMIT_AUTHOR'};
# ---------------------------------------
# -- Get recent builds from drone-ci
# ---------------------------------------
my $builds = "curl -X 'GET' $drone_api -H 'accept: application/json' | jq -r '.[].after'";
my @builds_out = `$builds`;
chomp @builds_out;
# ---------------------------------------
# -- Get a list of all commits + 'latest'
# ---------------------------------------
my $commits = "git log --format=format:%H --all";
my @commits_out = `$commits`;
chomp @commits_out;
push @commits_out, 'latest';
# ---------------------------------------
# -- Compare builds to commits
# -- And remove obsolete imgages from
# -- registry
# ---------------------------------------
foreach my $line (@builds_out)
{
print $line;
if ( ! grep( /^$line$/, @commits_out ) ) {
my $cmd = "curl -X 'DELETE' \"https://git.badhouseplants.net/api/v1/packages/badhouseplants/container/badhouseplants-net/${line}\" -H 'accept: application/json' -u allanger:$gitea_token || true";
print "Removing ${line}\n";
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";
}
}