fix: badge and add an annotation to istio resource

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: resources:
{{- toYaml .Values.rclone.container.resources | nindent 12 }} {{- toYaml .Values.rclone.container.resources | nindent 12 }}
- name: {{ .Values.hugo.container.name }} - name: {{ .Values.hugo.container.name }}
env:
{{- range $key, $value := .Values.hugo.env}}
- key: {{ $key }}
value: {{ $value }}
{{- end}}
args: args:
- --baseURL - --baseURL
- {{ .Values.hugo.baseURL }} - {{ .Values.hugo.baseURL }}

View File

@ -22,6 +22,7 @@ menu:
taxonomies: taxonomies:
tag: tags tag: tags
params: params:
GitBranch: main
ShowBreadCrumbs: true ShowBreadCrumbs: true
ShowReadingTime: true ShowReadingTime: true
ShowPostNavLinks: 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. > 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? ### Who am I?
> If you're hiring, you can find [my CV here]({{< ref "cv" >}} ) > If you're hiring, you can find [my CV here]({{< ref "cv" >}} )

View File

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

View File

@ -1,32 +1,48 @@
#!/usr/bin/perl #!/usr/bin/perl
# Modules used
use strict; use strict;
use warnings; use warnings;
use Carp; # --------------------------------------
# -- Drone variables
# --------------------------------------
my $drone_url="$ENV{'DRONE_SYSTEM_PROTO'}://$ENV{'DRONE_SYSTEM_HOST'}"; my $drone_url="$ENV{'DRONE_SYSTEM_PROTO'}://$ENV{'DRONE_SYSTEM_HOST'}";
my $drone_project=$ENV{'DRONE_REPO'}; my $drone_project=$ENV{'DRONE_REPO'};
my $drone_api="$drone_url/api/repos/$drone_project/builds"; 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 $gitea_token=$ENV{'GITEA_TOKEN'};
my $commits = "git log --format=format:%H --all"; my $gitea_user=$ENV{'GITEA_USER'} || $ENV{'DRONE_COMMIT_AUTHOR'};
my @commits_out = `$commits`; # ---------------------------------------
chomp @commits_out; # -- Get recent builds from drone-ci
push @commits_out, 'latest'; # ---------------------------------------
my $builds = "curl -X 'GET' $drone_api -H 'accept: application/json' | jq -r '.[].after'"; my $builds = "curl -X 'GET' $drone_api -H 'accept: application/json' | jq -r '.[].after'";
my @builds_out = `$builds`; my @builds_out = `$builds`;
chomp @builds_out; 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) foreach my $line (@builds_out)
{ {
print $line;
if ( ! grep( /^$line$/, @commits_out ) ) { 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"; my $cmd = "curl -X 'DELETE' -s \"$gitea_api/$line\" -H 'accept: application/json' -u $gitea_user:$gitea_token || true";
print "Removing ${line}\n"; print "Removing ${line}\n\n";
my $output = `$cmd`; my $output = `$cmd`;
print "$output \n";
} }
} }