Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 62 additions & 50 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ local openwebui = '0.9.2';
local ollama = '0.14.2';
local nginx = '1.29.3-alpine3.22';
local debian = 'bookworm-slim';
local platforms = {
bookworm: '26.04.9',
buster: '25.02',
};
local platform = '26.04.10';
local dind = '20.10.21-dind';
local playwright = 'v1.59.1-jammy';
local deployer = 'https://github.com/syncloud/store/releases/download/4/syncloud-release';
local python = '3.12-slim-bookworm';
local go = '1.25';
local distro_default = 'bookworm';
local distros = ['bookworm', 'buster'];

local platform_image(distro, arch) =
'syncloud/platform-' + distro + '-' + arch + ':' + platform;

local build(arch, test_ui, dind) = [{
local build(arch, test_ui) = [{
kind: 'pipeline',
type: 'docker',
name: arch,
Expand All @@ -33,68 +33,54 @@ local build(arch, test_ui, dind) = [{
},
{
name: 'ollama',
image: "ollama/ollama:" + ollama,
image: 'ollama/ollama:' + ollama,
commands: [
'./ollama/build.sh',
],
},
] + [
{
name: 'ollama test',
image: 'syncloud/platform-' + distro_default + '-' + arch + ':' + platforms[distro_default],
name: 'ollama test ' + distro,
image: platform_image(distro, arch),
commands: [
'./ollama/test.sh',
],
},
{
name: 'ollama test buster',
image: 'syncloud/platform-buster-' + arch + ':' + platforms.buster,
commands: [
'./ollama/test.sh',
],
},
}
for distro in distros
] + [
{
name: 'openwebui',
image: "ghcr.io/open-webui/open-webui:" + openwebui,
image: 'ghcr.io/open-webui/open-webui:' + openwebui,
commands: [
'./openwebui/build.sh',
],
},
] + [
{
name: 'openwebui test',
image: 'syncloud/platform-' + distro_default + '-' + arch + ':' + platforms[distro_default],
name: 'openwebui test ' + distro,
image: platform_image(distro, arch),
commands: [
'./openwebui/test.sh',
],
}
for distro in distros
] + [
{
name: 'cli',
image: 'golang:' + go,
commands: [
'./cli/build.sh',
],
},
{
name: 'openwebui test buster',
image: 'syncloud/platform-buster-' + arch + ':' + platforms.buster,
name: 'package',
image: 'debian:' + debian,
commands: [
'./openwebui/test.sh',
'VERSION=$(cat version)',
'./package.sh ' + name + ' $VERSION ',
],
},

{
name: 'cli',
image: 'golang:' + go,
commands: [
'cd cli',
'CGO_ENABLED=0 go build -o ../build/snap/meta/hooks/install ./cmd/install',
'CGO_ENABLED=0 go build -o ../build/snap/meta/hooks/configure ./cmd/configure',
'CGO_ENABLED=0 go build -o ../build/snap/meta/hooks/pre-refresh ./cmd/pre-refresh',
'CGO_ENABLED=0 go build -o ../build/snap/meta/hooks/post-refresh ./cmd/post-refresh',
'CGO_ENABLED=0 go build -o ../build/snap/bin/cli ./cmd/cli',
],
},
{
name: 'package',
image: 'debian:' + debian,
commands: [
'VERSION=$(cat version)',
'./package.sh ' + name + ' $VERSION ',
],
},
] + [
] + [
{
name: 'test ' + distro,
image: 'python:' + python,
Expand All @@ -115,15 +101,41 @@ local build(arch, test_ui, dind) = [{
],
},
{
name: 'test-upgrade',
name: 'test-upgrade-install-old',
image: 'python:' + python,
commands: [
'cd test',
'./deps.sh',
'py.test -x -s upgrade.py --distro=' + distro_default + ' --ver=$DRONE_BUILD_NUMBER --app=' + name,
'py.test -x -s upgrade.py -k "test_start or test_install_old" --distro=' + distro_default + ' --ver=$DRONE_BUILD_NUMBER --app=' + name,
],
privileged: true,
},
{
name: 'test-ui-on-old',
image: 'mcr.microsoft.com/playwright:' + playwright,
environment: { DEVICE_USER: 'user', DEVICE_PASSWORD: 'Password1' },
commands: [
'./ci/ui.sh desktop ' + name + ' ' + distro_default + ' $DRONE_BUILD_NUMBER on-old admin-login.spec.ts',
],
},
{
name: 'test-upgrade-refresh-new',
image: 'python:' + python,
commands: [
'cd test',
'./deps.sh',
'py.test -x -s upgrade.py -k "test_start or test_refresh_to_new" --distro=' + distro_default + ' --ver=$DRONE_BUILD_NUMBER --app=' + name,
],
privileged: true,
},
{
name: 'test-ui-after-upgrade',
image: 'mcr.microsoft.com/playwright:' + playwright,
environment: { DEVICE_USER: 'user', DEVICE_PASSWORD: 'Password1' },
commands: [
'./ci/ui.sh desktop ' + name + ' ' + distro_default + ' $DRONE_BUILD_NUMBER after-upgrade no-email-login.spec.ts',
],
},
] else []) + [
{
name: 'upload',
Expand Down Expand Up @@ -202,7 +214,6 @@ local build(arch, test_ui, dind) = [{
trigger: {
event: [
'push',
'pull_request',
],
},
services: [
Expand All @@ -220,8 +231,9 @@ local build(arch, test_ui, dind) = [{
] + [
{
name: name + '.' + distro + '.com',
image: 'syncloud/platform-' + distro + '-' + arch + ':' + platforms[distro],
image: platform_image(distro, arch),
privileged: true,
entrypoint: ['/bin/sh', '-c', "mkdir -p /etc/systemd/system/snapd.service.d && printf '[Service]\\nExecStartPost=/bin/sh -c \"/usr/bin/snap set system refresh.hold=2099-01-01T00:00:00Z\"\\n' > /etc/systemd/system/snapd.service.d/disable-refresh.conf && exec /sbin/init"],
volumes: [
{
name: 'dbus',
Expand Down Expand Up @@ -256,5 +268,5 @@ local build(arch, test_ui, dind) = [{
},
];

build('amd64', true, '20.10.21-dind') +
build('arm64', false, '20.10.21-dind')
build('amd64', true) +
build('arm64', false)
6 changes: 4 additions & 2 deletions ci/ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ PROJECT=$1
APP=$2
DISTRO=$3
VERSION=$4
TAG=${5:-}
SPEC=${6:-}

getent hosts ${APP}.${DISTRO}.com | sed "s/${APP}.${DISTRO}.com/auth.${DISTRO}.com/g" | tee -a /etc/hosts

ART=/drone/src/artifact/${PROJECT}
ART=/drone/src/artifact/${PROJECT}${TAG:+-${TAG}}
mkdir -p "$ART"
trap 'cp -r /drone/src/web/test-results "$ART/" 2>/dev/null; cp -r /drone/src/web/playwright-report "$ART/" 2>/dev/null; chmod -R a+r "$ART" 2>/dev/null; exit' EXIT INT TERM

Expand All @@ -18,4 +20,4 @@ PLAYWRIGHT_APP=${APP} \
PLAYWRIGHT_VERSION=${VERSION} \
NO_EMAIL_USER=noemail \
NO_EMAIL_PASSWORD=Password1 \
npx playwright test --project=${PROJECT}
npx playwright test --project=${PROJECT} ${SPEC}
11 changes: 11 additions & 0 deletions cli/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -ex

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd ${DIR}
BUILD_DIR=${DIR}/../build/snap

CGO_ENABLED=0 go build -o ${BUILD_DIR}/meta/hooks/install ./cmd/install
CGO_ENABLED=0 go build -o ${BUILD_DIR}/meta/hooks/configure ./cmd/configure
CGO_ENABLED=0 go build -o ${BUILD_DIR}/meta/hooks/pre-refresh ./cmd/pre-refresh
CGO_ENABLED=0 go build -o ${BUILD_DIR}/meta/hooks/post-refresh ./cmd/post-refresh
CGO_ENABLED=0 go build -o ${BUILD_DIR}/bin/cli ./cmd/cli
18 changes: 15 additions & 3 deletions test/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,21 @@ def test_start(module_setup, app, device_host, domain, device):
device.run_ssh('mkdir {0}'.format(TMP_DIR), throw=False)


def test_upgrade(device, device_user, device_password, device_host, app_archive_path, app_domain, app_dir):
device.run_ssh('snap remove openwebui')
device.run_ssh('snap install openwebui', retries=10)
OLD_REV = '121'


def test_install_old(device, app_domain):
device.run_ssh('snap remove openwebui', throw=False)
device.run_ssh(
'curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors '
'-o /tmp/openwebui_old.snap '
'http://apps.syncloud.org/apps/openwebui_{rev}_amd64.snap'.format(rev=OLD_REV),
)
device.run_ssh('snap install --dangerous /tmp/openwebui_old.snap')
wait_for_rest(requests.session(), "https://{0}".format(app_domain), 200, 100)


def test_refresh_to_new(device, device_host, device_password, app_archive_path, app_domain):
local_install(device_host, device_password, app_archive_path)
wait_for_rest(requests.session(), "https://{0}".format(app_domain), 200, 100)

Expand Down
File renamed without changes.