From 1c165fcea32e0856adfe88737a9360a9ef69c7ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Dachary?= Date: Fri, 23 Dec 2022 01:52:53 +0100 Subject: [PATCH] upgrade gitea to forgejo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Loïc Dachary --- .env-sample | 2 +- .woodpecker.yml | 10 +- Dockerfile | 2 +- accounts/templates/accounts/auth/base.html | 6 +- billing/tests.py | 2 +- dash/templates/dash/instances/view/index.html | 2 +- dash/tests.py | 2 +- dash/utils.py | 2 +- dash/views.py | 4 +- dashboard/local_settings.ci.py | 12 +- dashboard/local_settings.example.py | 8 +- dashboard/settings.py | 8 +- docker-compose-dev-deps.yml | 10 +- docs/HACKING.md | 2 +- docs/INSTALL.md | 10 +- infrastructure/management/commands/vm.py | 8 +- ... 0002_instancecreated_forgejo_password.py} | 2 +- ...3_rename_creted_instancecreated_created.py | 2 +- ...alter_instancecreated_forgejo_password.py} | 4 +- ...emove_instancecreated_forgejo_password.py} | 4 +- infrastructure/migrations/0006_job.py | 2 +- .../{gitea-creds.txt => forgejo-creds.txt} | 8 +- .../emails/instance-created.txt | 2 +- .../emails/staff-new-instance-alert.txt | 2 +- .../templates/infrastructure/html/create.html | 4 +- .../infrastructure/sh/hostscripts/create.sh | 2 +- .../yml/{gitea.yml => forgejo.yml} | 24 +-- .../templates/infrastructure/yml/service.yml | 2 +- infrastructure/tests.py | 12 +- infrastructure/utils.py | 46 +++--- infrastructure/views.py | 10 +- integration/ci.sh | 2 +- integration/cli.py | 112 ++++++------- integration/csrf.py | 2 +- integration/{gitea.py => forgejo.py} | 28 ++-- integration/lib.sh | 154 +++++++++--------- support/tests.py | 12 +- support/utils.py | 4 +- 38 files changed, 265 insertions(+), 265 deletions(-) rename infrastructure/migrations/{0002_instancecreated_gitea_password.py => 0002_instancecreated_forgejo_password.py} (92%) rename infrastructure/migrations/{0004_alter_instancecreated_gitea_password.py => 0004_alter_instancecreated_forgejo_password.py} (81%) rename infrastructure/migrations/{0005_remove_instancecreated_gitea_password.py => 0005_remove_instancecreated_forgejo_password.py} (70%) rename infrastructure/templates/infrastructure/emails/{gitea-creds.txt => forgejo-creds.txt} (65%) rename infrastructure/templates/infrastructure/yml/{gitea.yml => forgejo.yml} (69%) rename integration/{gitea.py => forgejo.py} (96%) diff --git a/.env-sample b/.env-sample index 0faaf10..9095b80 100644 --- a/.env-sample +++ b/.env-sample @@ -3,5 +3,5 @@ export db="" export STRIPE_SECRET_KEY="" export STRIPE_PUBLIC_KEY="" export HOSTEA_INFRA_HOSTEA_REPO_REMOTE="ssh://git@localhost:22/hostea/fleet.git" -export HOSTEA_META_GITEA_INSTANCE="http://localhost:3000" +export HOSTEA_META_FORGEJO_INSTANCE="http://localhost:3000" export HOSTEA_INFRA_HOSTEA_REPO_SSH_KEY="$(realpath ./tests/fleet-deploy-key)" diff --git a/.woodpecker.yml b/.woodpecker.yml index c05b5d8..7c67de7 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -4,8 +4,8 @@ pipeline: environment: - DATABSE_URL=postgres://postgres:password@database:5432/postgres - EMAIL_URL=smtp://admin:password@smtp:10025 - - HOSTEA_INFRA_HOSTEA_REPO_REMOTE=ssh://git@gitea:22/hostea/ - - HOSTEA_META_GITEA_INSTANCE=http://gitea:3000 + - HOSTEA_INFRA_HOSTEA_REPO_REMOTE=ssh://git@forgejo:22/hostea/ + - HOSTEA_META_FORGEJO_INSTANCE=http://forgejo:3000 commands: - export HOSTEA_INFRA_HOSTEA_REPO_SSH_KEY="$(realpath ./tests/fleet-deploy-key)" - pip install virtualenv @@ -21,9 +21,9 @@ services: environment: - POSTGRES_PASSWORD=password - gitea: - image: gitea/gitea:1.16.5 - container_name: hostea-dash-gitea + forgejo: + image: forgejo/forgejo:1.18.0-rc1-1 + container_name: hostea-dash-forgejo smtp: image: maildev/maildev:latest diff --git a/Dockerfile b/Dockerfile index f2691f9..16b72a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python -LABEL org.opencontainers.image.source https://gitea.hostea.org/Hostea/dashboard +LABEL org.opencontainers.image.source https://forgejo.hostea.org/Hostea/dashboard RUN useradd -ms /bin/bash -u 1001 hostea RUN apt-get update && apt-get install -y ca-certificates git diff --git a/accounts/templates/accounts/auth/base.html b/accounts/templates/accounts/auth/base.html index c532e23..ee47699 100644 --- a/accounts/templates/accounts/auth/base.html +++ b/accounts/templates/accounts/auth/base.html @@ -6,13 +6,13 @@
-

Gitea hosting and service

+

Forgejo hosting and service

A free forge ecosystem for free developers.

    -
  • Dedicated Gitea hosting and Woodpecker CI from 10€/month
  • -
  • Clinic to heal sick Gitea instances
  • +
  • Dedicated Forgejo hosting and Woodpecker CI from 10€/month
  • +
  • Clinic to heal sick Forgejo instances
  • 100% Free Software
  • Radically Transparent
  • Run by a horizontal collective
  • diff --git a/billing/tests.py b/billing/tests.py index 365fbc5..5c7023b 100644 --- a/billing/tests.py +++ b/billing/tests.py @@ -95,7 +95,7 @@ class BillingTest(TestCase): # sent when the invoice is generated and one after payment is made # # So we are first checking for the last email that was sent(receipt) - # and then the Gitea instance credentials notification followed by the + # and then the Forgejo instance credentials notification followed by the # invoice generation email. receipt_mail = mail.outbox.pop() print(receipt_mail.body) diff --git a/dash/templates/dash/instances/view/index.html b/dash/templates/dash/instances/view/index.html index b5bfb28..4284db0 100644 --- a/dash/templates/dash/instances/view/index.html +++ b/dash/templates/dash/instances/view/index.html @@ -12,7 +12,7 @@

Created On: {{ instance.created_at }}

-

Gitea Instance|Woodpecker CI

+

