migration: transfer the repo ownership

This commit is contained in:
Nikolai Rodionov 2023-02-26 07:27:44 +01:00
parent 6a2ebc2ba4
commit c1b7262a14
9 changed files with 45 additions and 15 deletions

View File

@ -1,3 +1,4 @@
node_modules node_modules
static static
scripts

View File

@ -19,8 +19,8 @@ steps:
commands: commands:
- helm plugin install https://github.com/chartmuseum/helm-push - helm plugin install https://github.com/chartmuseum/helm-push
- helm package chart -d chart-package - helm package chart -d chart-package
- helm repo add --username allanger --password $GITEA_TOKEN allanger-charts https://git.badhouseplants.net/api/packages/allanger/helm - helm repo add --username allanger --password $GITEA_TOKEN badhouseplants-net https://git.badhouseplants.net/api/packages/badhouseplants/helm
- helm cm-push "./chart-package/$(ls chart-package)" allanger-charts - helm cm-push "./chart-package/$(ls chart-package)" badhouseplants-net
- name: Init git submodules with themes - name: Init git submodules with themes
image: alpine/git image: alpine/git
@ -43,7 +43,7 @@ steps:
username: allanger username: allanger
password: password:
from_secret: GITEA_TOKEN from_secret: GITEA_TOKEN
repo: git.badhouseplants.net/allanger/badhouseplants-net repo: git.badhouseplants.net/${DRONE_REPO}
tags: ${DRONE_COMMIT_SHA} tags: ${DRONE_COMMIT_SHA}
- name: Build and push the docker image with latest - name: Build and push the docker image with latest
@ -56,7 +56,7 @@ steps:
username: allanger username: allanger
password: password:
from_secret: GITEA_TOKEN from_secret: GITEA_TOKEN
repo: git.badhouseplants.net/allanger/badhouseplants-net repo: git.badhouseplants.net/${DRONE_REPO}
tags: tags:
- ${DRONE_COMMIT_SHA} - ${DRONE_COMMIT_SHA}
- latest - latest
@ -125,6 +125,16 @@ steps:
- argocd app sync -l app=badhouseplants -l branch=$DRONE_BRANCH - argocd app sync -l app=badhouseplants -l branch=$DRONE_BRANCH
- argocd app wait -l app=badhouseplants -l branch=$DRONE_BRANCH - argocd app wait -l app=badhouseplants -l branch=$DRONE_BRANCH
- name: Cleanup container registry
image: alpine
environment:
GITEA_TOKEN:
from_secret: GITEA_TOKEN
commands:
- apk update
- apk add curl jq perl git
- ./scripts/cleanup.pl
--- ---
# ---------------------------------------------- # ----------------------------------------------
# -- Upload a newer version of my CV # -- Upload a newer version of my CV

View File

@ -2,5 +2,5 @@ apiVersion: v2
name: badhouseplants-net name: badhouseplants-net
description: A Helm chart for Kubernetes description: A Helm chart for Kubernetes
type: application type: application
version: 0.3.9 version: 0.4.0
appVersion: "1.16.0" appVersion: "1.16.0"

View File

@ -37,7 +37,7 @@ hugo:
name: badhouseplants-net name: badhouseplants-net
resources: {} resources: {}
image: image:
repository: git.badhouseplants.net/allanger/badhouseplants-net repository: git.badhouseplants.net/badhouseplants/badhouseplants-net
pullPolicy: Always pullPolicy: Always
tag: latest tag: latest
baseURL: https://badhouseplants.net/ baseURL: https://badhouseplants.net/

View File

@ -35,7 +35,7 @@ params:
imageHeight: 150 imageHeight: 150
buttons: buttons:
- name: Source - name: Source
url: "https://git.badhouseplants.net/allanger/badhouseplants-net" url: "https://git.badhouseplants.net/badhouseplants/badhouseplants-net"
- name: My Music - name: My Music
url: "https://funkwhale.badhouseplants.net/library/artists" url: "https://funkwhale.badhouseplants.net/library/artists"
socialIcons: socialIcons:

View File

@ -10,7 +10,9 @@ spec:
- name: application - name: application
app: badhouseplants app: badhouseplants
branch: main branch: main
chart_version: 0.3.8 chart_version: 0.3.9
repo_url: https://git.badhouseplants.net/api/packages/badhouseplants/helm
value: |
template: template:
metadata: metadata:
name: "{{ app }}-{{ name }}" name: "{{ app }}-{{ name }}"
@ -25,7 +27,7 @@ spec:
valueFiles: valueFiles:
- values.yaml - values.yaml
values: "{{ value }}" values: "{{ value }}"
repoURL: https://git.badhouseplants.net/api/packages/allanger/helm repoURL: "{{ repo_url }}"
targetRevision: "{{ chart_version }}" targetRevision: "{{ chart_version }}"
chart: badhouseplants-net chart: badhouseplants-net
destination: destination:

View File

@ -2,6 +2,7 @@
app: badhouseplants app: badhouseplants
branch: $ARGO_APP_BRANCH branch: $ARGO_APP_BRANCH
chart_version: $ARGO_APP_CHART_VERSION chart_version: $ARGO_APP_CHART_VERSION
repo_url: https://git.badhouseplants.net/api/packages/badhouseplants/helm
value: | value: |
hugo: hugo:
image: image:

View File

@ -3,6 +3,7 @@
branch: $ARGO_APP_BRANCH branch: $ARGO_APP_BRANCH
commit_sha: $ARGO_APP_IMAGE_TAG commit_sha: $ARGO_APP_IMAGE_TAG
chart_version: $ARGO_APP_CHART_VERSION chart_version: $ARGO_APP_CHART_VERSION
repo_url: https://git.badhouseplants.net/api/packages/badhouseplants/helm
value: | value: |
namespace: namespace:
name: badhouseplants-$ARGO_APP_BRANCH name: badhouseplants-$ARGO_APP_BRANCH

View File

@ -3,15 +3,30 @@
# Modules used # Modules used
use strict; use strict;
use warnings; use warnings;
use Carp;
my $cmd = "git log --format=format:%H --all"; my $drone_url="$ENV{'DRONE_SYSTEM_PROTO'}://$ENV{'DRONE_SYSTEM_HOST'}";
my @output = `$cmd`; my $drone_project=$ENV{'DRONE_REPO'};
chomp @output; my $drone_api="$drone_url/api/repos/$drone_project/builds";
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';
foreach my $line (@output) my $builds = "curl -X 'GET' $drone_api -H 'accept: application/json' | jq -r '.[].after'";
my @builds_out = `$builds`;
chomp @builds_out;
foreach my $line (@builds_out)
{ {
print "$line"; 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 $output = `$cmd`;
}
} }