mirror of
https://git.cloudron.io/cloudron/gitea-app
synced 2026-05-01 06:53:37 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 433327e0d6 | |||
| d7d7449180 | |||
| a3cb866a4e | |||
| d0fa4c2158 | |||
| 33d67d5238 | |||
| 0b6a50cbfe | |||
| 08eac4fde1 | |||
| f948552d45 | |||
| 3317e2f0e6 | |||
| 5055ade625 | |||
| 6e29723b52 | |||
| 14f1ea39ee | |||
| 3e9b16ce1d | |||
| d37d644518 | |||
| 44e8309a95 | |||
| 94bf230a5a | |||
| ff2f9a9202 | |||
| d593d25291 |
@@ -1952,3 +1952,45 @@
|
|||||||
* BUGFIXES Fix SVG size calulation, only use `style` attribute ([#​36133](https://github.com/go-gitea/gitea/issues/36133)) ([#​36134](https://github.com/go-gitea/gitea/issues/36134))
|
* BUGFIXES Fix SVG size calulation, only use `style` attribute ([#​36133](https://github.com/go-gitea/gitea/issues/36133)) ([#​36134](https://github.com/go-gitea/gitea/issues/36134))
|
||||||
* BUGFIXES Make Golang correctly delete temp files during uploading ([#​36128](https://github.com/go-gitea/gitea/issues/36128)) ([#​36129](https://github.com/go-gitea/gitea/issues/36129))
|
* BUGFIXES Make Golang correctly delete temp files during uploading ([#​36128](https://github.com/go-gitea/gitea/issues/36128)) ([#​36129](https://github.com/go-gitea/gitea/issues/36129))
|
||||||
|
|
||||||
|
[1.37.4]
|
||||||
|
* Update gitea to 1.25.4
|
||||||
|
* [Full Changelog](https://github.com/go-gitea/gitea/releases/tag/v1.25.4)
|
||||||
|
* Release attachments must belong to the intended repo ([#36347](https://github.com/go-gitea/gitea/issues/36347)) ([#36375](https://github.com/go-gitea/gitea/issues/36375))
|
||||||
|
* Fix permission check on org project operations ([#36318](https://github.com/go-gitea/gitea/issues/36318)) ([#36373](https://github.com/go-gitea/gitea/issues/36373))
|
||||||
|
* Clean watches when make a repository private and check permission when send release emails ([#36319](https://github.com/go-gitea/gitea/issues/36319)) ([#36370](https://github.com/go-gitea/gitea/issues/36370))
|
||||||
|
* Add more check for stopwatch read or list ([#36340](https://github.com/go-gitea/gitea/issues/36340)) ([#36368](https://github.com/go-gitea/gitea/issues/36368))
|
||||||
|
* Fix openid setting check ([#36346](https://github.com/go-gitea/gitea/issues/36346)) ([#36361](https://github.com/go-gitea/gitea/issues/36361))
|
||||||
|
* Fix cancel auto merge bug ([#36341](https://github.com/go-gitea/gitea/issues/36341)) ([#36356](https://github.com/go-gitea/gitea/issues/36356))
|
||||||
|
* Fix delete attachment check ([#36320](https://github.com/go-gitea/gitea/issues/36320)) ([#36355](https://github.com/go-gitea/gitea/issues/36355))
|
||||||
|
* LFS locks must belong to the intended repo ([#36344](https://github.com/go-gitea/gitea/issues/36344)) ([#36349](https://github.com/go-gitea/gitea/issues/36349))
|
||||||
|
* Fix bug on notification read ([#36339](https://github.com/go-gitea/gitea/issues/36339)) [#36387](https://github.com/go-gitea/gitea/issues/36387)
|
||||||
|
* Add more routes to the "expensive" list ([#36290](https://github.com/go-gitea/gitea/issues/36290))
|
||||||
|
|
||||||
|
[1.37.5]
|
||||||
|
* Update gitea to 1.25.5
|
||||||
|
* [Full Changelog](https://github.com/go-gitea/gitea/releases/tag/v1.25.5)
|
||||||
|
* Make `security-check` informational only
|
||||||
|
* Upgrade to github.com/cloudflare/circl 1.6.3, svgo 4.0.1, markdownlint-cli 0.48.0
|
||||||
|
* Add some validation on values provided to USER_DISABLED_FEATURES and EXTERNAL_USER_DISABLED_FEATURES
|
||||||
|
* Upgrade gogit to 5.16.5
|
||||||
|
* Add wrap to runner label list
|
||||||
|
* Add dnf5 command for Fedora in RPM package instructions
|
||||||
|
* Allow scroll propagation outside code editor
|
||||||
|
* Fix non-admins unable to automerge MRs from forks
|
||||||
|
* Fix bug when pushing mirror with wiki
|
||||||
|
* Fix artifacts v4 backend upload problems
|
||||||
|
|
||||||
|
[1.38.0]
|
||||||
|
* Update gitea to 1.26.0
|
||||||
|
* [Full Changelog](https://github.com/go-gitea/gitea/releases/tag/v1.26.0)
|
||||||
|
* Correct swagger annotations for enums, status codes, and notification state ([#37030](https://github.com/go-gitea/gitea/issues/37030))
|
||||||
|
* Remove GET API registration-token ([#36801](https://github.com/go-gitea/gitea/issues/36801))
|
||||||
|
* Support Actions `concurrency` syntax ([#32751](https://github.com/go-gitea/gitea/issues/32751))
|
||||||
|
* Make PUBLIC_URL_DETECTION default to "auto" ([#36955](https://github.com/go-gitea/gitea/issues/36955))
|
||||||
|
* Add terraform state registry ([#36710](https://github.com/go-gitea/gitea/issues/36710))
|
||||||
|
* Instance-wide (global) info banner and maintenance mode ([#36571](https://github.com/go-gitea/gitea/issues/36571))
|
||||||
|
* Support rendering OpenAPI spec ([#36449](https://github.com/go-gitea/gitea/issues/36449))
|
||||||
|
* Add keyboard shortcuts for repository file and code search ([#36416](https://github.com/go-gitea/gitea/issues/36416))
|
||||||
|
* Automatic generation of release notes ([#35977](https://github.com/go-gitea/gitea/issues/35977))
|
||||||
|
* Add button to re-run failed jobs in Actions ([#36924](https://github.com/go-gitea/gitea/issues/36924))
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
"author": "Gitea developers",
|
"author": "Gitea developers",
|
||||||
"description": "file://DESCRIPTION.md",
|
"description": "file://DESCRIPTION.md",
|
||||||
"tagline": "A painless self-hosted Git Service",
|
"tagline": "A painless self-hosted Git Service",
|
||||||
"version": "1.37.3",
|
"version": "1.38.0",
|
||||||
"upstreamVersion": "1.25.3",
|
"upstreamVersion": "1.26.0",
|
||||||
"healthCheckPath": "/explore",
|
"healthCheckPath": "/explore",
|
||||||
"httpPort": 3000,
|
"httpPort": 3000,
|
||||||
"memoryLimit": 536870912,
|
"memoryLimit": 536870912,
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ WORKDIR /home/git
|
|||||||
ENV GNUPGHOME="/app/data/gnupg"
|
ENV GNUPGHOME="/app/data/gnupg"
|
||||||
|
|
||||||
# renovate: datasource=github-releases depName=go-gitea/gitea versioning=semver extractVersion=^v(?<version>.+)$
|
# renovate: datasource=github-releases depName=go-gitea/gitea versioning=semver extractVersion=^v(?<version>.+)$
|
||||||
ARG GITEA_VERSION=1.25.3
|
ARG GITEA_VERSION=1.26.0
|
||||||
|
|
||||||
RUN mkdir -p /home/git/gitea && \
|
RUN mkdir -p /home/git/gitea && \
|
||||||
curl -L https://github.com/go-gitea/gitea/releases/download/v${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64 -o /home/git/gitea/gitea \
|
curl -L https://github.com/go-gitea/gitea/releases/download/v${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64 -o /home/git/gitea/gitea \
|
||||||
|
|||||||
@@ -91,8 +91,6 @@ ROOT_PATH = /run/gitea
|
|||||||
; APP_DATA_PATH/avatars
|
; APP_DATA_PATH/avatars
|
||||||
AVATAR_UPLOAD_PATH =
|
AVATAR_UPLOAD_PATH =
|
||||||
GRAVATAR_SOURCE = gravatar
|
GRAVATAR_SOURCE = gravatar
|
||||||
DISABLE_GRAVATAR = false
|
|
||||||
|
|
||||||
|
|
||||||
[attachment]
|
[attachment]
|
||||||
ENABLE = true
|
ENABLE = true
|
||||||
|
|||||||
@@ -15,17 +15,6 @@ setup_oidc_source() {
|
|||||||
"REPLACE INTO login_source (id, type, name, is_active, cfg, created_unix, updated_unix) VALUES (1,6,'cloudron', 1,'{\"Provider\":\"openidConnect\",\"ClientID\":\"${CLOUDRON_OIDC_CLIENT_ID}\",\"ClientSecret\":\"${CLOUDRON_OIDC_CLIENT_SECRET}\",\"OpenIDConnectAutoDiscoveryURL\":\"${CLOUDRON_OIDC_ISSUER}/.well-known/openid-configuration\",\"CustomURLMapping\":null,\"IconURL\":\"\",\"Scopes\":[\"openid email profile\"],\"RequiredClaimName\":\"\",\"RequiredClaimValue\":\"\",\"GroupClaimName\":\"\",\"AdminGroup\":\"\",\"GroupTeamMap\":\"\",\"GroupTeamMapRemoval\":false,\"RestrictedGroup\":\"\"}','${now}','${now}')"
|
"REPLACE INTO login_source (id, type, name, is_active, cfg, created_unix, updated_unix) VALUES (1,6,'cloudron', 1,'{\"Provider\":\"openidConnect\",\"ClientID\":\"${CLOUDRON_OIDC_CLIENT_ID}\",\"ClientSecret\":\"${CLOUDRON_OIDC_CLIENT_SECRET}\",\"OpenIDConnectAutoDiscoveryURL\":\"${CLOUDRON_OIDC_ISSUER}/.well-known/openid-configuration\",\"CustomURLMapping\":null,\"IconURL\":\"\",\"Scopes\":[\"openid email profile\"],\"RequiredClaimName\":\"\",\"RequiredClaimValue\":\"\",\"GroupClaimName\":\"\",\"AdminGroup\":\"\",\"GroupTeamMap\":\"\",\"GroupTeamMapRemoval\":false,\"RestrictedGroup\":\"\"}','${now}','${now}')"
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_root_user() {
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
if sudo -H -u git /home/git/gitea/gitea admin user create --username root --password changeme --email admin@cloudron.local --admin -c /run/gitea/app.ini; then
|
|
||||||
echo "==> root user added"
|
|
||||||
else
|
|
||||||
echo "==> Failed to add root user"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_auth() {
|
setup_auth() {
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
@@ -45,7 +34,12 @@ setup_auth() {
|
|||||||
# be careful, not to create root user for existing LDAP based installs
|
# be careful, not to create root user for existing LDAP based installs
|
||||||
if [[ "${user_count}" == "0" ]]; then
|
if [[ "${user_count}" == "0" ]]; then
|
||||||
echo "==> Setting up root user for first run"
|
echo "==> Setting up root user for first run"
|
||||||
setup_root_user
|
if sudo -H -u git /home/git/gitea/gitea admin user create --username root --password changeme --email admin@cloudron.local --admin -c /run/gitea/app.ini; then
|
||||||
|
echo "==> root user added"
|
||||||
|
else
|
||||||
|
echo "==> Failed to add root user"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +118,12 @@ echo "==> Creating dirs and changing permissions"
|
|||||||
mkdir -p /app/data/repository /app/data/ssh /app/data/custom /app/data/gnupg
|
mkdir -p /app/data/repository /app/data/ssh /app/data/custom /app/data/gnupg
|
||||||
chown -R git:git /app/data /run/gitea
|
chown -R git:git /app/data /run/gitea
|
||||||
|
|
||||||
# this expects app.ini to be available
|
# OIDC creds are read from the db at gitea startup, so if migrations have already
|
||||||
( setup_auth ) &
|
# run (i.e. the user table exists), refresh the OIDC source synchronously now.
|
||||||
|
if mysql -u"${CLOUDRON_MYSQL_USERNAME}" -p"${CLOUDRON_MYSQL_PASSWORD}" -h"${CLOUDRON_MYSQL_HOST}" -P"${CLOUDRON_MYSQL_PORT}" --database="${CLOUDRON_MYSQL_DATABASE}" -N -B -e "SELECT count(*) FROM user" >/dev/null 2>&1; then
|
||||||
|
[[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]] && setup_oidc_source
|
||||||
|
else
|
||||||
|
( setup_auth ) &
|
||||||
|
fi
|
||||||
|
|
||||||
exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i Gitea
|
exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i Gitea
|
||||||
|
|||||||
Generated
-3536
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "test",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "test.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"author": "",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"chromedriver": "^143.0.3",
|
|
||||||
"expect.js": "^0.3.1",
|
|
||||||
"mocha": "^11.7.5",
|
|
||||||
"selenium-webdriver": "^4.39.0",
|
|
||||||
"superagent": "^10.2.3"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+125
-192
@@ -1,214 +1,148 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
/* jshint esversion: 8 */
|
import assert from 'node:assert/strict';
|
||||||
/* global it, xit, describe, before, after, afterEach */
|
import { execSync } from 'node:child_process';
|
||||||
|
import fs from 'node:fs';
|
||||||
|
import path from 'node:path';
|
||||||
|
import superagent from '@cloudron/superagent';
|
||||||
|
import {
|
||||||
|
app,
|
||||||
|
clearCache,
|
||||||
|
click,
|
||||||
|
cloudronCli,
|
||||||
|
executeScript,
|
||||||
|
goto,
|
||||||
|
loginOIDC,
|
||||||
|
sendKeys,
|
||||||
|
setInputFiles,
|
||||||
|
setupBrowser,
|
||||||
|
takeScreenshot,
|
||||||
|
teardownBrowser,
|
||||||
|
username,
|
||||||
|
waitForElement,
|
||||||
|
waitForPath
|
||||||
|
} from '@cloudron/charlie';
|
||||||
|
|
||||||
'use strict';
|
/* global it, describe, before, after, afterEach */
|
||||||
|
|
||||||
require('chromedriver');
|
const SSH_PORT = 29420;
|
||||||
|
const INSTALL_TCP_FLAGS = { SSH_PORT };
|
||||||
const execSync = require('child_process').execSync,
|
const repodir = '/tmp/testrepo';
|
||||||
expect = require('expect.js'),
|
const reponame = 'testrepo';
|
||||||
fs = require('fs'),
|
|
||||||
path = require('path'),
|
|
||||||
superagent = require('superagent'),
|
|
||||||
{ Builder, By, until } = require('selenium-webdriver'),
|
|
||||||
{ Options } = require('selenium-webdriver/chrome');
|
|
||||||
|
|
||||||
if (!process.env.USERNAME || !process.env.PASSWORD || !process.env.EMAIL) {
|
|
||||||
console.log('USERNAME, PASSWORD and EMAIL env vars need to be set');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('Application life cycle test', function () {
|
describe('Application life cycle test', function () {
|
||||||
this.timeout(0);
|
before(setupBrowser);
|
||||||
|
after(async function () {
|
||||||
const TIMEOUT = parseInt(process.env.TIMEOUT, 10) || 5000;
|
await teardownBrowser();
|
||||||
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
|
|
||||||
const LOCATION = process.env.LOCATION || 'test';
|
|
||||||
const SSH_PORT = 29420;
|
|
||||||
|
|
||||||
let app, browser;
|
|
||||||
|
|
||||||
const repodir = '/tmp/testrepo';
|
|
||||||
const reponame = 'testrepo';
|
|
||||||
|
|
||||||
const username = process.env.USERNAME;
|
|
||||||
const password = process.env.PASSWORD;
|
|
||||||
|
|
||||||
before(function () {
|
|
||||||
const chromeOptions = new Options().windowSize({ width: 1280, height: 1024 });
|
|
||||||
if (process.env.CI) chromeOptions.addArguments('no-sandbox', 'disable-dev-shm-usage', 'headless');
|
|
||||||
browser = new Builder().forBrowser('chrome').setChromeOptions(chromeOptions).build();
|
|
||||||
if (!fs.existsSync('./screenshots')) fs.mkdirSync('./screenshots');
|
|
||||||
});
|
|
||||||
|
|
||||||
after(function () {
|
|
||||||
browser.quit();
|
|
||||||
fs.rmSync(repodir, { recursive: true, force: true });
|
fs.rmSync(repodir, { recursive: true, force: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
if (!process.env.CI || !app) return;
|
await takeScreenshot(this.currentTest.title);
|
||||||
|
|
||||||
const currentUrl = await browser.getCurrentUrl();
|
|
||||||
if (!currentUrl.includes(app.domain)) return;
|
|
||||||
expect(this.currentTest.title).to.be.a('string');
|
|
||||||
|
|
||||||
const screenshotData = await browser.takeScreenshot();
|
|
||||||
fs.writeFileSync(`./screenshots/${new Date().getTime()}-${this.currentTest.title.replaceAll(' ', '_')}.png`, screenshotData, 'base64');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function getAppInfo() {
|
|
||||||
const inspect = JSON.parse(execSync('cloudron inspect'));
|
|
||||||
app = inspect.apps.filter(function (a) { return a.location.indexOf(LOCATION) === 0; })[0];
|
|
||||||
expect(app).to.be.an('object');
|
|
||||||
}
|
|
||||||
|
|
||||||
async function waitForElement(elem) {
|
|
||||||
await browser.wait(until.elementLocated(elem), TIMEOUT);
|
|
||||||
await browser.wait(until.elementIsVisible(browser.findElement(elem)), TIMEOUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sleep(millis) {
|
|
||||||
return new Promise(resolve => setTimeout(resolve, millis));
|
|
||||||
}
|
|
||||||
|
|
||||||
async function setAvatar() {
|
async function setAvatar() {
|
||||||
await browser.get('https://' + app.fqdn + '/user/settings');
|
await goto(`https://${app.fqdn}/user/settings`, '//label[contains(text(), "Use Custom Avatar")]');
|
||||||
|
await click('//label[contains(text(), "Use Custom Avatar")]');
|
||||||
var button = await browser.findElement(By.xpath('//label[contains(text(), "Use Custom Avatar")]'));
|
await setInputFiles('//input[@type="file" and @name="avatar"]', path.resolve(import.meta.dirname, '../logo.png'));
|
||||||
await browser.executeScript('arguments[0].scrollIntoView(false)', button);
|
await click('//button[contains(text(), "Update Avatar")]');
|
||||||
await browser.findElement(By.xpath('//label[contains(text(), "Use Custom Avatar")]')).click();
|
await waitForElement('//p[contains(text(),"Your avatar has been updated.")]');
|
||||||
await browser.findElement(By.xpath('//input[@type="file" and @name="avatar"]')).sendKeys(path.resolve(__dirname, '../logo.png'));
|
|
||||||
await browser.findElement(By.xpath('//button[contains(text(), "Update Avatar")]')).click();
|
|
||||||
await browser.wait(until.elementLocated(By.xpath('//p[contains(text(),"Your avatar has been updated.")]')), TIMEOUT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkAvatar() {
|
async function checkAvatar() {
|
||||||
await browser.get(`https://${app.fqdn}/${username}`);
|
await goto(`https://${app.fqdn}/${username}`, '//div[@id="profile-avatar"]/a/img');
|
||||||
|
const avatarSrc = await executeScript(() => {
|
||||||
const avatarSrc = await browser.findElement(By.xpath('//div[@id="profile-avatar"]/a/img')).getAttribute('src');
|
const el = document.querySelector('#profile-avatar a img');
|
||||||
|
return el ? el.getAttribute('src') : null;
|
||||||
const response = await superagent.get(avatarSrc);
|
});
|
||||||
expect(response.statusCode).to.equal(200);
|
assert.ok(avatarSrc);
|
||||||
|
const avatarUrl = new URL(avatarSrc, `https://${app.fqdn}`).href;
|
||||||
|
const response = await superagent.get(avatarUrl);
|
||||||
|
assert.strictEqual(response.status, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function login(username, password) {
|
async function login(user, passwd) {
|
||||||
await browser.get('https://' + app.fqdn + '/user/login');
|
await goto(`https://${app.fqdn}/user/login`, '#user_name');
|
||||||
|
await sendKeys('#user_name', user);
|
||||||
await browser.findElement(By.id('user_name')).sendKeys(username);
|
await sendKeys('#password', passwd);
|
||||||
await browser.findElement(By.id('password')).sendKeys(password);
|
await click('//form[@action="/user/login"]//button');
|
||||||
await browser.findElement(By.xpath('//form[@action="/user/login"]//button')).click();
|
await waitForElement('//nav//img[contains(@class, "avatar")]');
|
||||||
await browser.wait(until.elementLocated(By.xpath('//img[contains(@class, "avatar")]')), TIMEOUT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function adminLogin() {
|
async function adminLogin() {
|
||||||
await login('root', 'changeme');
|
await login('root', 'changeme');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loginOIDC(username, password, alreadyAuthenticated = true) {
|
async function loginGiteaOIDC() {
|
||||||
browser.manage().deleteAllCookies();
|
await clearCache();
|
||||||
await browser.get(`https://${app.fqdn}/user/login`);
|
await goto(`https://${app.fqdn}/user/login`, '//a[@href="/user/oauth2/cloudron"]');
|
||||||
await browser.sleep(2000);
|
await click('//a[@href="/user/oauth2/cloudron"]');
|
||||||
|
await loginOIDC('//nav//img[contains(@class, "avatar")]');
|
||||||
|
|
||||||
await browser.findElement(By.xpath('//a[contains(@class, "openidConnect") and contains(., "Sign in with cloudron")]')).click();
|
|
||||||
await browser.sleep(2000);
|
|
||||||
|
|
||||||
if (!alreadyAuthenticated) {
|
|
||||||
await waitForElement(By.id('inputUsername'));
|
|
||||||
await browser.findElement(By.id('inputUsername')).sendKeys(username);
|
|
||||||
await browser.findElement(By.id('inputPassword')).sendKeys(password);
|
|
||||||
await browser.sleep(2000);
|
|
||||||
await browser.findElement(By.id('loginSubmitButton')).click();
|
|
||||||
await browser.sleep(2000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await waitForElement(By.xpath('//img[contains(@class, "avatar")]'));
|
async function loginGiteaOIDCOld() {
|
||||||
|
await clearCache();
|
||||||
|
await goto(`https://${app.fqdn}/user/login`, '//a[contains(@class, "openidConnect")]');
|
||||||
|
await click('//a[contains(@class, "openidConnect") and contains(., "Sign in with cloudron")]');
|
||||||
|
await loginOIDC('//nav//img[contains(@class, "avatar")]');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function logout() {
|
async function logout() {
|
||||||
await browser.get('https://' + app.fqdn);
|
await goto(`https://${app.fqdn}`, '//nav//img[contains(@class, "avatar")]');
|
||||||
|
await click('//nav//img[contains(@class, "avatar")]');
|
||||||
await browser.findElement(By.xpath('//img[contains(@class, "avatar")]')).click();
|
await waitForElement('//a[@href="/user/logout"]');
|
||||||
await sleep(2000);
|
await click('//a[@href="/user/logout"]');
|
||||||
await browser.findElement(By.xpath('//a[@data-url="/user/logout"]')).click();
|
|
||||||
await sleep(2000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addPublicKey() {
|
async function addPublicKey() {
|
||||||
const publicKey = fs.readFileSync(__dirname + '/id_ed25519.pub', 'utf8');
|
const keyPath = path.join(import.meta.dirname, 'id_ed25519');
|
||||||
execSync(`chmod g-rw,o-rw ${__dirname}/id_ed25519`); // ssh will complain about perms later
|
fs.chmodSync(keyPath, 0o600);
|
||||||
|
|
||||||
await browser.get('https://' + app.fqdn + '/user/settings/keys');
|
await goto(`https://${app.fqdn}/user/settings/keys`, '#add-ssh-button');
|
||||||
|
await click('#add-ssh-button');
|
||||||
await browser.wait(until.elementLocated(By.id('add-ssh-button')), TIMEOUT);
|
await sendKeys('#ssh-key-title', 'testkey');
|
||||||
await browser.findElement(By.id('add-ssh-button')).click();
|
await sendKeys('#ssh-key-content', fs.readFileSync(`${import.meta.dirname}/id_ed25519.pub`, 'utf8').trim());
|
||||||
await browser.findElement(By.id('ssh-key-title')).sendKeys('testkey');
|
await click('//form//button[contains(text(),"Add Key")]');
|
||||||
await browser.findElement(By.id('ssh-key-content')).sendKeys(publicKey.trim()); // #3480
|
await waitForElement('//p[contains(text(), "has been added.")]');
|
||||||
var button = browser.findElement(By.xpath('//button[contains(text(), "Add Key")]'));
|
|
||||||
await browser.executeScript('arguments[0].scrollIntoView(false)', button);
|
|
||||||
await browser.findElement(By.xpath('//form//button[contains(text(),"Add Key")]')).click();
|
|
||||||
|
|
||||||
await browser.wait(until.elementLocated(By.xpath('//p[contains(text(), "has been added.")]')), TIMEOUT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createRepo() {
|
async function createRepo() {
|
||||||
await browser.get(`https://${app.fqdn}/repo/create`);
|
await goto(`https://${app.fqdn}/repo/create`, '#repo_name');
|
||||||
await browser.wait(until.elementLocated(By.id('repo_name')));
|
await sendKeys('#repo_name', reponame);
|
||||||
await browser.findElement(By.id('repo_name')).sendKeys(reponame);
|
await click('#auto-init');
|
||||||
var button = browser.findElement(By.xpath('//button[contains(text(), "Create Repository")]'));
|
await click('//button[contains(text(), "Create Repository")]');
|
||||||
await browser.executeScript('arguments[0].scrollIntoView(true)', button);
|
await waitForPath(`/${username}/${reponame}`);
|
||||||
await browser.findElement(By.id('auto-init')).click();
|
|
||||||
await browser.findElement(By.xpath('//button[contains(text(), "Create Repository")]')).click();
|
|
||||||
|
|
||||||
await browser.wait(function () {
|
|
||||||
return browser.getCurrentUrl().then(function (url) {
|
|
||||||
return url === 'https://' + app.fqdn + '/' + username + '/' + reponame;
|
|
||||||
});
|
|
||||||
}, TIMEOUT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cloneRepo() {
|
function cloneRepo() {
|
||||||
fs.rmSync(repodir, { recursive: true, force: true });
|
fs.rmSync(repodir, { recursive: true, force: true });
|
||||||
var env = Object.create(process.env);
|
const env = Object.create(process.env);
|
||||||
env.GIT_SSH = __dirname + '/git_ssh_wrapper.sh';
|
env.GIT_SSH = path.join(import.meta.dirname, 'git_ssh_wrapper.sh');
|
||||||
execSync(`git clone ssh://git@${app.fqdn}:${SSH_PORT}/${username}/${reponame}.git ${repodir}`, { env: env });
|
execSync(`git clone ssh://git@${app.fqdn}:${SSH_PORT}/${username}/${reponame}.git ${repodir}`, { env });
|
||||||
}
|
}
|
||||||
|
|
||||||
function pushFile() {
|
function pushFile() {
|
||||||
const env = Object.create(process.env);
|
const env = Object.create(process.env);
|
||||||
env.GIT_SSH = __dirname + '/git_ssh_wrapper.sh';
|
env.GIT_SSH = path.join(import.meta.dirname, 'git_ssh_wrapper.sh');
|
||||||
execSync(`touch newfile && git add newfile && git commit -a -mx && git push ssh://git@${app.fqdn}:${SSH_PORT}/${username}/${reponame} main`,
|
execSync(
|
||||||
{ env: env, cwd: repodir });
|
`touch newfile && git add newfile && git commit -a -mx && git push ssh://git@${app.fqdn}:${SSH_PORT}/${username}/${reponame} main`,
|
||||||
|
{ env, cwd: repodir }
|
||||||
|
);
|
||||||
fs.rmSync(repodir, { recursive: true, force: true });
|
fs.rmSync(repodir, { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
function fileExists() {
|
function fileExists() {
|
||||||
expect(fs.existsSync(repodir + '/newfile')).to.be(true);
|
assert.strictEqual(fs.existsSync(`${repodir}/newfile`), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendMail() {
|
it('install app', function () {
|
||||||
await browser.get(`https://${app.fqdn}/-/admin/config`);
|
cloudronCli.install({ tcpPortFlags: INSTALL_TCP_FLAGS });
|
||||||
await browser.sleep(3000);
|
});
|
||||||
const button = await browser.findElement(By.xpath('//button[contains(., "Send")]'));
|
|
||||||
await browser.executeScript('arguments[0].scrollIntoView(true)', button);
|
|
||||||
await browser.findElement(By.xpath('//input[@name="email"]')).sendKeys('test@cloudron.io');
|
|
||||||
await browser.findElement(By.xpath('//button[contains(., "Send")]')).click();
|
|
||||||
await browser.wait(until.elementLocated(By.xpath('//p[contains(., "A testing email has been sent")]')), TIMEOUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
|
|
||||||
it('install app', function () { execSync(`cloudron install --location ${LOCATION} -p SSH_PORT=${SSH_PORT}`, EXEC_ARGS); });
|
|
||||||
|
|
||||||
it('can get app information', getAppInfo);
|
|
||||||
|
|
||||||
it('can admin login', adminLogin);
|
it('can admin login', adminLogin);
|
||||||
it('can send mail', sendMail);
|
|
||||||
it('can logout', logout);
|
it('can logout', logout);
|
||||||
|
|
||||||
it('can login', loginOIDC.bind(null, username, password, false));
|
it('can login', loginGiteaOIDC);
|
||||||
it('can set avatar', setAvatar);
|
it('can set avatar', setAvatar);
|
||||||
it('can get avatar', checkAvatar);
|
it('can get avatar', checkAvatar);
|
||||||
|
|
||||||
@@ -220,57 +154,58 @@ describe('Application life cycle test', function () {
|
|||||||
|
|
||||||
it('can add and push a file', pushFile);
|
it('can add and push a file', pushFile);
|
||||||
|
|
||||||
it('can restart app', function () { execSync('cloudron restart --app ' + app.id); });
|
it('can restart app', function () {
|
||||||
|
cloudronCli.restart();
|
||||||
|
});
|
||||||
|
|
||||||
xit('can login', loginOIDC.bind(null, username, password)); // no need to relogin since session persists
|
|
||||||
it('can clone the url', cloneRepo);
|
it('can clone the url', cloneRepo);
|
||||||
it('file exists in repo', fileExists);
|
it('file exists in repo', fileExists);
|
||||||
|
|
||||||
it('backup app', function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); });
|
it('backup app', async function () {
|
||||||
it('restore app', function () { execSync('cloudron restore --app ' + app.id, EXEC_ARGS); });
|
await cloudronCli.createBackup();
|
||||||
|
});
|
||||||
|
it('restore app', async function () {
|
||||||
|
await cloudronCli.restoreFromLatestBackup();
|
||||||
|
});
|
||||||
|
|
||||||
it('can login', loginOIDC.bind(null, username, password));
|
it('can login', loginGiteaOIDC);
|
||||||
it('can get avatar', checkAvatar);
|
it('can get avatar', checkAvatar);
|
||||||
it('can clone the url', cloneRepo);
|
it('can clone the url', cloneRepo);
|
||||||
it('file exists in repo', function () { expect(fs.existsSync(repodir + '/newfile')).to.be(true); });
|
it('file exists in repo', function () {
|
||||||
|
assert.strictEqual(fs.existsSync(`${repodir}/newfile`), true);
|
||||||
|
});
|
||||||
|
|
||||||
it('move to different location', async function () {
|
it('move to different location', async function () {
|
||||||
//browser.manage().deleteAllCookies(); // commented because of error "'Network.deleteCookie' wasn't found"
|
await cloudronCli.changeLocation();
|
||||||
// ensure we don't hit NXDOMAIN in the mean time
|
|
||||||
await browser.get('about:blank');
|
|
||||||
|
|
||||||
execSync('cloudron configure --location ' + LOCATION + '2 --app ' + app.id, EXEC_ARGS);
|
|
||||||
});
|
});
|
||||||
it('can get app information', getAppInfo);
|
|
||||||
|
|
||||||
it('can login', loginOIDC.bind(null, username, password));
|
it('can login', loginGiteaOIDC);
|
||||||
it('can get avatar', checkAvatar);
|
it('can get avatar', checkAvatar);
|
||||||
it('can clone the url', cloneRepo);
|
it('can clone the url', cloneRepo);
|
||||||
it('file exists in repo', function () { expect(fs.existsSync(repodir + '/newfile')).to.be(true); });
|
it('file exists in repo', function () {
|
||||||
|
assert.strictEqual(fs.existsSync(`${repodir}/newfile`), true);
|
||||||
it('uninstall app', async function () {
|
|
||||||
// ensure we don't hit NXDOMAIN in the mean time
|
|
||||||
await browser.get('about:blank');
|
|
||||||
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// No SSO
|
it('uninstall app', async function () {
|
||||||
it('install app (no sso)', function () { execSync(`cloudron install --no-sso --location ${LOCATION} -p SSH_PORT=${SSH_PORT}`, EXEC_ARGS); });
|
await cloudronCli.uninstall();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('install app (no sso)', function () {
|
||||||
|
cloudronCli.install({ noSso: true, tcpPortFlags: INSTALL_TCP_FLAGS });
|
||||||
|
});
|
||||||
|
|
||||||
it('can get app information', getAppInfo);
|
|
||||||
it('can admin login (no sso)', adminLogin);
|
it('can admin login (no sso)', adminLogin);
|
||||||
it('can logout', logout);
|
it('can logout', logout);
|
||||||
|
|
||||||
it('uninstall app (no sso)', async function () {
|
it('uninstall app (no sso)', async function () {
|
||||||
await browser.get('about:blank');
|
await cloudronCli.uninstall();
|
||||||
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// test update
|
it('can install app', function () {
|
||||||
it('can install app', function () { execSync(`cloudron install --appstore-id ${app.manifest.id} --location ${LOCATION} -p SSH_PORT=${SSH_PORT}`, EXEC_ARGS); });
|
cloudronCli.appstoreInstall({ tcpPortFlags: INSTALL_TCP_FLAGS });
|
||||||
|
});
|
||||||
|
|
||||||
it('can get app information', getAppInfo);
|
it('can login', loginGiteaOIDCOld);
|
||||||
it('can login', loginOIDC.bind(null, username, password));
|
|
||||||
it('can set avatar', setAvatar);
|
it('can set avatar', setAvatar);
|
||||||
it('can get avatar', checkAvatar);
|
it('can get avatar', checkAvatar);
|
||||||
it('can add public key', addPublicKey);
|
it('can add public key', addPublicKey);
|
||||||
@@ -278,21 +213,19 @@ describe('Application life cycle test', function () {
|
|||||||
it('can clone the url', cloneRepo);
|
it('can clone the url', cloneRepo);
|
||||||
it('can add and push a file', pushFile);
|
it('can add and push a file', pushFile);
|
||||||
|
|
||||||
it('can update', function () { execSync('cloudron update --app ' + app.id, EXEC_ARGS); });
|
it('can update', async function () {
|
||||||
it('can get app information', getAppInfo);
|
await cloudronCli.update();
|
||||||
|
});
|
||||||
|
|
||||||
it('can admin login', adminLogin);
|
it('can admin login', adminLogin);
|
||||||
it('can send mail', sendMail);
|
|
||||||
it('can logout', logout);
|
it('can logout', logout);
|
||||||
|
|
||||||
it('can login', loginOIDC.bind(null, username, password));
|
it('can login', loginGiteaOIDC);
|
||||||
it('can get avatar', checkAvatar);
|
it('can get avatar', checkAvatar);
|
||||||
it('can clone the url', cloneRepo);
|
it('can clone the url', cloneRepo);
|
||||||
it('file exists in cloned repo', fileExists);
|
it('file exists in cloned repo', fileExists);
|
||||||
|
|
||||||
it('uninstall app', async function () {
|
it('uninstall app', async function () {
|
||||||
// ensure we don't hit NXDOMAIN in the mean time
|
await cloudronCli.uninstall();
|
||||||
await browser.get('about:blank');
|
|
||||||
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user