From 3f0294c3449190d2da3b566d46434ef2c78fc049 Mon Sep 17 00:00:00 2001
From: Georg Krause <georg@funkwhale.audio>
Date: Mon, 4 Dec 2023 15:29:26 +0000
Subject: [PATCH] ci: Run tests for latest develop

---
 .gitlab-ci.yml      | 21 ++++++++++++---------
 README.md           |  2 +-
 install.sh          | 13 +++++++------
 tasks/funkwhale.yml |  4 ++--
 4 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 977f999..b1f6dd7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -26,15 +26,10 @@ test-install-script:
   image: $TEST_IMAGE
   parallel:
     matrix:
-      - TEST_IMAGE:
-          [
-            "debian:10",
-            "ubuntu:focal",
-            "ubuntu:jammy",
-            "debian:11",
-            "debian:12",
-          ]
+      - TEST_IMAGE: ["ubuntu:focal", "ubuntu:jammy", "debian:11", "debian:12"]
   interruptible: true
+  variables:
+    FUNKWHALE_CLI_USER_PASSWORD: supersecurepassword
   before_script:
     - apt-get update && apt-get install -y curl
     - |
@@ -50,9 +45,17 @@ test-install-script:
     - |
       set -x
       export ANSIBLE_FUNKWHALE_ROLE_PATH=$(pwd)
-      printf 'test.deployment\ntest\ncontact@test.deployment\nY\nN\n\n\n\N\n\n\n' | bash install.sh
+      printf 'test.deployment\ntest1234\ncontact@test.deployment\nY\nN\n\n\n\N\n\n\n' | bash install.sh
   tags:
     - docker
+
+test-install-script-develop:
+  extends: test-install-script
+  variables:
+    FUNKWHALE_VERSION: develop
+  before_script:
+    - apt-get update && apt-get install -y curl
+
 pages:
   stage: deploy
   image: buildpack-deps
diff --git a/README.md b/README.md
index 7d48a9c..07a8068 100644
--- a/README.md
+++ b/README.md
@@ -95,7 +95,7 @@ _On some hosts, you may need to install the `python-apt` package for check mode
 This command will show you the changes that would be applied to your system. If you are comfortable with them,
 rerun the same command without the `--check` flag.
 
-Once installation is complete, run `/srv/funkwhale/virtualenv/bin/python /srv/funkwhale/api/manage.py createsuperuser` to create your admin account.
+Once installation is complete, run `/srv/funkwhale/virtualenv/bin/funkwhale-manage createsuperuser` to create your admin account.
 
 ## Role Variables
 
diff --git a/install.sh b/install.sh
index 42b3ac8..3cd1fd2 100755
--- a/install.sh
+++ b/install.sh
@@ -334,19 +334,20 @@ configure_server() {
     cat <<EOF >$base_path/manage
 #!/bin/sh
 set -eu
-sudo -u funkwhale -E $base_path/virtualenv/bin/python $base_path/api/manage.py \$@
+sudo -u funkwhale -E $base_path/virtualenv/bin/funkwhale-manage \$@
 EOF
     chmod +x $base_path/manage
     if [ -z "$funkwhale_admin_username" ]; then
         echo "[4/$total_steps] Skipping superuser account creation"
     else
         echo "[4/$total_steps] Creating superuser account…"
-        echo "  Please input the password for the admin account password"
-        LOGLEVEL=error sudo -u funkwhale -E $base_path/virtualenv/bin/python \
-            $base_path/api/manage.py createsuperuser \
+        if [ -z "$FUNKWHALE_CLI_USER_PASSWORD" ]; then
+          echo "  Please input the password for the admin account password"
+        fi
+        LOGLEVEL=error sudo -u funkwhale -E \
+            $base_path/virtualenv/bin/funkwhale-manage fw users create --superuser \
             --email $funkwhale_admin_email \
-            --username $funkwhale_admin_username \
-            -v 0
+            --username $funkwhale_admin_username
     fi
 }
 
diff --git a/tasks/funkwhale.yml b/tasks/funkwhale.yml
index e1210a1..5416550 100644
--- a/tasks/funkwhale.yml
+++ b/tasks/funkwhale.yml
@@ -279,7 +279,7 @@
     block: "{{ funkwhale_custom_settings }}"
 
 - name: "Collect static files"
-  command: "{{ funkwhale_install_path }}/virtualenv/bin/python api/manage.py collectstatic --no-input"
+  command: "{{ funkwhale_install_path }}/virtualenv/bin/funkwhale-manage collectstatic --no-input"
   become: true
   become_user: "{{ funkwhale_username }}"
   args:
@@ -288,6 +288,6 @@
 - name: "Apply database migrations"
   become: true
   become_user: "{{ funkwhale_username }}"
-  command: "{{ funkwhale_install_path }}/virtualenv/bin/python api/manage.py migrate --no-input"
+  command: "{{ funkwhale_install_path }}/virtualenv/bin/funkwhale-manage migrate --no-input"
   args:
     chdir: "{{ funkwhale_install_path }}"
-- 
GitLab