Forgejo Instance|Woodpecker CI

"META": { # <--snip---> - "GITEA_INSTANCE": "https://gitea.gna.org", # meta Gitea insatnce - "GITEA_ORG_NAME": "Hostea", # Organisation name on Hostea meta instance + "FORGEJO_INSTANCE": "https://forgejo.gna.org", # meta Forgejo insatnce + "FORGEJO_ORG_NAME": "Hostea", # Organisation name on Hostea meta instance # Repository dedicated for handling support - # ref: https://gitea.gna.org/Hostea/july-mvp/issues/17 + # ref: https://forgejo.gna.org/Hostea/july-mvp/issues/17 "SUPPORT_REPOSITORY": "support", }, } diff --git a/infrastructure/management/commands/vm.py b/infrastructure/management/commands/vm.py index 2495a20..9e0a13c 100644 --- a/infrastructure/management/commands/vm.py +++ b/infrastructure/management/commands/vm.py @@ -93,9 +93,9 @@ class Command(BaseCommand): instance = create_instance( vm_name=vm_name, configuration_name=size, user=user ) - (gitea_password, _commit) = create_vm_if_not_exists(instance) + (forgejo_password, _commit) = create_vm_if_not_exists(instance) print("Instance created") - print(f"Gitea admin password: {gitea_password}") + print(f"Forgejo admin password: {forgejo_password}") except VmException as e: if e.code == VmErrors.NAME_EXISTS: instance = Instance.objects.get(name=vm_name) @@ -104,9 +104,9 @@ class Command(BaseCommand): name=size ) instance.save() - (gitea_password, _commit) = create_vm_if_not_exists(instance) + (forgejo_password, _commit) = create_vm_if_not_exists(instance) print("Instance created") - print(f"Gitea admin password: {gitea_password}") + print(f"Forgejo admin password: {forgejo_password}") else: self.stderr.write(self.style.ERROR(f"error: {str(e)}")) diff --git a/infrastructure/migrations/0002_instancecreated_gitea_password.py b/infrastructure/migrations/0002_instancecreated_forgejo_password.py similarity index 92% rename from infrastructure/migrations/0002_instancecreated_gitea_password.py rename to infrastructure/migrations/0002_instancecreated_forgejo_password.py index 0777dbd..e0dcf5f 100644 --- a/infrastructure/migrations/0002_instancecreated_gitea_password.py +++ b/infrastructure/migrations/0002_instancecreated_forgejo_password.py @@ -12,7 +12,7 @@ class Migration(migrations.Migration): operations = [ migrations.AddField( model_name="instancecreated", - name="gitea_password", + name="forgejo_password", field=models.CharField( default=None, max_length=32, verbose_name="Name of this configuration" ), diff --git a/infrastructure/migrations/0003_rename_creted_instancecreated_created.py b/infrastructure/migrations/0003_rename_creted_instancecreated_created.py index 3fcb19a..f50b898 100644 --- a/infrastructure/migrations/0003_rename_creted_instancecreated_created.py +++ b/infrastructure/migrations/0003_rename_creted_instancecreated_created.py @@ -6,7 +6,7 @@ from django.db import migrations class Migration(migrations.Migration): dependencies = [ - ("infrastructure", "0002_instancecreated_gitea_password"), + ("infrastructure", "0002_instancecreated_forgejo_password"), ] operations = [ diff --git a/infrastructure/migrations/0004_alter_instancecreated_gitea_password.py b/infrastructure/migrations/0004_alter_instancecreated_forgejo_password.py similarity index 81% rename from infrastructure/migrations/0004_alter_instancecreated_gitea_password.py rename to infrastructure/migrations/0004_alter_instancecreated_forgejo_password.py index 992f662..e592971 100644 --- a/infrastructure/migrations/0004_alter_instancecreated_gitea_password.py +++ b/infrastructure/migrations/0004_alter_instancecreated_forgejo_password.py @@ -12,11 +12,11 @@ class Migration(migrations.Migration): operations = [ migrations.AlterField( model_name="instancecreated", - name="gitea_password", + name="forgejo_password", field=models.CharField( default=None, max_length=32, - verbose_name="Gitea password of this deployment", + verbose_name="Forgejo password of this deployment", ), ), ] diff --git a/infrastructure/migrations/0005_remove_instancecreated_gitea_password.py b/infrastructure/migrations/0005_remove_instancecreated_forgejo_password.py similarity index 70% rename from infrastructure/migrations/0005_remove_instancecreated_gitea_password.py rename to infrastructure/migrations/0005_remove_instancecreated_forgejo_password.py index 6185e3a..6659d1e 100644 --- a/infrastructure/migrations/0005_remove_instancecreated_gitea_password.py +++ b/infrastructure/migrations/0005_remove_instancecreated_forgejo_password.py @@ -6,12 +6,12 @@ from django.db import migrations class Migration(migrations.Migration): dependencies = [ - ("infrastructure", "0004_alter_instancecreated_gitea_password"), + ("infrastructure", "0004_alter_instancecreated_forgejo_password"), ] operations = [ migrations.RemoveField( model_name="instancecreated", - name="gitea_password", + name="forgejo_password", ), ] diff --git a/infrastructure/migrations/0006_job.py b/infrastructure/migrations/0006_job.py index 4561f62..b4bfe9d 100644 --- a/infrastructure/migrations/0006_job.py +++ b/infrastructure/migrations/0006_job.py @@ -8,7 +8,7 @@ class Migration(migrations.Migration): dependencies = [ ("dash", "0006_auto_20220619_0800"), - ("infrastructure", "0005_remove_instancecreated_gitea_password"), + ("infrastructure", "0005_remove_instancecreated_forgejo_password"), ] operations = [ diff --git a/infrastructure/templates/infrastructure/emails/gitea-creds.txt b/infrastructure/templates/infrastructure/emails/forgejo-creds.txt similarity index 65% rename from infrastructure/templates/infrastructure/emails/gitea-creds.txt rename to infrastructure/templates/infrastructure/emails/forgejo-creds.txt index b36e123..be5ef9f 100644 --- a/infrastructure/templates/infrastructure/emails/gitea-creds.txt +++ b/infrastructure/templates/infrastructure/emails/forgejo-creds.txt @@ -6,13 +6,13 @@ Your Gna! instance is being prepared, you will receive an email notification when it is ready. You can use the following credentials to log into an admin account on -your new Gna! Gitea instance. Great powers come with great +your new Gna! Forgejo instance. Great powers come with great responsibilities, so use the admin credentials wisely. When in doubt, -consult the Gitea docs or contact support! +consult the Forgejo docs or contact support! - username : root - - password: {{ gitea_password }} - - Gitea {{ gitea_uri }} + - password: {{ forgejo_password }} + - Forgejo {{ forgejo_uri }} Cheers, Gna! team diff --git a/infrastructure/templates/infrastructure/emails/instance-created.txt b/infrastructure/templates/infrastructure/emails/instance-created.txt index 2de0d14..f7585da 100644 --- a/infrastructure/templates/infrastructure/emails/instance-created.txt +++ b/infrastructure/templates/infrastructure/emails/instance-created.txt @@ -4,7 +4,7 @@ The deployment job has run to completion and your Gna! instance is now online! Credentials to admin account was sent in an earlier email, please contact support if didn't receive it. -Gitea: {{ gitea_uri }} +Forgejo: {{ forgejo_uri }} Woodpecker CI: {{ woodpecker_uri }} Cheers, diff --git a/infrastructure/templates/infrastructure/emails/staff-new-instance-alert.txt b/infrastructure/templates/infrastructure/emails/staff-new-instance-alert.txt index 4fc491e..7b66831 100644 --- a/infrastructure/templates/infrastructure/emails/staff-new-instance-alert.txt +++ b/infrastructure/templates/infrastructure/emails/staff-new-instance-alert.txt @@ -3,7 +3,7 @@ Hello {{ username }}!, A customer has purchased a new instance. Please find the details below: -Gitea: {{ gitea_uri }} +Forgejo: {{ forgejo_uri }} Woodpecker CI: {{ woodpecker_uri }} Cheers, diff --git a/infrastructure/templates/infrastructure/html/create.html b/infrastructure/templates/infrastructure/html/create.html index d392cf5..0b270d9 100644 --- a/infrastructure/templates/infrastructure/html/create.html +++ b/infrastructure/templates/infrastructure/html/create.html @@ -1,11 +1,11 @@ {% extends 'dash/common/base.html' %} {% block dash %}

{{ title }}

-

Gitea Admin Credentials

+

Forgejo Admin Credentials

  • Username: root
  • -
  • Password: {{ gitea_password }}
  • +
  • Password: {{ forgejo_password }}
{% endblock %} diff --git a/infrastructure/templates/infrastructure/sh/hostscripts/create.sh b/infrastructure/templates/infrastructure/sh/hostscripts/create.sh index 4a4f752..4a0bddf 100644 --- a/infrastructure/templates/infrastructure/sh/hostscripts/create.sh +++ b/infrastructure/templates/infrastructure/sh/hostscripts/create.sh @@ -1,2 +1,2 @@ enough --domain $domain host create {{subdomain}}-host -enough --domain $domain service create --host {{subdomain}}-host gitea +enough --domain $domain service create --host {{subdomain}}-host forgejo diff --git a/infrastructure/templates/infrastructure/yml/gitea.yml b/infrastructure/templates/infrastructure/yml/forgejo.yml similarity index 69% rename from infrastructure/templates/infrastructure/yml/gitea.yml rename to infrastructure/templates/infrastructure/yml/forgejo.yml index fb76447..768f069 100644 --- a/infrastructure/templates/infrastructure/yml/gitea.yml +++ b/infrastructure/templates/infrastructure/yml/forgejo.yml @@ -2,49 +2,49 @@ # ####################################### # -# Public hostname of the Gitea instance +# Public hostname of the Forgejo instance # # -gitea_host: "{{ subdomain }}.{{ '{' }}{{ '{' }} domain {{ '}' }}{{ '}' }}" +forgejo_host: "{{ subdomain }}.{{ '{' }}{{ '{' }} domain {{ '}' }}{{ '}' }}" # ####################################### # # Mailer from # # -gitea_mailer_from: "noreply@{{ '{' }}{{ '{' }} domain {{ '}' }}{{ '}' }}" +forgejo_mailer_from: "noreply@{{ '{' }}{{ '{' }} domain {{ '}' }}{{ '}' }}" # ####################################### # -# SSH port of the Gitea instance +# SSH port of the Forgejo instance # # -gitea_ssh_port: "22" +forgejo_ssh_port: "22" # ####################################### # -# Gitea version +# Forgejo version # # -#gitea_version: "1.16.8" +#forgejo_version: "1.18.0-rc1-1" # ####################################### # # Admin user name # -gitea_user: root +forgejo_user: root # ####################################### # # Admin user password # -gitea_password: "{{ gitea_password }}" +forgejo_password: "{{ forgejo_password }}" # ####################################### # # Admin user email # -gitea_email: "{{ gitea_email }}" +forgejo_email: "{{ forgejo_email }}" # ####################################### # @@ -60,9 +60,9 @@ woodpecker_host: "{{ '{' }}{{ '{' }} woodpecker_hostname {{ '}' }}{{ '}' }}.{{ ' # ####################################### # -# Gitea users with admin rights on woodpecker +# Forgejo users with admin rights on woodpecker # -woodpecker_admins: "{{ '{' }}{{ '{' }} gitea_user {{ '}' }}{{ '}' }}" +woodpecker_admins: "{{ '{' }}{{ '{' }} forgejo_user {{ '}' }}{{ '}' }}" # ####################################### # diff --git a/infrastructure/templates/infrastructure/yml/service.yml b/infrastructure/templates/infrastructure/yml/service.yml index 27c35ce..078bfda 100644 --- a/infrastructure/templates/infrastructure/yml/service.yml +++ b/infrastructure/templates/infrastructure/yml/service.yml @@ -1,4 +1,4 @@ -gitea-service-group: +forgejo-service-group: hosts: {{ subdomain }}-host: ansible_port: 2222 diff --git a/infrastructure/tests.py b/infrastructure/tests.py index 156f95d..7ccb51a 100644 --- a/infrastructure/tests.py +++ b/infrastructure/tests.py @@ -54,8 +54,8 @@ class InfraUtilTest(TestCase): # ) # # self.assertEqual( - # base.joinpath(f"inventory/host_vars/{subdomain}-host/gitea.yml"), - # infra._gitea_path(subdomain=subdomain), + # base.joinpath(f"inventory/host_vars/{subdomain}-host/forgejo.yml"), + # infra._forgejo_path(subdomain=subdomain), # ) # # self.assertEqual( @@ -156,7 +156,7 @@ class InfraUtilTest(TestCase): # call_command("vm", "delete", subdomain) # # def test_worker(self): - # subdomain = "gitea" # yes, gitea.hostea.org exists. will use it till I + # subdomain = "forgejo" # yes, forgejo.hostea.org exists. will use it till I # # figure out how to use requests_mock within django # c = Client() # login_util(self, c, "accounts.home") @@ -166,8 +166,8 @@ class InfraUtilTest(TestCase): # # instance = Instance.objects.get(name=subdomain) # job = Job.objects.create(instance=instance, job_type=JobType.PING) - # gitea_uri = Infra.get_gitea_uri(instance=instance) - # print(f"mocking {gitea_uri}") + # forgejo_uri = Infra.get_forgejo_uri(instance=instance) + # print(f"mocking {forgejo_uri}") # # w = Worker(job=job) # w.start() @@ -184,7 +184,7 @@ class InfraUtilTest(TestCase): Test if the dashboard generates invoices for a VM crated with a name matching a VM name that was deleted that existed. - ref: https://gitea.hostea.org/Hostea/dashboard/issues/38#issuecomment-1162 + ref: https://forgejo.hostea.org/Hostea/dashboard/issues/38#issuecomment-1162 """ c = Client() login_util(self, c, "accounts.home") diff --git a/infrastructure/utils.py b/infrastructure/utils.py index 11223f0..417f1a8 100644 --- a/infrastructure/utils.py +++ b/infrastructure/utils.py @@ -43,12 +43,12 @@ class Worker(Thread): super().__init__() def run(self): - gitea_uri = Infra.get_gitea_uri(instance=self.job.instance) + forgejo_uri = Infra.get_forgejo_uri(instance=self.job.instance) woodpecker = Infra.get_woodpecker_uri(instance=self.job.instance) while True: try: - print(f"[ping] Trying to reach {gitea_uri}") - resp = requests.get(gitea_uri) + print(f"[ping] Trying to reach {forgejo_uri}") + resp = requests.get(forgejo_uri) if resp.status_code == 200: break except Exception: @@ -60,7 +60,7 @@ class Worker(Thread): email = job.instance.owned_by.email ctx = { - "gitea_uri": gitea_uri, + "forgejo_uri": forgejo_uri, "woodpecker_uri": woodpecker, "username": job.instance.owned_by.username, } @@ -82,18 +82,18 @@ class Worker(Thread): def create_vm_if_not_exists(instance: Instance) -> (str, str): """ - Create VM utility. Gitea password is returned + Create VM utility. Forgejo password is returned """ def notify_staff(instance: Instance): infra = Infra() User = get_user_model() - gitea_uri = Infra.get_gitea_uri(instance=instance) + forgejo_uri = Infra.get_forgejo_uri(instance=instance) woodpecker = Infra.get_woodpecker_uri(instance=instance) for staff in User.objects.filter(is_staff=True): ctx = { - "gitea_uri": gitea_uri, + "forgejo_uri": forgejo_uri, "woodpecker_uri": woodpecker, "username": staff.username, } @@ -113,12 +113,12 @@ def create_vm_if_not_exists(instance: Instance) -> (str, str): infra = Infra() if not InstanceCreated.objects.filter(instance=instance).exists(): - (gitea_password, commit) = infra.add_vm(instance=instance) + (forgejo_password, commit) = infra.add_vm(instance=instance) InstanceCreated.objects.create(instance=instance, created=True) notify_staff(instance=instance) job = Job.objects.create(instance=instance, job_type=str(JobType.PING)) Worker(job=job).start() - return (gitea_password, commit) + return (forgejo_password, commit) else: if str.strip(infra.get_flavor(instance=instance)) != str.strip( infra.translate_size(instance=instance) @@ -177,9 +177,9 @@ class Infra: return self._host_vars_dir(subdomain=subdomain).joinpath("provision.yml") @classmethod - def get_gitea_uri(cls, instance: Instance) -> str: + def get_forgejo_uri(cls, instance: Instance) -> str: """ - Get an instance's Gitea URI + Get an instance's Forgejo URI """ base = settings.HOSTEA["INFRA"]["HOSTEA_DOMAIN"] return f"https://{instance.name}.{base}" @@ -194,7 +194,7 @@ class Infra: @classmethod def get_woodpecker_uri(cls, instance: Instance) -> str: """ - Get an instance's Gitea URI + Get an instance's Forgejo URI """ base = settings.HOSTEA["INFRA"]["HOSTEA_DOMAIN"] return f"https://{cls._gen_woodpecker_hostname(instance=instance)}.{base}" @@ -211,12 +211,12 @@ class Infra: return config["openstack_flavor"].split("{{ ")[1].split(" }}")[0] return None - def _gitea_path(self, subdomain: str) -> Path: + def _forgejo_path(self, subdomain: str) -> Path: """ - utility method: get gitea file for a subdomain + utility method: get forgejo file for a subdomain """ - return self._host_vars_dir(subdomain=subdomain).joinpath("gitea.yml") + return self._host_vars_dir(subdomain=subdomain).joinpath("forgejo.yml") def _backup_path(self, subdomain: str) -> Path: """ @@ -284,7 +284,7 @@ class Infra: """ Add new VM to infrastructure repository - The gitea user password is returned + The forgejo user password is returned """ subdomain = instance.name @@ -298,22 +298,22 @@ class Infra: os.makedirs(hostscript_path) woodpecker_agent_secret = get_random_string(64) - gitea_password = get_random_string(20) + forgejo_password = get_random_string(20) ctx = { "woodpecker_agent_secret": woodpecker_agent_secret, "woodpecker_hostname": self._gen_woodpecker_hostname(instance=instance), "woodpecker_admins": f"{instance.owned_by.username}", - "gitea_email": instance.owned_by.email, - "gitea_password": gitea_password, + "forgejo_email": instance.owned_by.email, + "forgejo_password": forgejo_password, "subdomain": subdomain, } - gitea = self._gitea_path(subdomain) - with open(gitea, "w+", encoding="utf-8") as f: + forgejo = self._forgejo_path(subdomain) + with open(forgejo, "w+", encoding="utf-8") as f: f.write( render_to_string( - "infrastructure/yml/gitea.yml", + "infrastructure/yml/forgejo.yml", context=ctx, ) ) @@ -357,7 +357,7 @@ class Infra: ) commit = self._push(f"add vm {subdomain}") - return (gitea_password, commit) + return (forgejo_password, commit) def remove_vm(self, instance: Instance): """ diff --git a/infrastructure/views.py b/infrastructure/views.py index 066a081..e3fd23a 100644 --- a/infrastructure/views.py +++ b/infrastructure/views.py @@ -53,23 +53,23 @@ def create_instance(request, instance_name: str): res = create_vm_if_not_exists(instance=instance) if res is not None: - (gitea_password, commit) = res + (forgejo_password, commit) = res ctx = { "username": request.user.username, - "gitea_password": gitea_password, - "gitea_uri": Infra.get_gitea_uri(instance=instance), + "forgejo_password": forgejo_password, + "forgejo_uri": Infra.get_forgejo_uri(instance=instance), } body = render_to_string( - "infrastructure/emails/gitea-creds.txt", + "infrastructure/emails/forgejo-creds.txt", context=ctx, ) sender = settings.DEFAULT_FROM_EMAIL send_mail( - subject="[Gna!] Gitea admin credentials", + subject="[Gna!] Forgejo admin credentials", message=body, from_email=f"No reply Gna!<{sender}>", # TODO read from settings.py recipient_list=[request.user.email], diff --git a/integration/ci.sh b/integration/ci.sh index a25fa34..23d31a3 100755 --- a/integration/ci.sh +++ b/integration/ci.sh @@ -16,7 +16,7 @@ init() { sleep 5 # wait_for_env fi - gitea_root + forgejo_root support_repo_init fleet_repo_init } diff --git a/integration/cli.py b/integration/cli.py index 9ffc9be..0016e8e 100644 --- a/integration/cli.py +++ b/integration/cli.py @@ -3,10 +3,10 @@ import argparse from requests import Session -def gitea_from_args(args, c: Session): - from .gitea import Gitea +def forgejo_from_args(args, c: Session): + from .forgejo import Forgejo - return Gitea( + return Forgejo( host=args.host, username=args.username, password=args.password, @@ -15,7 +15,7 @@ def gitea_from_args(args, c: Session): ) -class Gitea: +class Forgejo: def __init__(self, parser, c: Session): self.c = c self.parser = parser @@ -29,56 +29,56 @@ class Gitea: def __add_credentials_parser(self, parser): group = parser.add_argument_group("credentials", "User credentials") - group.add_argument("username", type=str, help="Gitea user's username") - group.add_argument("password", type=str, help="Gitea user's password") - group.add_argument("email", type=str, help="Gitea user's email") - group.add_argument("host", type=str, help="URI at which Gitea is running") + group.add_argument("username", type=str, help="Forgejo user's username") + group.add_argument("password", type=str, help="Forgejo user's password") + group.add_argument("email", type=str, help="Forgejo user's email") + group.add_argument("host", type=str, help="URI at which Forgejo is running") def install(self): def run(args, c: Session): - gitea = gitea_from_args(args, c=c) - gitea.install() + forgejo = forgejo_from_args(args, c=c) + forgejo.install() self.install_parser = self.subparser.add_parser( - name="install", description="Install Gitea", help="Install Gitea" + name="install", description="Install Forgejo", help="Install Forgejo" ) self.__add_credentials_parser(self.install_parser) self.install_parser.set_defaults(func=run) def register(self): def run(args, c: Session): - gitea = gitea_from_args(args, c=c) - gitea.register() + forgejo = forgejo_from_args(args, c=c) + forgejo.register() self.register_parser = self.subparser.add_parser( name="register", - description="Gitea user registration", - help="Register a user on Gitea", + description="Forgejo user registration", + help="Register a user on Forgejo", ) self.__add_credentials_parser(self.register_parser) self.register_parser.set_defaults(func=run) def login(self): def run(args, c: Session): - gitea = gitea_from_args(args, c=c) - gitea.login() + forgejo = forgejo_from_args(args, c=c) + forgejo.login() self.login_parser = self.subparser.add_parser( - name="login", description="Gitea user login", help="Login on Gitea" + name="login", description="Forgejo user login", help="Login on Forgejo" ) self.__add_credentials_parser(self.login_parser) self.login_parser.set_defaults(func=run) def create_repository(self): def run(args, c: Session): - gitea = gitea_from_args(args, c=c) - gitea.login() - gitea.create_repository(name=args.repo_name) + forgejo = forgejo_from_args(args, c=c) + forgejo.login() + forgejo.create_repository(name=args.repo_name) self.create_repository_parser = self.subparser.add_parser( name="create_repo", - description="Create repository on Gitea", - help="Create repository on Gitea", + description="Create repository on Forgejo", + help="Create repository on Forgejo", ) self.__add_credentials_parser(self.create_repository_parser) self.create_repository_parser.set_defaults(func=run) @@ -88,10 +88,10 @@ class Gitea: def install_sso(self): def run(args, c: Session): - gitea = gitea_from_args(args, c=c) - gitea.login() + forgejo = forgejo_from_args(args, c=c) + forgejo.login() print(f"CLIENT ID: {args.client_id}") - gitea.install_sso( + forgejo.install_sso( sso_name=args.sso_name, client_id=args.client_id, client_secret=args.client_secret, @@ -100,8 +100,8 @@ class Gitea: self.install_sso_parser = self.subparser.add_parser( name="install_sso", - description="Install SSO on Gitea", - help="Install SSO on Gitea", + description="Install SSO on Forgejo", + help="Install SSO on Forgejo", ) self.__add_credentials_parser(self.install_sso_parser) self.install_sso_parser.add_argument( @@ -123,14 +123,14 @@ class Gitea: def add_deploy_key(self): def run(args, c: Session): - gitea = gitea_from_args(args, c=c) - gitea.login() - gitea.add_deploy_key(repo=args.repo_name, key=args.key_file) + forgejo = forgejo_from_args(args, c=c) + forgejo.login() + forgejo.add_deploy_key(repo=args.repo_name, key=args.key_file) self.add_deploy_key_parser = self.subparser.add_parser( name="add_deploy_key", - description="Create repository on Gitea", - help="Add deploy key to a repository on Gitea", + description="Create repository on Forgejo", + help="Add deploy key to a repository on Forgejo", ) self.__add_credentials_parser(self.add_deploy_key_parser) self.add_deploy_key_parser.add_argument( @@ -203,21 +203,21 @@ class Hostea: def support(self): def run(args, c: Session): - from .gitea import GiteaSSO + from .forgejo import ForgejoSSO dash = dash_from_args(args, c=c) dash.login() - gitea = GiteaSSO( + forgejo = ForgejoSSO( username=dash.username, email=dash.email, - gitea_host=args.gitea_host, - hostea_org=args.gitea_hostea_org, + forgejo_host=args.forgejo_host, + hostea_org=args.forgejo_hostea_org, support_repo=args.support_repo, c=c, ) - dash.new_ticket(gitea.new_issues_uri) - gitea.new_issue() + dash.new_ticket(forgejo.new_issues_uri) + forgejo.new_issue() self.support_parser = self.subparser.add_parser( name="support", @@ -226,12 +226,12 @@ class Hostea: ) self.__add_credentials_parser(self.support_parser) self.support_parser.add_argument( - "gitea_host", type=str, help="URI at which Gitea is running" + "forgejo_host", type=str, help="URI at which Forgejo is running" ) self.support_parser.add_argument( - "gitea_hostea_org", + "forgejo_hostea_org", type=str, - help="Hostea namespace(username/org) on Gitea, where support repository is hosted", + help="Hostea namespace(username/org) on Forgejo, where support repository is hosted", ) self.support_parser.add_argument( "support_repo", type=str, help="support repository name" @@ -245,28 +245,28 @@ class Cli: c = Session() self.c = c self.parser = argparse.ArgumentParser( - description="Install and Bootstrap Gitea and Hostea Dashboard" + description="Install and Bootstrap Forgejo and Hostea Dashboard" ) self.subparser = self.parser.add_subparsers() self.check_env() - self.gitea() + self.forgejo() self.hostea() def __add_credentials_parser(self, parser): group = parser.add_argument_group("credentials", "User credentials") - group.add_argument("username", type=str, help="Gitea user's username") - group.add_argument("password", type=str, help="Gitea user's password") - group.add_argument("email", type=str, help="Gitea user's email") + group.add_argument("username", type=str, help="Forgejo user's username") + group.add_argument("password", type=str, help="Forgejo user's password") + group.add_argument("email", type=str, help="Forgejo user's email") def check_env(self): def run(args, c: Session): - from .gitea import Gitea + from .forgejo import Forgejo from .hostea import Hostea Hostea.check_online( dashboard_host=args.hostea_host, maildev_host=args.maildev_host ) - Gitea.check_online(host=args.gitea_host) + Forgejo.check_online(host=args.forgejo_host) self.check_env_parser = self.subparser.add_parser( name="check_env", @@ -275,7 +275,7 @@ class Cli: ) self.check_env_parser.add_argument( - "gitea_host", type=str, help="URI at which Gitea is running" + "forgejo_host", type=str, help="URI at which Forgejo is running" ) self.check_env_parser.add_argument( @@ -295,13 +295,13 @@ class Cli: ) Hostea(parser=self.hostea, c=self.c) - def gitea(self): - self.gitea = self.subparser.add_parser( - name="gitea", - description="Gitea", - help="Gitea-related functionality", + def forgejo(self): + self.forgejo = self.subparser.add_parser( + name="forgejo", + description="Forgejo", + help="Forgejo-related functionality", ) - Gitea(parser=self.gitea, c=self.c) + Forgejo(parser=self.forgejo, c=self.c) def parse(self): return self.parser.parse_args() diff --git a/integration/csrf.py b/integration/csrf.py index bee85ca..70d1e1e 100644 --- a/integration/csrf.py +++ b/integration/csrf.py @@ -13,7 +13,7 @@ class ParseCSRF(HTMLParser): # return cls(name="csrfmiddlewaretoken") # # @classmethod - # def gitea_parser(cls) -> "ParseCSRF": + # def forgejo_parser(cls) -> "ParseCSRF": # return cls(name="_csrf") # def handle_starttag(self, tag: str, attrs: (str, str)): diff --git a/integration/gitea.py b/integration/forgejo.py similarity index 96% rename from integration/gitea.py rename to integration/forgejo.py index 3407c48..5912b8e 100755 --- a/integration/gitea.py +++ b/integration/forgejo.py @@ -10,15 +10,15 @@ import requests from .csrf import ParseCSRF -# GITEA_USER = "root" -# GITEA_EMAIL = "root@example.com" -# GITEA_PASSWORD = "foobarpassword" +# FORGEJO_USER = "root" +# FORGEJO_EMAIL = "root@example.com" +# FORGEJO_PASSWORD = "foobarpassword" # HOST = "http://localhost:8080" # # REPOS = [] -class Gitea: +class Forgejo: def __init__(self, host: str, username: str, password: str, email: str, c: Session): self.host = host self.username = username @@ -48,7 +48,7 @@ class Gitea: @staticmethod def check_online(host: str): """ - Check if Gitea instance is online + Check if Forgejo instance is online """ count = 0 parsed = urlparse(host) @@ -67,7 +67,7 @@ class Gitea: def install(self): """ - Install Gitea, first form that a user sees when a new instance is + Install Forgejo, first form that a user sees when a new instance is deployed """ # cwd = os.environ.get("PWD") @@ -77,12 +77,12 @@ class Gitea: "db_host": "localhost:3306", "db_user": "root", "db_passwd": "", - "db_name": "gitea", + "db_name": "forgejo", "ssl_mode": "disable", "db_schema": "", "charset": "utf8", "db_path": "/data/gitea/gitea.db", - "app_name": "Gitea:+Git+with+a+cup+of+tea", + "app_name": "Forgejo:+Beyond+Coding+We+Forge", "repo_root_path": "/data/git/repositories", "lfs_root_path": "/data/git/lfs", "run_user": "git", @@ -316,26 +316,26 @@ class ParseSSOLogin(HTMLParser): return -class GiteaSSO: +class ForgejoSSO: def __init__( self, username: str, email: str, - gitea_host: str, + forgejo_host: str, hostea_org: str, support_repo: str, c: Session, ): self.c = c self.username = username - self.gitea_host = gitea_host + self.forgejo_host = forgejo_host self.hostea_org = hostea_org self.support_repo = support_repo self.email = email self.__csrf_key = "_csrf" - url = urlparse(self.gitea_host) + url = urlparse(self.forgejo_host) repo = f"{self.hostea_org}/{self.support_repo}" issues = f"{repo}/issues" new_issues = f"{issues}/new" @@ -371,8 +371,8 @@ class GiteaSSO: parser = ParseSSOLogin() parser.feed(resp.text) - url = urlparse(self.gitea_host) - ## SSO URL in Gitea login page + url = urlparse(self.forgejo_host) + ## SSO URL in Forgejo login page sso = urlunparse((url.scheme, url.netloc, parser.url, "", "", "")) # redirects are enabled to for a cleaner implementation. Commented out diff --git a/integration/lib.sh b/integration/lib.sh index ac64d56..f4bc95a 100755 --- a/integration/lib.sh +++ b/integration/lib.sh @@ -11,12 +11,12 @@ is_ci(){ if is_ci then MAILDEV_URL="http://smtp:1080" - GITEA_URL="http://gitea:3000" - GITEA_SSH_URL="ssh://git@gitea:22" + FORGEJO_URL="http://forgejo:3000" + FORGEJO_SSH_URL="ssh://git@forgejo:22" else MAILDEV_URL="http://localhost:1080" - GITEA_URL="http://localhost:3000" - GITEA_SSH_URL="ssh://git@localhost:22" + FORGEJO_URL="http://localhost:3000" + FORGEJO_SSH_URL="ssh://git@localhost:22" fi readonly DASHBOARD_URL="http://localhost:8000" @@ -27,22 +27,22 @@ readonly DASHBOARD_OIDC_DISCOVERY_URL="$DASHBOARD_URL/o/.well-known/openid-confi readonly DASHBOARD_ADMIN_USERNAME=root readonly DASHBOARD_ADMIN_PASSWORD=supercomplicatedpassword readonly DASHBOARD_ADMIN_EMAIL="$DASHBOARD_ADMIN_USERNAME@dash.example.org" -readonly DASHBOARD_OIDC_APP_NAME=hostea-gitea +readonly DASHBOARD_OIDC_APP_NAME=hostea-forgejo -readonly GITEA_ROOT_USERNAME=root -readonly GITEA_ROOT_EMAIL="$GITEA_ROOT_USERNAME@example.org" -readonly GITEA_ROOT_PASSOWRD=supercomplicatedpassword -readonly GITEA_HOSTEA_SSO_NAME=hostea-sso -readonly GITEA_OIDC_CALLBACK="$GITEA_URL/user/oauth2/$GITEA_HOSTEA_SSO_NAME/callback" -readonly GITEA_HOSTEA_FLEET_DEPLOY_KEY="$(realpath tests/fleet-deploy-key.pub)" -readonly GITEA_HOSTEA_FLEET_DEPLOY_KEY_PRIVATE="$(realpath tests/fleet-deploy-key)" +readonly FORGEJO_ROOT_USERNAME=root +readonly FORGEJO_ROOT_EMAIL="$FORGEJO_ROOT_USERNAME@example.org" +readonly FORGEJO_ROOT_PASSOWRD=supercomplicatedpassword +readonly FORGEJO_HOSTEA_SSO_NAME=hostea-sso +readonly FORGEJO_OIDC_CALLBACK="$FORGEJO_URL/user/oauth2/$FORGEJO_HOSTEA_SSO_NAME/callback" +readonly FORGEJO_HOSTEA_FLEET_DEPLOY_KEY="$(realpath tests/fleet-deploy-key.pub)" +readonly FORGEJO_HOSTEA_FLEET_DEPLOY_KEY_PRIVATE="$(realpath tests/fleet-deploy-key)" -readonly GITEA_HOSTEA_USERNAME=hostea -readonly GITEA_HOSTEA_PASSWORD=supercomplicatedpassword -readonly GITEA_HOSTEA_EMAIL="$GITEA_HOSTEA_USERNAME@example.org" -readonly GITEA_HOSTEA_SUPPORT_REPO="support" -readonly GITEA_HOSTEA_FLEET_REPO="fleet" -readonly GITEA_HOSTEA_FLEET_REPO_REMOTE="$GITEA_SSH_URL/$GITEA_HOSTEA_USERNAME/$GITEA_HOSTEA_FLEET_REPO.git" +readonly FORGEJO_HOSTEA_USERNAME=hostea +readonly FORGEJO_HOSTEA_PASSWORD=supercomplicatedpassword +readonly FORGEJO_HOSTEA_EMAIL="$FORGEJO_HOSTEA_USERNAME@example.org" +readonly FORGEJO_HOSTEA_SUPPORT_REPO="support" +readonly FORGEJO_HOSTEA_FLEET_REPO="fleet" +readonly FORGEJO_HOSTEA_FLEET_REPO_REMOTE="$FORGEJO_SSH_URL/$FORGEJO_HOSTEA_USERNAME/$FORGEJO_HOSTEA_FLEET_REPO.git" readonly HOSTEA_CUSTOMER_USERNAME=batman readonly HOSTEA_CUSTOMER_PASSWORD=supercomplicatedpassword @@ -53,7 +53,7 @@ OIDC_CLIENT_SECRET="" wait_for_env() { python -m integration \ - check_env $GITEA_URL $DASHBOARD_URL $MAILDEV_URL + check_env $FORGEJO_URL $DASHBOARD_URL $MAILDEV_URL } # create OIDC app on Hostea Dashboard @@ -67,74 +67,74 @@ oidc_dashboard_init() { resp=$(python manage.py create_oidc \ $DASHBOARD_OIDC_APP_NAME $DASHBOARD_ADMIN_USERNAME \ - $GITEA_OIDC_CALLBACK) + $FORGEJO_OIDC_CALLBACK) OIDC_CLIENT_ID=$(echo $resp | cut -d ":" -f 2 | cut -d " " -f 2) OIDC_CLIENT_SECRET=$(echo $resp | cut -d ":" -f 3 | cut -d " " -f 2) } -# register root user on Gitea to simulate Hoste admin and integrate SSO -gitea_root(){ +# register root user on Forgejo to simulate Hoste admin and integrate SSO +forgejo_root(){ python -m integration \ - gitea install \ - $GITEA_ROOT_USERNAME $GITEA_ROOT_PASSOWRD \ - $GITEA_ROOT_EMAIL \ - $GITEA_URL + forgejo install \ + $FORGEJO_ROOT_USERNAME $FORGEJO_ROOT_PASSOWRD \ + $FORGEJO_ROOT_EMAIL \ + $FORGEJO_URL python -m integration \ - gitea register \ - $GITEA_ROOT_USERNAME $GITEA_ROOT_PASSOWRD \ - $GITEA_ROOT_EMAIL \ - $GITEA_URL + forgejo register \ + $FORGEJO_ROOT_USERNAME $FORGEJO_ROOT_PASSOWRD \ + $FORGEJO_ROOT_EMAIL \ + $FORGEJO_URL python -m integration \ - gitea login \ - $GITEA_ROOT_USERNAME $GITEA_ROOT_PASSOWRD \ - $GITEA_ROOT_EMAIL \ - $GITEA_URL + forgejo login \ + $FORGEJO_ROOT_USERNAME $FORGEJO_ROOT_PASSOWRD \ + $FORGEJO_ROOT_EMAIL \ + $FORGEJO_URL # python -m integration \ -# gitea install_sso \ -# $GITEA_ROOT_USERNAME $GITEA_ROOT_PASSOWRD \ -# $GITEA_ROOT_EMAIL \ -# $GITEA_URL \ -# $GITEA_HOSTEA_SSO_NAME \ +# forgejo install_sso \ +# $FORGEJO_ROOT_USERNAME $FORGEJO_ROOT_PASSOWRD \ +# $FORGEJO_ROOT_EMAIL \ +# $FORGEJO_URL \ +# $FORGEJO_HOSTEA_SSO_NAME \ # $OIDC_CLIENT_ID $OIDC_CLIENT_SECRET \ # $DASHBOARD_OIDC_DISCOVERY_URL } -# register user "Hostea" on Gitea and create support repository +# register user "Hostea" on Forgejo and create support repository support_repo_init() { python -m integration \ - gitea register \ - $GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_PASSWORD \ - $GITEA_HOSTEA_EMAIL \ - $GITEA_URL + forgejo register \ + $FORGEJO_HOSTEA_USERNAME $FORGEJO_HOSTEA_PASSWORD \ + $FORGEJO_HOSTEA_EMAIL \ + $FORGEJO_URL python -m integration \ - gitea login \ - $GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_PASSWORD \ - $GITEA_HOSTEA_EMAIL \ - $GITEA_URL + forgejo login \ + $FORGEJO_HOSTEA_USERNAME $FORGEJO_HOSTEA_PASSWORD \ + $FORGEJO_HOSTEA_EMAIL \ + $FORGEJO_URL python -m integration \ - gitea create_repo \ - $GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_PASSWORD \ - $GITEA_HOSTEA_EMAIL \ - $GITEA_URL \ - $GITEA_HOSTEA_SUPPORT_REPO + forgejo create_repo \ + $FORGEJO_HOSTEA_USERNAME $FORGEJO_HOSTEA_PASSWORD \ + $FORGEJO_HOSTEA_EMAIL \ + $FORGEJO_URL \ + $FORGEJO_HOSTEA_SUPPORT_REPO } new_fleet_repo_init() { python -m integration \ - gitea create_repo \ - $GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_PASSWORD \ - $GITEA_HOSTEA_EMAIL \ - $GITEA_URL \ + forgejo create_repo \ + $FORGEJO_HOSTEA_USERNAME $FORGEJO_HOSTEA_PASSWORD \ + $FORGEJO_HOSTEA_EMAIL \ + $FORGEJO_URL \ $1 python -m integration \ - gitea add_deploy_key \ - $GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_PASSWORD \ - $GITEA_HOSTEA_EMAIL \ - $GITEA_URL \ + forgejo add_deploy_key \ + $FORGEJO_HOSTEA_USERNAME $FORGEJO_HOSTEA_PASSWORD \ + $FORGEJO_HOSTEA_EMAIL \ + $FORGEJO_URL \ $1 \ - $GITEA_HOSTEA_FLEET_DEPLOY_KEY + $FORGEJO_HOSTEA_FLEET_DEPLOY_KEY tmp_dir=$(mktemp -d) pushd $tmp_dir @@ -144,13 +144,13 @@ new_fleet_repo_init() { then git config user.email "hostea-dashobard-test@example.org" git config user.name "hoste-dashobard-test" - chmod 600 $GITEA_HOSTEA_FLEET_DEPLOY_KEY_PRIVATE + chmod 600 $FORGEJO_HOSTEA_FLEET_DEPLOY_KEY_PRIVATE fi git add README git commit -m "init" - REMOTE="$GITEA_SSH_URL/$GITEA_HOSTEA_USERNAME/$1.git" + REMOTE="$FORGEJO_SSH_URL/$FORGEJO_HOSTEA_USERNAME/$1.git" git remote add origin $REMOTE - GIT_SSH_COMMAND="/usr/bin/ssh -oStrictHostKeyChecking=no -i $GITEA_HOSTEA_FLEET_DEPLOY_KEY_PRIVATE" \ + GIT_SSH_COMMAND="/usr/bin/ssh -oStrictHostKeyChecking=no -i $FORGEJO_HOSTEA_FLEET_DEPLOY_KEY_PRIVATE" \ git push --set-upstream origin master popd rm -rf $tmp_dir @@ -158,20 +158,20 @@ new_fleet_repo_init() { } -# register user "Hostea" on Gitea and create support repository +# register user "Hostea" on Forgejo and create support repository fleet_repo_init() { python -m integration \ - gitea register \ - $GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_PASSWORD \ - $GITEA_HOSTEA_EMAIL \ - $GITEA_URL || true + forgejo register \ + $FORGEJO_HOSTEA_USERNAME $FORGEJO_HOSTEA_PASSWORD \ + $FORGEJO_HOSTEA_EMAIL \ + $FORGEJO_URL || true python -m integration \ - gitea login \ - $GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_PASSWORD \ - $GITEA_HOSTEA_EMAIL \ - $GITEA_URL + forgejo login \ + $FORGEJO_HOSTEA_USERNAME $FORGEJO_HOSTEA_PASSWORD \ + $FORGEJO_HOSTEA_EMAIL \ + $FORGEJO_URL - new_fleet_repo_init $GITEA_HOSTEA_FLEET_REPO + new_fleet_repo_init $FORGEJO_HOSTEA_FLEET_REPO } @@ -192,8 +192,8 @@ hostea_customer_simulation() { $HOSTEA_CUSTOMER_USERNAME $HOSTEA_CUSTOMER_PASSWORD \ $HOSTEA_CUSTOMER_EMAIL \ $DASHBOARD_URL \ - $GITEA_URL \ - $GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_SUPPORT_REPO + $FORGEJO_URL \ + $FORGEJO_HOSTEA_USERNAME $FORGEJO_HOSTEA_SUPPORT_REPO } setup_env() { diff --git a/support/tests.py b/support/tests.py index a71b061..8c76a78 100644 --- a/support/tests.py +++ b/support/tests.py @@ -24,8 +24,8 @@ from .utils import IssueTracker hostea_issue_tracker_settings = settings.HOSTEA hostea_issue_tracker_settings["META"] = { - "GITEA_INSTANCE": "https://gitea.gna.org", - "GITEA_ORG_NAME": "Hostea", + "FORGEJO_INSTANCE": "https://forgejo.gna.org", + "FORGEJO_ORG_NAME": "Hostea", "SUPPORT_REPOSITORY": "support", } @@ -41,8 +41,8 @@ class IssueTrackerTests(TestCase): Verify default credentials; all further tests are based on defaults set """ it = IssueTracker() - self.assertEqual(it.config["GITEA_INSTANCE"], "https://gitea.gna.org") - self.assertEqual(it.config["GITEA_ORG_NAME"], "Hostea") + self.assertEqual(it.config["FORGEJO_INSTANCE"], "https://forgejo.gna.org") + self.assertEqual(it.config["FORGEJO_ORG_NAME"], "Hostea") self.assertEqual(it.config["SUPPORT_REPOSITORY"], "support") def test_uri_builders(self): @@ -51,10 +51,10 @@ class IssueTrackerTests(TestCase): """ it = IssueTracker() self.assertEqual( - it.get_issue_tracker(), "https://gitea.gna.org/Hostea/support/issues" + it.get_issue_tracker(), "https://forgejo.gna.org/Hostea/support/issues" ) self.assertEqual( - it.open_issue(), "https://gitea.gna.org/Hostea/support/issues/new" + it.open_issue(), "https://forgejo.gna.org/Hostea/support/issues/new" ) diff --git a/support/utils.py b/support/utils.py index ada7525..3cb0f38 100644 --- a/support/utils.py +++ b/support/utils.py @@ -24,9 +24,9 @@ class IssueTracker: def __init__(self): self.config = settings.HOSTEA["META"] - self.instance = urlparse(self.config["GITEA_INSTANCE"]) + self.instance = urlparse(self.config["FORGEJO_INSTANCE"]) self.repo = ( - f"{self.config['GITEA_ORG_NAME']}/{self.config['SUPPORT_REPOSITORY']}" + f"{self.config['FORGEJO_ORG_NAME']}/{self.config['SUPPORT_REPOSITORY']}" ) self.issues = f"{self.repo}/issues"