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
static
scripts

View File

@ -19,8 +19,8 @@ steps:
commands:
- helm plugin install https://github.com/chartmuseum/helm-push
- 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 cm-push "./chart-package/$(ls chart-package)" allanger-charts
- 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)" badhouseplants-net
- name: Init git submodules with themes
image: alpine/git
@ -43,7 +43,7 @@ steps:
username: allanger
password:
from_secret: GITEA_TOKEN
repo: git.badhouseplants.net/allanger/badhouseplants-net
repo: git.badhouseplants.net/${DRONE_REPO}
tags: ${DRONE_COMMIT_SHA}
- name: Build and push the docker image with latest
@ -56,7 +56,7 @@ steps:
username: allanger
password:
from_secret: GITEA_TOKEN
repo: git.badhouseplants.net/allanger/badhouseplants-net
repo: git.badhouseplants.net/${DRONE_REPO}
tags:
- ${DRONE_COMMIT_SHA}
- latest
@ -125,6 +125,16 @@ steps:
- argocd app sync -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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,15 +3,30 @@
# Modules used
use strict;
use warnings;
use Carp;
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";
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 $cmd = "git log --format=format:%H --all";
my @output = `$cmd`;
chomp @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 (@output)
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`;
}
}