Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb8fb69532 | ||
|
|
1ff935b727 | ||
|
|
d5db7f2d2a | ||
|
|
9401f19ad5 | ||
|
|
30e669359a |
No files matched your search
+23
-10
@@ -72,10 +72,11 @@ directory, then protect it so only the release bot can push. Protect the `v*`
|
|||||||
tag pattern so only the release maintainers represented by
|
tag pattern so only the release maintainers represented by
|
||||||
`RELEASE_TAG_ALLOWED_SIGNERS` can create, update, or delete matching tags. The
|
`RELEASE_TAG_ALLOWED_SIGNERS` can create, update, or delete matching tags. The
|
||||||
workflow requires the exact `v*` rule to have an explicit non-empty user or
|
workflow requires the exact `v*` rule to have an explicit non-empty user or
|
||||||
team allowlist. Gitea uses the same allowlist for tag creation and later tag
|
team allowlist. Configure it under repository **Settings → Tags → Protected
|
||||||
changes; when immutable release tags are required, add a server-side
|
tags**; a similar pattern such as `v*.*` does not satisfy the release check.
|
||||||
pre-receive policy that rejects updates and deletion after creation. Protect
|
Gitea uses the same allowlist for tag creation and later tag changes; when
|
||||||
`main` in the normal way.
|
immutable release tags are required, add a server-side pre-receive policy that
|
||||||
|
rejects updates and deletion after creation. Protect `main` in the normal way.
|
||||||
|
|
||||||
The updater feed URL is:
|
The updater feed URL is:
|
||||||
|
|
||||||
@@ -96,11 +97,15 @@ to `stable`; any strict SemVer prerelease goes to `beta`.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
git config gpg.format ssh
|
git config gpg.format ssh
|
||||||
git config user.signingkey ~/.ssh/echoion-release-maintainer.pub
|
git config user.signingkey ~/.ssh/echoion-release-maintainer
|
||||||
git tag -s -a v1.2.3 -m 'Echoion 1.2.3'
|
git tag -s -a v1.2.3 -m 'Echoion 1.2.3'
|
||||||
|
test "$(git cat-file -t refs/tags/v1.2.3)" = tag
|
||||||
git push origin v1.2.3
|
git push origin v1.2.3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The private-key path works without an SSH agent. A `.pub` path may be used
|
||||||
|
instead when its matching private key is already loaded in `ssh-agent`.
|
||||||
|
|
||||||
`.gitea/workflows/release.yml` rejects a lightweight tag, a non-SSH
|
`.gitea/workflows/release.yml` rejects a lightweight tag, a non-SSH
|
||||||
signature, an untrusted signer, a repository without the exact `v*` protected
|
signature, an untrusted signer, a repository without the exact `v*` protected
|
||||||
tag rule and explicit allowlist, a non-SemVer name, an event object unrelated
|
tag rule and explicit allowlist, a non-SemVer name, an event object unrelated
|
||||||
@@ -118,11 +123,19 @@ feed failure can therefore be retried without replacing a published release.
|
|||||||
## Nightly releases
|
## Nightly releases
|
||||||
|
|
||||||
`.gitea/workflows/nightly.yml` runs at 02:17 UTC and can also be dispatched
|
`.gitea/workflows/nightly.yml` runs at 02:17 UTC and can also be dispatched
|
||||||
manually. Nightly versions use
|
manually. The highest published `vMAJOR.MINOR.PATCH` release supplies the next
|
||||||
`0.0.0-nightly.YYYYMMDD.RUN_NUMBER`, publish as prereleases on the `nightly`
|
patch as `MAJOR.MINOR.(PATCH+1)-nightly.YYYYMMDD.RUN_NUMBER`. With no published
|
||||||
channel, and keep the newest 14 Gitea releases. The aggregate feed also keeps
|
semantic release, nightlies use the root CMake
|
||||||
the newest 14 distinct nightly versions while retaining stable and beta
|
`project(Echoion VERSION x.y.z)` value without incrementing it. Drafts, failed
|
||||||
records.
|
publications, and `nightly-*` releases do not affect the base. Nightlies use the
|
||||||
|
`nightly` channel, publish as prereleases, and keep the newest 14 Gitea
|
||||||
|
releases. The aggregate feed also keeps the newest 14 distinct nightly versions
|
||||||
|
while retaining stable and beta records. Gitea materializes a missing
|
||||||
|
`nightly-*` Git tag only when the download-verified draft is published; the
|
||||||
|
publisher then verifies its commit immediately and never moves an existing tag
|
||||||
|
whose target differs. Stable and beta publishing require their signed tag to
|
||||||
|
exist before creating a draft. If `nightly-*` is protected separately, allow
|
||||||
|
the release bot to create and delete it.
|
||||||
|
|
||||||
Every aggregate envelope expires 45 days after generation. Scheduled
|
Every aggregate envelope expires 45 days after generation. Scheduled
|
||||||
nightlies normally refresh it daily. Alert when the feed branch has not
|
nightlies normally refresh it daily. Alert when the feed branch has not
|
||||||
|
|||||||
@@ -36,13 +36,26 @@ jobs:
|
|||||||
- name: Derive the nightly identity
|
- name: Derive the nightly identity
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
|
GITEA_RELEASE_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN }}
|
||||||
|
API_URL: ${{ gitea.api_url }}
|
||||||
SERVER_URL: ${{ gitea.server_url }}
|
SERVER_URL: ${{ gitea.server_url }}
|
||||||
REPOSITORY: ${{ gitea.repository }}
|
REPOSITORY: ${{ gitea.repository }}
|
||||||
RUN_NUMBER: ${{ gitea.run_number }}
|
RUN_NUMBER: ${{ gitea.run_number }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
date_id=$(date -u +%Y%m%d)
|
date_id=$(date -u +%Y%m%d)
|
||||||
version="0.0.0-nightly.${date_id}.${RUN_NUMBER}"
|
owner=${REPOSITORY%%/*}
|
||||||
|
repo=${REPOSITORY#*/}
|
||||||
|
version=$(
|
||||||
|
python3 scripts/gitea_release.py \
|
||||||
|
--api-url "$API_URL" \
|
||||||
|
derive-nightly-version \
|
||||||
|
--owner "$owner" \
|
||||||
|
--repo "$repo" \
|
||||||
|
--cmake-file CMakeLists.txt \
|
||||||
|
--date-id "$date_id" \
|
||||||
|
--run-number "$RUN_NUMBER"
|
||||||
|
)
|
||||||
tag="nightly-${date_id}-${RUN_NUMBER}"
|
tag="nightly-${date_id}-${RUN_NUMBER}"
|
||||||
artifact="echoion-${version}-linux-x86_64.tar.zst"
|
artifact="echoion-${version}-linux-x86_64.tar.zst"
|
||||||
url="${SERVER_URL}/${REPOSITORY}/releases/download/${tag}/${artifact}"
|
url="${SERVER_URL}/${REPOSITORY}/releases/download/${tag}/${artifact}"
|
||||||
@@ -93,6 +106,7 @@ jobs:
|
|||||||
--name "Echoion nightly $RELEASE_VERSION" \
|
--name "Echoion nightly $RELEASE_VERSION" \
|
||||||
--body-file "$RUNNER_TEMP/release-notes.md" \
|
--body-file "$RUNNER_TEMP/release-notes.md" \
|
||||||
--artifacts dist \
|
--artifacts dist \
|
||||||
|
--allow-missing-draft-tag \
|
||||||
--prerelease
|
--prerelease
|
||||||
|
|
||||||
- name: Retain fourteen Gitea nightly releases
|
- name: Retain fourteen Gitea nightly releases
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 4.0.0)
|
cmake_minimum_required(VERSION 4.0.0)
|
||||||
project(Echoion VERSION 1.0.0 LANGUAGES CXX)
|
project(Echoion VERSION 1.0.7 LANGUAGES CXX)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(cmake/DependencyLock.cmake)
|
include(cmake/DependencyLock.cmake)
|
||||||
|
|||||||
+1
-1
Submodule EchoionCore updated: 7975f2b38e...dfbbdaaf01.
@@ -4,7 +4,7 @@
|
|||||||
# and implements IPluginInterface with the reusable VoidTeamspeak client.
|
# and implements IPluginInterface with the reusable VoidTeamspeak client.
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 4.0.0)
|
cmake_minimum_required(VERSION 4.0.0)
|
||||||
project(EchoionStandalone VERSION 1.0.0 LANGUAGES CXX)
|
project(EchoionStandalone VERSION 1.0.7 LANGUAGES CXX)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 26)
|
set(CMAKE_CXX_STANDARD 26)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ namespace Echoion::Standalone
|
|||||||
const std::filesystem::path& installRoot,
|
const std::filesystem::path& installRoot,
|
||||||
const std::filesystem::path& executableDirectory);
|
const std::filesystem::path& executableDirectory);
|
||||||
|
|
||||||
|
[[nodiscard]] std::optional<std::filesystem::path>
|
||||||
|
bundledCertificateBundle(const std::filesystem::path& installRoot);
|
||||||
|
|
||||||
[[nodiscard]] std::expected<std::filesystem::path, std::string>
|
[[nodiscard]] std::expected<std::filesystem::path, std::string>
|
||||||
resolveAvatarCacheDirectory(
|
resolveAvatarCacheDirectory(
|
||||||
const std::filesystem::path& configuredDirectory,
|
const std::filesystem::path& configuredDirectory,
|
||||||
|
|||||||
@@ -120,7 +120,10 @@ namespace Echoion::Standalone
|
|||||||
if (std::filesystem::is_regular_file(
|
if (std::filesystem::is_regular_file(
|
||||||
packagedDirectory / "web" / "index.html", error) &&
|
packagedDirectory / "web" / "index.html", error) &&
|
||||||
!error) {
|
!error) {
|
||||||
return packagedDirectory;
|
// Installed config paths are rooted at the release prefix (for
|
||||||
|
// example ./share/echoion/web), so the working directory must be
|
||||||
|
// the installation root rather than share/echoion itself.
|
||||||
|
return installRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
error.clear();
|
error.clear();
|
||||||
@@ -132,6 +135,19 @@ namespace Echoion::Standalone
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<std::filesystem::path>
|
||||||
|
bundledCertificateBundle(const std::filesystem::path& installRoot)
|
||||||
|
{
|
||||||
|
const auto bundle =
|
||||||
|
installRoot / "share" / "echoion" / "certs" / "ca-certificates.crt";
|
||||||
|
std::error_code error;
|
||||||
|
if (!std::filesystem::is_regular_file(bundle, error) || error ||
|
||||||
|
std::filesystem::file_size(bundle, error) == 0 || error) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
return bundle.lexically_normal();
|
||||||
|
}
|
||||||
|
|
||||||
std::expected<std::filesystem::path, std::string>
|
std::expected<std::filesystem::path, std::string>
|
||||||
resolveAvatarCacheDirectory(
|
resolveAvatarCacheDirectory(
|
||||||
const std::filesystem::path& configuredDirectory,
|
const std::filesystem::path& configuredDirectory,
|
||||||
|
|||||||
@@ -558,6 +558,16 @@ int main(int argc, char** argv)
|
|||||||
std::cerr << "Cannot export ECHOION_HOME\n";
|
std::cerr << "Cannot export ECHOION_HOME\n";
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
if (!environmentPath("SSL_CERT_FILE")) {
|
||||||
|
if (const auto certificateBundle =
|
||||||
|
Echoion::Standalone::bundledCertificateBundle(installRoot)) {
|
||||||
|
const auto bundleString = certificateBundle->string();
|
||||||
|
if (::setenv("SSL_CERT_FILE", bundleString.c_str(), 0) != 0) {
|
||||||
|
std::cerr << "Cannot export bundled TLS certificate store\n";
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
for (const std::string_view requiredValue : {"--config", "--state-dir"}) {
|
for (const std::string_view requiredValue : {"--config", "--state-dir"}) {
|
||||||
if (hasArgument(argc, argv, requiredValue) &&
|
if (hasArgument(argc, argv, requiredValue) &&
|
||||||
!optionalArgumentPath(argc, argv, requiredValue)) {
|
!optionalArgumentPath(argc, argv, requiredValue)) {
|
||||||
|
|||||||
@@ -101,11 +101,19 @@ int main()
|
|||||||
const auto packagedIndex =
|
const auto packagedIndex =
|
||||||
installRoot / "share" / "echoion" / "web" / "index.html";
|
installRoot / "share" / "echoion" / "web" / "index.html";
|
||||||
check(writeFile(packagedIndex), "failed to create packaged web fixture");
|
check(writeFile(packagedIndex), "failed to create packaged web fixture");
|
||||||
check(
|
check(Echoion::Standalone::runtimeWorkingDirectory(
|
||||||
Echoion::Standalone::runtimeWorkingDirectory(installRoot,
|
installRoot, executableDirectory) == installRoot,
|
||||||
executableDirectory) ==
|
"packaged web root did not select the installation root as working "
|
||||||
installRoot / "share" / "echoion",
|
"directory");
|
||||||
"packaged web root did not select share/echoion as working directory");
|
const auto bundledCertificates =
|
||||||
|
installRoot / "share" / "echoion" / "certs" / "ca-certificates.crt";
|
||||||
|
check(!Echoion::Standalone::bundledCertificateBundle(installRoot),
|
||||||
|
"missing bundled certificate store was accepted");
|
||||||
|
check(writeFile(bundledCertificates),
|
||||||
|
"failed to create bundled certificate store fixture");
|
||||||
|
check(Echoion::Standalone::bundledCertificateBundle(installRoot) ==
|
||||||
|
bundledCertificates,
|
||||||
|
"bundled certificate store was not resolved from the install root");
|
||||||
std::filesystem::remove_all(installRoot / "share");
|
std::filesystem::remove_all(installRoot / "share");
|
||||||
const auto developmentIndex = executableDirectory / "web" / "index.html";
|
const auto developmentIndex = executableDirectory / "web" / "index.html";
|
||||||
check(writeFile(developmentIndex),
|
check(writeFile(developmentIndex),
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ mkdir -p -- \
|
|||||||
"$bundle/bin" \
|
"$bundle/bin" \
|
||||||
"$bundle/lib" \
|
"$bundle/lib" \
|
||||||
"$bundle/service" \
|
"$bundle/service" \
|
||||||
|
"$bundle/share/echoion/certs" \
|
||||||
"$bundle/share/echoion/tools" \
|
"$bundle/share/echoion/tools" \
|
||||||
"$bundle/share/echoion/web"
|
"$bundle/share/echoion/web"
|
||||||
printf '#!/bin/sh\necho "echoiond must not run during release staging" >&2\nexit 97\n' \
|
printf '#!/bin/sh\necho "echoiond must not run during release staging" >&2\nexit 97\n' \
|
||||||
@@ -27,6 +28,7 @@ install -m 0644 -- \
|
|||||||
"$service_templates/echoion-updater.timer.in" \
|
"$service_templates/echoion-updater.timer.in" \
|
||||||
"$bundle/service/"
|
"$bundle/service/"
|
||||||
printf '{"webRoot":"./web"}\n' > "$bundle/share/echoion/config.example.json"
|
printf '{"webRoot":"./web"}\n' > "$bundle/share/echoion/config.example.json"
|
||||||
|
printf 'test trust bundle\n' > "$bundle/share/echoion/certs/ca-certificates.crt"
|
||||||
install -m 0755 -- "$manifest_validator" \
|
install -m 0755 -- "$manifest_validator" \
|
||||||
"$bundle/share/echoion/tools/validate-release-manifest.py"
|
"$bundle/share/echoion/tools/validate-release-manifest.py"
|
||||||
printf '<!doctype html>\n' > "$bundle/share/echoion/web/index.html"
|
printf '<!doctype html>\n' > "$bundle/share/echoion/web/index.html"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import type { RpcMethodName } from '../lib/rpc';
|
|||||||
import { confirmDialog, promptDialog } from '../lib/dialog';
|
import { confirmDialog, promptDialog } from '../lib/dialog';
|
||||||
import { EmptyRow } from './TrackRow';
|
import { EmptyRow } from './TrackRow';
|
||||||
import { t, tf } from '../i18n';
|
import { t, tf } from '../i18n';
|
||||||
|
import { teamSpeakChannelDisplayName } from '../lib/teamspeak';
|
||||||
|
|
||||||
interface AdminClient {
|
interface AdminClient {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -281,10 +282,17 @@ export function TeamSpeakAdmin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Channel({ channel, depth = 0 }: { channel: AdminChannel; depth?: number }) {
|
function Channel({ channel, depth = 0 }: { channel: AdminChannel; depth?: number }) {
|
||||||
|
const displayName = teamSpeakChannelDisplayName(channel.name);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="ts-admin-channel" style={{ marginLeft: depth * 16 }}>
|
<div className="ts-admin-channel" style={{ marginLeft: depth * 16 }}>
|
||||||
<div className="ts-admin-channel-head">
|
<div className="ts-admin-channel-head">
|
||||||
<strong>{channel.name}</strong>
|
<strong
|
||||||
|
className={displayName.spacer ? 'ts-admin-spacer' : undefined}
|
||||||
|
title={channel.name}
|
||||||
|
>
|
||||||
|
{displayName.label}
|
||||||
|
</strong>
|
||||||
<span className="muted">#{channel.id}</span>
|
<span className="muted">#{channel.id}</span>
|
||||||
<span className="ts-capacity">
|
<span className="ts-capacity">
|
||||||
{channel.currentClients}/{channel.maxClients || '∞'}
|
{channel.currentClients}/{channel.maxClients || '∞'}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { teamSpeakChannelDisplayName } from './teamspeak';
|
||||||
|
|
||||||
|
describe('TeamSpeak channel display names', () => {
|
||||||
|
it('leaves ordinary channel names unchanged', () => {
|
||||||
|
expect(teamSpeakChannelDisplayName('Minecraft')).toEqual({
|
||||||
|
label: 'Minecraft',
|
||||||
|
spacer: false,
|
||||||
|
alignment: 'left',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('removes spacer control prefixes and preserves alignment', () => {
|
||||||
|
expect(teamSpeakChannelDisplayName('[cspacer0]Гамесы')).toEqual({
|
||||||
|
label: 'Гамесы',
|
||||||
|
spacer: true,
|
||||||
|
alignment: 'center',
|
||||||
|
});
|
||||||
|
expect(teamSpeakChannelDisplayName('[rspacer12]Подвал')).toEqual({
|
||||||
|
label: 'Подвал',
|
||||||
|
spacer: true,
|
||||||
|
alignment: 'right',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('recognizes repeating spacer channels', () => {
|
||||||
|
expect(teamSpeakChannelDisplayName('[*spacer3]—')).toEqual({
|
||||||
|
label: '—',
|
||||||
|
spacer: true,
|
||||||
|
alignment: 'repeat',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
export type TeamSpeakSpacerAlignment = 'left' | 'center' | 'right' | 'repeat';
|
||||||
|
|
||||||
|
export interface TeamSpeakChannelDisplayName {
|
||||||
|
label: string;
|
||||||
|
spacer: boolean;
|
||||||
|
alignment: TeamSpeakSpacerAlignment;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SPACER_NAME = /^\[([clr]|\*)?spacer\d*\](.*)$/i;
|
||||||
|
|
||||||
|
export function teamSpeakChannelDisplayName(
|
||||||
|
name: string
|
||||||
|
): TeamSpeakChannelDisplayName {
|
||||||
|
const match = SPACER_NAME.exec(name);
|
||||||
|
if (!match) {
|
||||||
|
return { label: name, spacer: false, alignment: 'left' };
|
||||||
|
}
|
||||||
|
|
||||||
|
const alignment =
|
||||||
|
match[1]?.toLowerCase() === 'c'
|
||||||
|
? 'center'
|
||||||
|
: match[1]?.toLowerCase() === 'r'
|
||||||
|
? 'right'
|
||||||
|
: match[1] === '*'
|
||||||
|
? 'repeat'
|
||||||
|
: 'left';
|
||||||
|
|
||||||
|
return {
|
||||||
|
label: match[2].trim(),
|
||||||
|
spacer: true,
|
||||||
|
alignment,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -579,6 +579,39 @@ select:focus:not(:focus-visible) { outline: none; }
|
|||||||
.ts-channel-row:hover, .ts-client-row:hover { background: rgba(255, 255, 255, 0.035); }
|
.ts-channel-row:hover, .ts-client-row:hover { background: rgba(255, 255, 255, 0.035); }
|
||||||
.ts-channel-caret { width: 14px; color: var(--faint); text-align: center; }
|
.ts-channel-caret { width: 14px; color: var(--faint); text-align: center; }
|
||||||
.ts-channel-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 650; }
|
.ts-channel-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 650; }
|
||||||
|
.ts-channel-row.ts-spacer {
|
||||||
|
margin: 4px 0 3px;
|
||||||
|
padding-inline: 5px;
|
||||||
|
background: linear-gradient(90deg, rgba(124, 92, 255, 0.06), transparent);
|
||||||
|
}
|
||||||
|
.ts-channel-row.ts-spacer:hover {
|
||||||
|
background: linear-gradient(90deg, rgba(124, 92, 255, 0.11), transparent);
|
||||||
|
}
|
||||||
|
.ts-channel-row.ts-spacer .ts-channel-caret {
|
||||||
|
order: 2;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
.ts-channel-row.ts-spacer .ts-channel-name {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
color: var(--text-2);
|
||||||
|
letter-spacing: 0.015em;
|
||||||
|
}
|
||||||
|
.ts-channel-row.ts-spacer .ts-channel-name::before,
|
||||||
|
.ts-channel-row.ts-spacer .ts-channel-name::after {
|
||||||
|
content: '';
|
||||||
|
flex: 1;
|
||||||
|
border-top: 1px solid rgba(124, 92, 255, 0.3);
|
||||||
|
}
|
||||||
|
.ts-channel-row.ts-spacer-left .ts-channel-name::before,
|
||||||
|
.ts-channel-row.ts-spacer-repeat .ts-channel-name::before {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.ts-channel-row.ts-spacer-right .ts-channel-name::after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.ts-capacity { margin-left: auto; color: var(--faint); font: 11px var(--font-mono); }
|
.ts-capacity { margin-left: auto; color: var(--faint); font: 11px var(--font-mono); }
|
||||||
.ts-tag {
|
.ts-tag {
|
||||||
padding: 2px 6px; border-radius: 999px; color: var(--muted-2);
|
padding: 2px 6px; border-radius: 999px; color: var(--muted-2);
|
||||||
@@ -620,6 +653,7 @@ select:focus:not(:focus-visible) { outline: none; }
|
|||||||
display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
|
display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
|
||||||
min-height: 34px;
|
min-height: 34px;
|
||||||
}
|
}
|
||||||
|
.ts-admin-spacer { color: var(--accent-text); letter-spacing: 0.02em; }
|
||||||
.ts-admin-channel-head .ts-capacity { margin-left: 0; margin-right: auto; }
|
.ts-admin-channel-head .ts-capacity { margin-left: 0; margin-right: auto; }
|
||||||
.ts-admin-client {
|
.ts-admin-client {
|
||||||
display: grid; grid-template-columns: minmax(180px, 0.8fr) minmax(250px, 1.2fr) auto;
|
display: grid; grid-template-columns: minmax(180px, 0.8fr) minmax(250px, 1.2fr) auto;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
} from '../components/icons';
|
} from '../components/icons';
|
||||||
import { t, tf } from '../i18n';
|
import { t, tf } from '../i18n';
|
||||||
import type { PublicDashboardChannel } from '../lib/types';
|
import type { PublicDashboardChannel } from '../lib/types';
|
||||||
|
import { teamSpeakChannelDisplayName } from '../lib/teamspeak';
|
||||||
|
|
||||||
const DASHBOARD_VIDEO_PREF_KEY = 'echoion.npVideo';
|
const DASHBOARD_VIDEO_PREF_KEY = 'echoion.npVideo';
|
||||||
|
|
||||||
@@ -32,26 +33,37 @@ function ChannelNode({
|
|||||||
channel: PublicDashboardChannel;
|
channel: PublicDashboardChannel;
|
||||||
depth?: number;
|
depth?: number;
|
||||||
}) {
|
}) {
|
||||||
|
const displayName = teamSpeakChannelDisplayName(channel.name);
|
||||||
|
const rowClassName = displayName.spacer
|
||||||
|
? `ts-channel-row ts-spacer ts-spacer-${displayName.alignment}`
|
||||||
|
: 'ts-channel-row';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="ts-channel"
|
className="ts-channel"
|
||||||
style={{ '--tree-depth': depth } as CSSProperties}
|
style={{ '--tree-depth': depth } as CSSProperties}
|
||||||
>
|
>
|
||||||
<div className="ts-channel-row">
|
<div className={rowClassName}>
|
||||||
<span className="ts-channel-caret" aria-hidden="true">
|
<span className="ts-channel-caret" aria-hidden="true">
|
||||||
{channel.channels.length || channel.clients.length ? '⌄' : '·'}
|
{channel.channels.length || channel.clients.length ? '⌄' : '·'}
|
||||||
</span>
|
</span>
|
||||||
<span className="ts-channel-name">{channel.name}</span>
|
<span className="ts-channel-name" title={channel.name}>
|
||||||
{channel.default && <span className="ts-tag">{t('default')}</span>}
|
{displayName.label}
|
||||||
{channel.password && (
|
</span>
|
||||||
|
{!displayName.spacer && channel.default && (
|
||||||
|
<span className="ts-tag">{t('default')}</span>
|
||||||
|
)}
|
||||||
|
{!displayName.spacer && channel.password && (
|
||||||
<span className="ts-tag" title={t('Password protected')}>
|
<span className="ts-tag" title={t('Password protected')}>
|
||||||
{t('locked')}
|
{t('locked')}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<span className="ts-capacity">
|
{!displayName.spacer && (
|
||||||
{channel.currentClients}/
|
<span className="ts-capacity">
|
||||||
{channel.maxClients > 0 ? channel.maxClients : '∞'}
|
{channel.currentClients}/
|
||||||
</span>
|
{channel.maxClients > 0 ? channel.maxClients : '∞'}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{channel.clients.map((client, index) => (
|
{channel.clients.map((client, index) => (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ set(ECHOION_VOID_REVISION
|
|||||||
"053ee5b296d1f41b0653b4301bbea1e857be2279"
|
"053ee5b296d1f41b0653b4301bbea1e857be2279"
|
||||||
CACHE STRING "VoidLibrary commit used by Echoion")
|
CACHE STRING "VoidLibrary commit used by Echoion")
|
||||||
set(ECHOION_VOID_TEAMSPEAK_REVISION
|
set(ECHOION_VOID_TEAMSPEAK_REVISION
|
||||||
"cb43116da643fb6584f91f108f384cc5e3cb658c"
|
"5c0c0c525fe76645bbcdd5ae16c7396993ca8f1d"
|
||||||
CACHE STRING "VoidTeamspeak commit used by Echoion")
|
CACHE STRING "VoidTeamspeak commit used by Echoion")
|
||||||
+7
-2
@@ -23,7 +23,7 @@ The default installed tree is:
|
|||||||
bin/ echoiond and echoion-updater
|
bin/ echoiond and echoion-updater
|
||||||
lib/ Core and dynamic dependency closure
|
lib/ Core and dynamic dependency closure
|
||||||
service/ service templates
|
service/ service templates
|
||||||
share/echoion/ web, config template, licenses, validation tool
|
share/echoion/ web, config template, CA trust store, licenses, tools
|
||||||
bootstrap-plugins/ immutable first-party plugin artifacts
|
bootstrap-plugins/ immutable first-party plugin artifacts
|
||||||
manifest.json
|
manifest.json
|
||||||
libexec/updater/<installer-version>/
|
libexec/updater/<installer-version>/
|
||||||
@@ -61,7 +61,12 @@ or plugin data. The
|
|||||||
operation is idempotent and participates in installer rollback. The service and
|
operation is idempotent and participates in installer rollback. The service and
|
||||||
portable launcher expose only the active release's bundled shared-library
|
portable launcher expose only the active release's bundled shared-library
|
||||||
directory through `LD_LIBRARY_PATH`; release builds keep `BUILD_SHARED_LIBS=ON`
|
directory through `LD_LIBRARY_PATH`; release builds keep `BUILD_SHARED_LIBS=ON`
|
||||||
and `ECHOION_STATIC_LINK=OFF`. Installed configurations use the relocatable
|
and `ECHOION_STATIC_LINK=OFF`. Plugin RUNPATHs also resolve the active
|
||||||
|
`current/lib` closure from managed, portable/manual, and immutable bootstrap
|
||||||
|
locations, with `$ORIGIN/lib` reserved for plugin-private dependencies.
|
||||||
|
The daemon selects the bundled CA trust store when `SSL_CERT_FILE` is unset, so
|
||||||
|
HTTPS feeds remain verified on hosts without the builder distribution's
|
||||||
|
OpenSSL directory layout. Installed configurations use the relocatable
|
||||||
`./share/echoion/web` asset path; systemd units and the portable launcher set
|
`./share/echoion/web` asset path; systemd units and the portable launcher set
|
||||||
the active release as their working directory. An upgrade rewrites only the
|
the active release as their working directory. An upgrade rewrites only the
|
||||||
exact legacy installer default `./web`; custom web roots remain untouched and
|
exact legacy installer default `./web`; custom web roots remain untouched and
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ assert_not_contains() {
|
|||||||
make_payload() {
|
make_payload() {
|
||||||
local root=$1
|
local root=$1
|
||||||
install -d -- "$root/bin" "$root/lib" "$root/share/echoion/web" \
|
install -d -- "$root/bin" "$root/lib" "$root/share/echoion/web" \
|
||||||
"$root/share/echoion/tools" "$root/service" \
|
"$root/share/echoion/tools" "$root/share/echoion/certs" "$root/service" \
|
||||||
"$root/share/echoion/bootstrap-plugins/url-shortener-internal/1.0.0" \
|
"$root/share/echoion/bootstrap-plugins/url-shortener-internal/1.0.0" \
|
||||||
"$root/share/echoion/bootstrap-plugins/url-shortener-external/1.0.0"
|
"$root/share/echoion/bootstrap-plugins/url-shortener-external/1.0.0"
|
||||||
install -m 0755 -- "$PACKAGING_DIR/install.sh" "$root/install.sh"
|
install -m 0755 -- "$PACKAGING_DIR/install.sh" "$root/install.sh"
|
||||||
@@ -107,6 +107,8 @@ EOF
|
|||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
printf '<!doctype html>\n' > "$root/share/echoion/web/index.html"
|
printf '<!doctype html>\n' > "$root/share/echoion/web/index.html"
|
||||||
|
printf 'test trust bundle\n' \
|
||||||
|
>"$root/share/echoion/certs/ca-certificates.crt"
|
||||||
printf 'fake internal shortener plugin 1.0.0\n' > \
|
printf 'fake internal shortener plugin 1.0.0\n' > \
|
||||||
"$root/share/echoion/bootstrap-plugins/url-shortener-internal/1.0.0/url-shortener-internal.so"
|
"$root/share/echoion/bootstrap-plugins/url-shortener-internal/1.0.0/url-shortener-internal.so"
|
||||||
printf 'fake external shortener plugin 1.0.0\n' > \
|
printf 'fake external shortener plugin 1.0.0\n' > \
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ make_release() {
|
|||||||
local destination=$1
|
local destination=$1
|
||||||
local version=$2
|
local version=$2
|
||||||
mkdir -p "$destination/bin" "$destination/lib" "$destination/service" \
|
mkdir -p "$destination/bin" "$destination/lib" "$destination/service" \
|
||||||
"$destination/share/echoion/web" "$destination/share/echoion/tools"
|
"$destination/share/echoion/web" "$destination/share/echoion/tools" \
|
||||||
|
"$destination/share/echoion/certs"
|
||||||
install -m 0755 /bin/true "$destination/bin/echoiond"
|
install -m 0755 /bin/true "$destination/bin/echoiond"
|
||||||
install -m 0755 "$updater" "$destination/bin/echoion-updater"
|
install -m 0755 "$updater" "$destination/bin/echoion-updater"
|
||||||
printf 'core %s\n' "$version" >"$destination/lib/Echoion.ts"
|
printf 'core %s\n' "$version" >"$destination/lib/Echoion.ts"
|
||||||
@@ -35,6 +36,8 @@ make_release() {
|
|||||||
"$destination/share/echoion/tools/validate-release-manifest.py"
|
"$destination/share/echoion/tools/validate-release-manifest.py"
|
||||||
printf '{}\n' >"$destination/share/echoion/config.example.json"
|
printf '{}\n' >"$destination/share/echoion/config.example.json"
|
||||||
printf '<!doctype html>\n' >"$destination/share/echoion/web/index.html"
|
printf '<!doctype html>\n' >"$destination/share/echoion/web/index.html"
|
||||||
|
printf 'test trust bundle\n' \
|
||||||
|
>"$destination/share/echoion/certs/ca-certificates.crt"
|
||||||
python3 "$source_root/scripts/generate-release-manifest.py" \
|
python3 "$source_root/scripts/generate-release-manifest.py" \
|
||||||
--root "$destination" --version "$version"
|
--root "$destination" --version "$version"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1431,6 +1431,7 @@ namespace Echoion::Updater
|
|||||||
{"lib/Echoion.ts", "file"},
|
{"lib/Echoion.ts", "file"},
|
||||||
{"share/echoion/web/index.html", "file"},
|
{"share/echoion/web/index.html", "file"},
|
||||||
{"share/echoion/config.example.json", "file"},
|
{"share/echoion/config.example.json", "file"},
|
||||||
|
{"share/echoion/certs/ca-certificates.crt", "file"},
|
||||||
{"share/echoion/tools/validate-release-manifest.py", "file"},
|
{"share/echoion/tools/validate-release-manifest.py", "file"},
|
||||||
{"service/echoion.service.in", "file"},
|
{"service/echoion.service.in", "file"},
|
||||||
{"service/echoion-updater.service.in", "file"},
|
{"service/echoion-updater.service.in", "file"},
|
||||||
|
|||||||
+150
-22
@@ -4,6 +4,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
from datetime import datetime
|
||||||
import hashlib
|
import hashlib
|
||||||
import http.client
|
import http.client
|
||||||
import json
|
import json
|
||||||
@@ -23,6 +24,22 @@ from urllib.request import HTTPRedirectHandler, Request, build_opener
|
|||||||
MAX_JSON_BYTES = 8 * 1024 * 1024
|
MAX_JSON_BYTES = 8 * 1024 * 1024
|
||||||
UPLOAD_CHUNK_BYTES = 1024 * 1024
|
UPLOAD_CHUNK_BYTES = 1024 * 1024
|
||||||
SAFE_NAME = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._+-]{0,255}$")
|
SAFE_NAME = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._+-]{0,255}$")
|
||||||
|
RELEASE_TAG_VERSION = re.compile(
|
||||||
|
r"^v(0|[1-9][0-9]*)\."
|
||||||
|
r"(0|[1-9][0-9]*)\."
|
||||||
|
r"(0|[1-9][0-9]*)"
|
||||||
|
r"(?:-((?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)"
|
||||||
|
r"(?:\.(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*))?"
|
||||||
|
r"(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$"
|
||||||
|
)
|
||||||
|
CMAKE_PROJECT_VERSION = re.compile(
|
||||||
|
r"\bproject\s*\(\s*Echoion\b[^)]*?\bVERSION\s+"
|
||||||
|
r"(0|[1-9][0-9]*)\."
|
||||||
|
r"(0|[1-9][0-9]*)\."
|
||||||
|
r"(0|[1-9][0-9]*)(?=\s|\))",
|
||||||
|
re.IGNORECASE | re.DOTALL,
|
||||||
|
)
|
||||||
|
MAX_CMAKE_BYTES = 1024 * 1024
|
||||||
|
|
||||||
|
|
||||||
class NoRedirect(HTTPRedirectHandler):
|
class NoRedirect(HTTPRedirectHandler):
|
||||||
@@ -326,9 +343,11 @@ def verify_release_metadata(
|
|||||||
def verify_tag_target(
|
def verify_tag_target(
|
||||||
api: GiteaApi, base: str, tag: str, expected_commit: str
|
api: GiteaApi, base: str, tag: str, expected_commit: str
|
||||||
) -> None:
|
) -> None:
|
||||||
_, document = api.request_json(
|
if not tag_target_exists(api, base, tag, expected_commit):
|
||||||
"GET", f"{base}/tags/{quote(tag, safe='')}", allowed_statuses=(200,)
|
fail("the release tag does not exist")
|
||||||
)
|
|
||||||
|
|
||||||
|
def validate_tag_target(document: Any, expected_commit: str) -> None:
|
||||||
if (
|
if (
|
||||||
not isinstance(document, dict)
|
not isinstance(document, dict)
|
||||||
or not isinstance(document.get("commit"), dict)
|
or not isinstance(document.get("commit"), dict)
|
||||||
@@ -337,6 +356,24 @@ def verify_tag_target(
|
|||||||
fail("the release tag does not target the requested commit")
|
fail("the release tag does not target the requested commit")
|
||||||
|
|
||||||
|
|
||||||
|
def tag_target_exists(
|
||||||
|
api: GiteaApi,
|
||||||
|
base: str,
|
||||||
|
tag: str,
|
||||||
|
expected_commit: str,
|
||||||
|
) -> bool:
|
||||||
|
tag_path = quote(tag, safe="")
|
||||||
|
status, document = api.request_json(
|
||||||
|
"GET",
|
||||||
|
f"{base}/tags/{tag_path}",
|
||||||
|
allowed_statuses=(200, 404),
|
||||||
|
)
|
||||||
|
if status == 404:
|
||||||
|
return False
|
||||||
|
validate_tag_target(document, expected_commit)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def publish(arguments: argparse.Namespace, api: GiteaApi) -> None:
|
def publish(arguments: argparse.Namespace, api: GiteaApi) -> None:
|
||||||
owner = arguments.owner
|
owner = arguments.owner
|
||||||
repo = arguments.repo
|
repo = arguments.repo
|
||||||
@@ -355,6 +392,17 @@ def publish(arguments: argparse.Namespace, api: GiteaApi) -> None:
|
|||||||
or any(character in arguments.name for character in "\r\n\0")
|
or any(character in arguments.name for character in "\r\n\0")
|
||||||
):
|
):
|
||||||
fail("the release name is invalid")
|
fail("the release name is invalid")
|
||||||
|
is_nightly = arguments.prerelease and tag.startswith("nightly-")
|
||||||
|
if arguments.allow_missing_draft_tag and not is_nightly:
|
||||||
|
fail("--allow-missing-draft-tag is restricted to nightly-* prereleases")
|
||||||
|
tag_exists = tag_target_exists(
|
||||||
|
api,
|
||||||
|
base,
|
||||||
|
tag,
|
||||||
|
arguments.target,
|
||||||
|
)
|
||||||
|
if not tag_exists and not is_nightly:
|
||||||
|
fail("the release tag does not exist")
|
||||||
tag_path = quote(tag, safe="")
|
tag_path = quote(tag, safe="")
|
||||||
status, release = api.request_json(
|
status, release = api.request_json(
|
||||||
"GET",
|
"GET",
|
||||||
@@ -379,9 +427,10 @@ def publish(arguments: argparse.Namespace, api: GiteaApi) -> None:
|
|||||||
fail("Gitea returned an invalid release")
|
fail("Gitea returned an invalid release")
|
||||||
if release.get("tag_name") != tag:
|
if release.get("tag_name") != tag:
|
||||||
fail("Gitea returned a release for the wrong tag")
|
fail("Gitea returned a release for the wrong tag")
|
||||||
verify_tag_target(api, base, tag, arguments.target)
|
|
||||||
release_id = release["id"]
|
release_id = release["id"]
|
||||||
if not release.get("draft", False):
|
if not release.get("draft", False):
|
||||||
|
if not tag_exists:
|
||||||
|
fail("a published release has no Git tag")
|
||||||
verify_release_metadata(
|
verify_release_metadata(
|
||||||
release,
|
release,
|
||||||
tag=tag,
|
tag=tag,
|
||||||
@@ -456,23 +505,7 @@ def publish(arguments: argparse.Namespace, api: GiteaApi) -> None:
|
|||||||
|
|
||||||
def prune_nightlies(arguments: argparse.Namespace, api: GiteaApi) -> None:
|
def prune_nightlies(arguments: argparse.Namespace, api: GiteaApi) -> None:
|
||||||
base = repository_path(arguments.owner, arguments.repo)
|
base = repository_path(arguments.owner, arguments.repo)
|
||||||
releases: list[dict[str, Any]] = []
|
releases = list_releases(api, base)
|
||||||
page = 1
|
|
||||||
while True:
|
|
||||||
query = urlencode({"limit": 50, "page": page})
|
|
||||||
_, batch = api.request_json(
|
|
||||||
"GET", f"{base}/releases?{query}", allowed_statuses=(200,)
|
|
||||||
)
|
|
||||||
if not isinstance(batch, list) or not all(
|
|
||||||
isinstance(release, dict) for release in batch
|
|
||||||
):
|
|
||||||
fail("Gitea returned an invalid release page")
|
|
||||||
releases.extend(batch)
|
|
||||||
if len(batch) < 50:
|
|
||||||
break
|
|
||||||
page += 1
|
|
||||||
if page > 1000:
|
|
||||||
fail("Gitea release pagination exceeded the safety limit")
|
|
||||||
nightlies = [
|
nightlies = [
|
||||||
release
|
release
|
||||||
for release in releases
|
for release in releases
|
||||||
@@ -570,6 +603,87 @@ def verify_tag_protection(arguments: argparse.Namespace, api: GiteaApi) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def list_releases(api: GiteaApi, base: str) -> list[dict[str, Any]]:
|
||||||
|
releases: list[dict[str, Any]] = []
|
||||||
|
page = 1
|
||||||
|
while True:
|
||||||
|
query = urlencode({"limit": 50, "page": page})
|
||||||
|
_, batch = api.request_json(
|
||||||
|
"GET", f"{base}/releases?{query}", allowed_statuses=(200,)
|
||||||
|
)
|
||||||
|
if not isinstance(batch, list) or not all(
|
||||||
|
isinstance(release, dict) for release in batch
|
||||||
|
):
|
||||||
|
fail("Gitea returned an invalid release page")
|
||||||
|
releases.extend(batch)
|
||||||
|
if len(batch) < 50:
|
||||||
|
return releases
|
||||||
|
page += 1
|
||||||
|
if page > 1000:
|
||||||
|
fail("Gitea release pagination exceeded the safety limit")
|
||||||
|
|
||||||
|
|
||||||
|
def cmake_project_version(path: Path) -> tuple[int, int, int]:
|
||||||
|
try:
|
||||||
|
metadata = path.lstat()
|
||||||
|
if (
|
||||||
|
not stat.S_ISREG(metadata.st_mode)
|
||||||
|
or path.is_symlink()
|
||||||
|
or metadata.st_size > MAX_CMAKE_BYTES
|
||||||
|
):
|
||||||
|
fail("the CMake project file must be a small regular file")
|
||||||
|
content = path.read_text(encoding="utf-8")
|
||||||
|
except (OSError, UnicodeError) as error:
|
||||||
|
fail(f"cannot read the CMake project version: {error}")
|
||||||
|
matches = CMAKE_PROJECT_VERSION.findall(content)
|
||||||
|
if len(matches) != 1:
|
||||||
|
fail("the CMake project file must declare one Echoion x.y.z version")
|
||||||
|
major, minor, patch = matches[0]
|
||||||
|
return int(major), int(minor), int(patch)
|
||||||
|
|
||||||
|
|
||||||
|
def derive_nightly_version(arguments: argparse.Namespace, api: GiteaApi) -> None:
|
||||||
|
if not re.fullmatch(r"[0-9]{8}", arguments.date_id):
|
||||||
|
fail("--date-id must use UTC YYYYMMDD format")
|
||||||
|
try:
|
||||||
|
datetime.strptime(arguments.date_id, "%Y%m%d")
|
||||||
|
except ValueError as error:
|
||||||
|
fail(f"--date-id is not a valid calendar date: {error}")
|
||||||
|
if not re.fullmatch(r"[1-9][0-9]*", arguments.run_number):
|
||||||
|
fail("--run-number must be a positive integer")
|
||||||
|
|
||||||
|
base = repository_path(arguments.owner, arguments.repo)
|
||||||
|
released_versions: list[tuple[int, int, int]] = []
|
||||||
|
for release in list_releases(api, base):
|
||||||
|
if (
|
||||||
|
release.get("draft") is not False
|
||||||
|
or not isinstance(release.get("published_at"), str)
|
||||||
|
or not release["published_at"]
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
tag = release.get("tag_name")
|
||||||
|
match = (
|
||||||
|
RELEASE_TAG_VERSION.fullmatch(tag)
|
||||||
|
if isinstance(tag, str)
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
if match is not None:
|
||||||
|
released_versions.append(
|
||||||
|
(int(match.group(1)), int(match.group(2)), int(match.group(3)))
|
||||||
|
)
|
||||||
|
|
||||||
|
if released_versions:
|
||||||
|
major, minor, patch = max(released_versions)
|
||||||
|
patch += 1
|
||||||
|
else:
|
||||||
|
major, minor, patch = cmake_project_version(arguments.cmake_file)
|
||||||
|
version = (
|
||||||
|
f"{major}.{minor}.{patch}-nightly."
|
||||||
|
f"{arguments.date_id}.{arguments.run_number}"
|
||||||
|
)
|
||||||
|
print(version)
|
||||||
|
|
||||||
|
|
||||||
def parser() -> argparse.ArgumentParser:
|
def parser() -> argparse.ArgumentParser:
|
||||||
result = argparse.ArgumentParser(description=__doc__)
|
result = argparse.ArgumentParser(description=__doc__)
|
||||||
result.add_argument("--api-url", required=True)
|
result.add_argument("--api-url", required=True)
|
||||||
@@ -588,6 +702,11 @@ def parser() -> argparse.ArgumentParser:
|
|||||||
body_group.add_argument("--body-file", type=Path)
|
body_group.add_argument("--body-file", type=Path)
|
||||||
publish_parser.add_argument("--artifacts", type=Path, required=True)
|
publish_parser.add_argument("--artifacts", type=Path, required=True)
|
||||||
publish_parser.add_argument("--prerelease", action="store_true")
|
publish_parser.add_argument("--prerelease", action="store_true")
|
||||||
|
publish_parser.add_argument(
|
||||||
|
"--allow-missing-draft-tag",
|
||||||
|
action="store_true",
|
||||||
|
help="declare that a nightly-* tag may be created with its verified draft",
|
||||||
|
)
|
||||||
|
|
||||||
prune_parser = subparsers.add_parser("prune-nightlies")
|
prune_parser = subparsers.add_parser("prune-nightlies")
|
||||||
prune_parser.add_argument("--owner", required=True)
|
prune_parser.add_argument("--owner", required=True)
|
||||||
@@ -600,6 +719,13 @@ def parser() -> argparse.ArgumentParser:
|
|||||||
protection_parser.add_argument("--owner", required=True)
|
protection_parser.add_argument("--owner", required=True)
|
||||||
protection_parser.add_argument("--repo", required=True)
|
protection_parser.add_argument("--repo", required=True)
|
||||||
protection_parser.add_argument("--required-pattern", default="v*")
|
protection_parser.add_argument("--required-pattern", default="v*")
|
||||||
|
|
||||||
|
nightly_version_parser = subparsers.add_parser("derive-nightly-version")
|
||||||
|
nightly_version_parser.add_argument("--owner", required=True)
|
||||||
|
nightly_version_parser.add_argument("--repo", required=True)
|
||||||
|
nightly_version_parser.add_argument("--cmake-file", type=Path, required=True)
|
||||||
|
nightly_version_parser.add_argument("--date-id", required=True)
|
||||||
|
nightly_version_parser.add_argument("--run-number", required=True)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@@ -621,8 +747,10 @@ def main() -> None:
|
|||||||
publish(arguments, api)
|
publish(arguments, api)
|
||||||
elif arguments.command == "prune-nightlies":
|
elif arguments.command == "prune-nightlies":
|
||||||
prune_nightlies(arguments, api)
|
prune_nightlies(arguments, api)
|
||||||
else:
|
elif arguments.command == "verify-tag-protection":
|
||||||
verify_tag_protection(arguments, api)
|
verify_tag_protection(arguments, api)
|
||||||
|
else:
|
||||||
|
derive_nightly_version(arguments, api)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
+16
-3
@@ -382,6 +382,12 @@ cmake --install "$build_dir" \
|
|||||||
--component Runtime \
|
--component Runtime \
|
||||||
--prefix "$stage"
|
--prefix "$stage"
|
||||||
|
|
||||||
|
certificate_bundle=${ECHOION_CA_BUNDLE:-/etc/ssl/certs/ca-certificates.crt}
|
||||||
|
[[ -s $certificate_bundle ]] ||
|
||||||
|
die "TLS certificate bundle is missing or empty: $certificate_bundle"
|
||||||
|
install -D -m 0644 -- "$certificate_bundle" \
|
||||||
|
"$stage/share/echoion/certs/ca-certificates.crt"
|
||||||
|
|
||||||
mapfile -t library_directories < <(
|
mapfile -t library_directories < <(
|
||||||
find "$build_dir" -type f \( -name '*.so' -o -name '*.so.*' -o -name '*.ts' \) \
|
find "$build_dir" -type f \( -name '*.so' -o -name '*.so.*' -o -name '*.ts' \) \
|
||||||
-printf '%h\n' | LC_ALL=C sort -u
|
-printf '%h\n' | LC_ALL=C sort -u
|
||||||
@@ -420,11 +426,12 @@ cmake \
|
|||||||
-P "$source_dir/cmake/BundleRuntimeDependencies.cmake"
|
-P "$source_dir/cmake/BundleRuntimeDependencies.cmake"
|
||||||
|
|
||||||
# Bootstrap plugins are copied into writable managed-plugin state by the
|
# Bootstrap plugins are copied into writable managed-plugin state by the
|
||||||
# installer. Services and the portable launcher point the loader at current/lib;
|
# installer. Search the active release closure from managed, portable/manual,
|
||||||
# this relative path also keeps the immutable source artifact directly usable.
|
# and immutable bootstrap locations, then allow plugin-private dependencies.
|
||||||
|
plugin_runpath='$ORIGIN/../../../../../../current/lib:$ORIGIN/../../current/lib:$ORIGIN/lib'
|
||||||
for plugin_library in "${resolver_libraries[@]:1}"; do
|
for plugin_library in "${resolver_libraries[@]:1}"; do
|
||||||
# shellcheck disable=SC2016 # Dynamic linker token, not a shell variable.
|
# shellcheck disable=SC2016 # Dynamic linker token, not a shell variable.
|
||||||
patchelf --set-rpath '$ORIGIN/../../../../../lib' "$plugin_library"
|
patchelf --set-rpath "$plugin_runpath" "$plugin_library"
|
||||||
done
|
done
|
||||||
|
|
||||||
dependency_report="$build_dir/dependency-report.txt"
|
dependency_report="$build_dir/dependency-report.txt"
|
||||||
@@ -513,6 +520,12 @@ collect_licenses() {
|
|||||||
-printf '%f\n' | LC_ALL=C sort -u
|
-printf '%f\n' | LC_ALL=C sort -u
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
candidate=/usr/share/doc/ca-certificates/copyright
|
||||||
|
if [[ -f $candidate ]]; then
|
||||||
|
install -m 0644 -- "$candidate" \
|
||||||
|
"$destination/ca-certificates--copyright"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
collect_licenses "$stage/share/echoion/licenses"
|
collect_licenses "$stage/share/echoion/licenses"
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ if (
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
git -C "$repository" tag lightweight "$target_commit"
|
git -C "$repository" tag lightweight "$target_commit"
|
||||||
|
lightweight_error="$temporary/lightweight-error.txt"
|
||||||
if (
|
if (
|
||||||
cd "$repository"
|
cd "$repository"
|
||||||
"$verifier" \
|
"$verifier" \
|
||||||
@@ -94,10 +95,13 @@ if (
|
|||||||
--event-sha "$target_commit" \
|
--event-sha "$target_commit" \
|
||||||
--allowed-signers "$temporary/allowed-signers" \
|
--allowed-signers "$temporary/allowed-signers" \
|
||||||
--notes-output "$temporary/lightweight-notes.md" \
|
--notes-output "$temporary/lightweight-notes.md" \
|
||||||
>/dev/null 2>&1
|
>/dev/null 2>"$lightweight_error"
|
||||||
); then
|
); then
|
||||||
printf '%s\n' 'lightweight tag was accepted' >&2
|
printf '%s\n' 'lightweight tag was accepted' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
grep -Fqx \
|
||||||
|
'verify-gitea-release-tag: lightweight tags are not allowed; create a signed annotated tag' \
|
||||||
|
"$lightweight_error"
|
||||||
|
|
||||||
printf '%s\n' 'Gitea signed-tag verification tests passed'
|
printf '%s\n' 'Gitea signed-tag verification tests passed'
|
||||||
@@ -63,6 +63,7 @@ mkdir -p \
|
|||||||
"$bundle/bin" \
|
"$bundle/bin" \
|
||||||
"$bundle/lib" \
|
"$bundle/lib" \
|
||||||
"$bundle/service" \
|
"$bundle/service" \
|
||||||
|
"$bundle/share/echoion/certs" \
|
||||||
"$bundle/share/echoion/web" \
|
"$bundle/share/echoion/web" \
|
||||||
"$bundle/share/echoion/tools"
|
"$bundle/share/echoion/tools"
|
||||||
install -m 0755 /bin/true "$bundle/bin/echoiond"
|
install -m 0755 /bin/true "$bundle/bin/echoiond"
|
||||||
@@ -74,6 +75,8 @@ printf '%s\n' '[Service]' >"$bundle/service/echoion.service.in"
|
|||||||
printf '%s\n' '[Service]' >"$bundle/service/echoion-updater.service.in"
|
printf '%s\n' '[Service]' >"$bundle/service/echoion-updater.service.in"
|
||||||
printf '%s\n' '[Timer]' >"$bundle/service/echoion-updater.timer.in"
|
printf '%s\n' '[Timer]' >"$bundle/service/echoion-updater.timer.in"
|
||||||
printf '%s\n' '{}' >"$bundle/share/echoion/config.example.json"
|
printf '%s\n' '{}' >"$bundle/share/echoion/config.example.json"
|
||||||
|
printf '%s\n' 'test trust bundle' \
|
||||||
|
>"$bundle/share/echoion/certs/ca-certificates.crt"
|
||||||
install -m 0755 "$source_root/scripts/validate-release-manifest.py" \
|
install -m 0755 "$source_root/scripts/validate-release-manifest.py" \
|
||||||
"$bundle/share/echoion/tools/validate-release-manifest.py"
|
"$bundle/share/echoion/tools/validate-release-manifest.py"
|
||||||
ln -s Echoion.ts "$bundle/lib/Echoion-current.ts"
|
ln -s Echoion.ts "$bundle/lib/Echoion-current.ts"
|
||||||
@@ -117,6 +120,7 @@ assert manifest["core"] == "lib/Echoion.ts"
|
|||||||
paths = [entry["path"] for entry in manifest["files"]]
|
paths = [entry["path"] for entry in manifest["files"]]
|
||||||
assert paths == sorted(paths)
|
assert paths == sorted(paths)
|
||||||
assert "share/echoion/web/index.html" in paths
|
assert "share/echoion/web/index.html" in paths
|
||||||
|
assert "share/echoion/certs/ca-certificates.crt" in paths
|
||||||
link = next(entry for entry in manifest["files"] if entry["path"].endswith("current.ts"))
|
link = next(entry for entry in manifest["files"] if entry["path"].endswith("current.ts"))
|
||||||
assert link == {
|
assert link == {
|
||||||
"path": "lib/Echoion-current.ts",
|
"path": "lib/Echoion-current.ts",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ if [[ $# != 1 ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
source_root=$(realpath -e -- "$1")
|
source_root=$(realpath -e -- "$1")
|
||||||
for command_name in cmake patchelf readelf python3; do
|
for command_name in cmake ldd patchelf readelf python3; do
|
||||||
command -v "$command_name" >/dev/null || {
|
command -v "$command_name" >/dev/null || {
|
||||||
echo "missing test command: $command_name" >&2
|
echo "missing test command: $command_name" >&2
|
||||||
exit 2
|
exit 2
|
||||||
@@ -147,7 +147,8 @@ cmake \
|
|||||||
"-DBUNDLE_SEED_FILES=$seed_lib/libstdc++.so.6" \
|
"-DBUNDLE_SEED_FILES=$seed_lib/libstdc++.so.6" \
|
||||||
"-DPATCHELF_EXECUTABLE=$(command -v patchelf)" \
|
"-DPATCHELF_EXECUTABLE=$(command -v patchelf)" \
|
||||||
-P "$source_root/cmake/BundleRuntimeDependencies.cmake"
|
-P "$source_root/cmake/BundleRuntimeDependencies.cmake"
|
||||||
patchelf --set-rpath "\$ORIGIN/../../../../../lib" "$bundle_plugin"
|
plugin_runpath="\$ORIGIN/../../../../../../current/lib:\$ORIGIN/../../current/lib:\$ORIGIN/lib"
|
||||||
|
patchelf --set-rpath "$plugin_runpath" "$bundle_plugin"
|
||||||
|
|
||||||
python3 - "$source_root/scripts/validate-release-elf.py" <<'PY'
|
python3 - "$source_root/scripts/validate-release-elf.py" <<'PY'
|
||||||
import importlib.util
|
import importlib.util
|
||||||
@@ -230,8 +231,38 @@ if python3 "$source_root/scripts/validate-release-elf.py" \
|
|||||||
fi
|
fi
|
||||||
grep -F $'NEEDED\tlib/Echoion.ts\tlibechoion-dependency.so.1\tbundled' "$report"
|
grep -F $'NEEDED\tlib/Echoion.ts\tlibechoion-dependency.so.1\tbundled' "$report"
|
||||||
grep -F $'NEEDED\tbin/echoiond\tlibc.so.6\tsystem' "$report"
|
grep -F $'NEEDED\tbin/echoiond\tlibc.so.6\tsystem' "$report"
|
||||||
grep -F $'ELF\tshare/echoion/bootstrap-plugins/fixture-shortener/1.0.0/fixture-shortener.so\tRUNPATH=$ORIGIN/../../../../../lib' "$report"
|
grep -F \
|
||||||
|
$'ELF\tshare/echoion/bootstrap-plugins/fixture-shortener/1.0.0/fixture-shortener.so\tRUNPATH=$ORIGIN/../../../../../../current/lib:$ORIGIN/../../current/lib:$ORIGIN/lib' \
|
||||||
|
"$report"
|
||||||
grep -F $'NEEDED\tshare/echoion/bootstrap-plugins/fixture-shortener/1.0.0/fixture-shortener.so\tlibechoion-dependency.so.1\tbundled' "$report"
|
grep -F $'NEEDED\tshare/echoion/bootstrap-plugins/fixture-shortener/1.0.0/fixture-shortener.so\tlibechoion-dependency.so.1\tbundled' "$report"
|
||||||
|
|
||||||
|
installed="$temporary/installed"
|
||||||
|
managed_plugin="$installed/state/plugins/.managed/fixture-shortener/versions/1.0.0/fixture-shortener.so"
|
||||||
|
portable_plugin="$installed/state/plugins/fixture-shortener.so"
|
||||||
|
mkdir -p "$installed/current/lib" "$(dirname -- "$managed_plugin")" \
|
||||||
|
"$(dirname -- "$portable_plugin")"
|
||||||
|
cp -a "$bundle/lib/." "$installed/current/lib/"
|
||||||
|
cp "$bundle_plugin" "$managed_plugin"
|
||||||
|
cp "$bundle_plugin" "$portable_plugin"
|
||||||
|
for installed_plugin in "$managed_plugin" "$portable_plugin"; do
|
||||||
|
ldd_report="$temporary/$(basename -- "$(dirname -- "$installed_plugin")").ldd"
|
||||||
|
env -u LD_LIBRARY_PATH ldd "$installed_plugin" >"$ldd_report" 2>&1
|
||||||
|
resolved_dependency=$(awk '
|
||||||
|
$1 == "libechoion-dependency.so.1" && $2 == "=>" {
|
||||||
|
print $3
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
' "$ldd_report")
|
||||||
|
[[ -n $resolved_dependency ]]
|
||||||
|
[[ $(realpath -e -- "$resolved_dependency") == \
|
||||||
|
$(realpath -e -- "$installed/current/lib/libechoion-dependency.so.1") ]]
|
||||||
|
if grep -Fq 'not found' "$ldd_report"; then
|
||||||
|
echo "installed plugin did not resolve its bundled dependency closure" >&2
|
||||||
|
cat "$ldd_report" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if python3 "$source_root/scripts/validate-release-elf.py" \
|
if python3 "$source_root/scripts/validate-release-elf.py" \
|
||||||
--root "$bundle" \
|
--root "$bundle" \
|
||||||
--forbid-content-prefix /tmp/echoion-plugin-forbidden-build-path \
|
--forbid-content-prefix /tmp/echoion-plugin-forbidden-build-path \
|
||||||
@@ -266,7 +297,7 @@ if python3 "$source_root/scripts/validate-release-elf.py" \
|
|||||||
echo "incorrect bootstrap plugin RUNPATH unexpectedly passed validation" >&2
|
echo "incorrect bootstrap plugin RUNPATH unexpectedly passed validation" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
patchelf --set-rpath "\$ORIGIN/../../../../../lib" "$bundle_plugin"
|
patchelf --set-rpath "$plugin_runpath" "$bundle_plugin"
|
||||||
|
|
||||||
patchelf --set-rpath /tmp/unsafe-build-path "$bundle/lib/Echoion.ts"
|
patchelf --set-rpath /tmp/unsafe-build-path "$bundle/lib/Echoion.ts"
|
||||||
if python3 "$source_root/scripts/validate-release-elf.py" \
|
if python3 "$source_root/scripts/validate-release-elf.py" \
|
||||||
|
|||||||
@@ -22,9 +22,11 @@ SCRIPT = SOURCE_ROOT / "scripts" / "gitea_release.py"
|
|||||||
class State:
|
class State:
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.releases: dict[int, dict] = {}
|
self.releases: dict[int, dict] = {}
|
||||||
|
self.tags: dict[str, str] = {}
|
||||||
self.assets: dict[int, bytes] = {}
|
self.assets: dict[int, bytes] = {}
|
||||||
self.next_release = 1
|
self.next_release = 1
|
||||||
self.next_asset = 1
|
self.next_asset = 1
|
||||||
|
self.tag_creations = 0
|
||||||
self.uploads = 0
|
self.uploads = 0
|
||||||
self.upload_attempts = 0
|
self.upload_attempts = 0
|
||||||
self.fail_upload_attempt: int | None = None
|
self.fail_upload_attempt: int | None = None
|
||||||
@@ -108,16 +110,15 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
)
|
)
|
||||||
if repository_tag_match:
|
if repository_tag_match:
|
||||||
tag = unquote(repository_tag_match.group(1))
|
tag = unquote(repository_tag_match.group(1))
|
||||||
for release in self.server.state.releases.values():
|
if tag in self.server.state.tags:
|
||||||
if release["tag_name"] == tag:
|
self.json_response(
|
||||||
self.json_response(
|
200,
|
||||||
200,
|
{
|
||||||
{
|
"name": tag,
|
||||||
"name": tag,
|
"commit": {"sha": self.server.state.tags[tag]},
|
||||||
"commit": {"sha": release["target_commitish"]},
|
},
|
||||||
},
|
)
|
||||||
)
|
return
|
||||||
return
|
|
||||||
self.json_response(404, {"message": "not found"})
|
self.json_response(404, {"message": "not found"})
|
||||||
return
|
return
|
||||||
release_match = re.fullmatch(
|
release_match = re.fullmatch(
|
||||||
@@ -200,8 +201,15 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
self.json_response(404, {"message": "unknown route"})
|
self.json_response(404, {"message": "unknown route"})
|
||||||
return
|
return
|
||||||
release_id = int(match.group(1))
|
release_id = int(match.group(1))
|
||||||
self.server.state.releases[release_id].update(self.read_json())
|
release = self.server.state.releases[release_id]
|
||||||
if not self.server.state.releases[release_id]["draft"]:
|
document = self.read_json()
|
||||||
|
if release["draft"] and document.get("draft") is False:
|
||||||
|
tag = release["tag_name"]
|
||||||
|
if tag not in self.server.state.tags:
|
||||||
|
self.server.state.tags[tag] = document["target_commitish"]
|
||||||
|
self.server.state.tag_creations += 1
|
||||||
|
release.update(document)
|
||||||
|
if not release["draft"]:
|
||||||
self.server.state.releases[release_id]["published_at"] = (
|
self.server.state.releases[release_id]["published_at"] = (
|
||||||
"2026-07-22T00:00:00Z"
|
"2026-07-22T00:00:00Z"
|
||||||
)
|
)
|
||||||
@@ -215,6 +223,11 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
r"/api/v1/repos/Void/Echoion/tags/(.+)", target.path
|
r"/api/v1/repos/Void/Echoion/tags/(.+)", target.path
|
||||||
)
|
)
|
||||||
if tag_match:
|
if tag_match:
|
||||||
|
tag = unquote(tag_match.group(1))
|
||||||
|
if tag not in self.server.state.tags:
|
||||||
|
self.empty_response(404)
|
||||||
|
return
|
||||||
|
del self.server.state.tags[tag]
|
||||||
self.empty_response(204)
|
self.empty_response(204)
|
||||||
return
|
return
|
||||||
asset_match = re.fullmatch(
|
asset_match = re.fullmatch(
|
||||||
@@ -314,6 +327,9 @@ class GiteaReleaseTest(unittest.TestCase):
|
|||||||
"--artifacts",
|
"--artifacts",
|
||||||
os.fspath(artifacts),
|
os.fspath(artifacts),
|
||||||
)
|
)
|
||||||
|
self.server.state.tags["v1.2.3"] = (
|
||||||
|
"0123456789abcdef0123456789abcdef01234567"
|
||||||
|
)
|
||||||
self.run_script(*arguments)
|
self.run_script(*arguments)
|
||||||
self.assertFalse(self.server.state.releases[1]["draft"])
|
self.assertFalse(self.server.state.releases[1]["draft"])
|
||||||
self.assertEqual(self.server.state.uploads, 2)
|
self.assertEqual(self.server.state.uploads, 2)
|
||||||
@@ -329,6 +345,124 @@ class GiteaReleaseTest(unittest.TestCase):
|
|||||||
self.assertIn("download verification failed", failed.stderr)
|
self.assertIn("download verification failed", failed.stderr)
|
||||||
self.assertEqual(self.server.state.uploads, 2)
|
self.assertEqual(self.server.state.uploads, 2)
|
||||||
|
|
||||||
|
def test_publish_creates_a_missing_nightly_tag_idempotently(self) -> None:
|
||||||
|
artifacts = Path(self.temporary.name, "artifacts")
|
||||||
|
artifacts.mkdir()
|
||||||
|
Path(artifacts, "nightly.bin").write_bytes(b"nightly")
|
||||||
|
target = "23456789abcdef0123456789abcdef0123456789"
|
||||||
|
arguments = (
|
||||||
|
"publish",
|
||||||
|
"--owner",
|
||||||
|
"Void",
|
||||||
|
"--repo",
|
||||||
|
"Echoion",
|
||||||
|
"--tag",
|
||||||
|
"nightly-20260726-13",
|
||||||
|
"--target",
|
||||||
|
target,
|
||||||
|
"--name",
|
||||||
|
"Echoion nightly",
|
||||||
|
"--artifacts",
|
||||||
|
os.fspath(artifacts),
|
||||||
|
"--prerelease",
|
||||||
|
)
|
||||||
|
|
||||||
|
self.run_script(*arguments)
|
||||||
|
self.assertEqual(
|
||||||
|
self.server.state.tags["nightly-20260726-13"],
|
||||||
|
target,
|
||||||
|
)
|
||||||
|
self.assertEqual(self.server.state.tag_creations, 1)
|
||||||
|
self.run_script(*arguments)
|
||||||
|
self.assertEqual(self.server.state.tag_creations, 1)
|
||||||
|
|
||||||
|
def test_publish_requires_an_existing_tag_by_default(self) -> None:
|
||||||
|
artifacts = Path(self.temporary.name, "artifacts")
|
||||||
|
artifacts.mkdir()
|
||||||
|
Path(artifacts, "stable.bin").write_bytes(b"stable")
|
||||||
|
failed = self.run_script(
|
||||||
|
"publish",
|
||||||
|
"--owner",
|
||||||
|
"Void",
|
||||||
|
"--repo",
|
||||||
|
"Echoion",
|
||||||
|
"--tag",
|
||||||
|
"v9.9.9",
|
||||||
|
"--target",
|
||||||
|
"3456789abcdef0123456789abcdef0123456789a",
|
||||||
|
"--name",
|
||||||
|
"Echoion 9.9.9",
|
||||||
|
"--artifacts",
|
||||||
|
os.fspath(artifacts),
|
||||||
|
check=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertNotEqual(failed.returncode, 0)
|
||||||
|
self.assertIn("release tag does not exist", failed.stderr)
|
||||||
|
self.assertFalse(self.server.state.releases)
|
||||||
|
self.assertFalse(self.server.state.tags)
|
||||||
|
|
||||||
|
def test_missing_tag_exception_is_restricted_to_nightlies(self) -> None:
|
||||||
|
artifacts = Path(self.temporary.name, "artifacts")
|
||||||
|
artifacts.mkdir()
|
||||||
|
Path(artifacts, "beta.bin").write_bytes(b"beta")
|
||||||
|
failed = self.run_script(
|
||||||
|
"publish",
|
||||||
|
"--owner",
|
||||||
|
"Void",
|
||||||
|
"--repo",
|
||||||
|
"Echoion",
|
||||||
|
"--tag",
|
||||||
|
"v9.9.9-beta.1",
|
||||||
|
"--target",
|
||||||
|
"456789abcdef0123456789abcdef0123456789ab",
|
||||||
|
"--name",
|
||||||
|
"Echoion 9.9.9 beta 1",
|
||||||
|
"--artifacts",
|
||||||
|
os.fspath(artifacts),
|
||||||
|
"--allow-missing-draft-tag",
|
||||||
|
"--prerelease",
|
||||||
|
check=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertNotEqual(failed.returncode, 0)
|
||||||
|
self.assertIn("restricted to nightly-*", failed.stderr)
|
||||||
|
self.assertFalse(self.server.state.releases)
|
||||||
|
self.assertFalse(self.server.state.tags)
|
||||||
|
|
||||||
|
def test_publish_never_moves_an_existing_tag(self) -> None:
|
||||||
|
artifacts = Path(self.temporary.name, "artifacts")
|
||||||
|
artifacts.mkdir()
|
||||||
|
Path(artifacts, "nightly.bin").write_bytes(b"nightly")
|
||||||
|
tag = "nightly-20260726-14"
|
||||||
|
existing_target = "456789abcdef0123456789abcdef0123456789ab"
|
||||||
|
requested_target = "56789abcdef0123456789abcdef0123456789abc"
|
||||||
|
self.server.state.tags[tag] = existing_target
|
||||||
|
|
||||||
|
failed = self.run_script(
|
||||||
|
"publish",
|
||||||
|
"--owner",
|
||||||
|
"Void",
|
||||||
|
"--repo",
|
||||||
|
"Echoion",
|
||||||
|
"--tag",
|
||||||
|
tag,
|
||||||
|
"--target",
|
||||||
|
requested_target,
|
||||||
|
"--name",
|
||||||
|
"Echoion nightly",
|
||||||
|
"--artifacts",
|
||||||
|
os.fspath(artifacts),
|
||||||
|
"--allow-missing-draft-tag",
|
||||||
|
"--prerelease",
|
||||||
|
check=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertNotEqual(failed.returncode, 0)
|
||||||
|
self.assertIn("tag does not target", failed.stderr)
|
||||||
|
self.assertEqual(self.server.state.tags[tag], existing_target)
|
||||||
|
self.assertFalse(self.server.state.releases)
|
||||||
|
|
||||||
def test_prune_keeps_fourteen_newest_nightlies(self) -> None:
|
def test_prune_keeps_fourteen_newest_nightlies(self) -> None:
|
||||||
for index in range(1, 17):
|
for index in range(1, 17):
|
||||||
self.server.state.releases[index] = {
|
self.server.state.releases[index] = {
|
||||||
@@ -404,6 +538,9 @@ class GiteaReleaseTest(unittest.TestCase):
|
|||||||
"--artifacts",
|
"--artifacts",
|
||||||
os.fspath(artifacts),
|
os.fspath(artifacts),
|
||||||
)
|
)
|
||||||
|
self.server.state.tags["v2.0.0"] = (
|
||||||
|
"89abcdef0123456789abcdef0123456789abcdef"
|
||||||
|
)
|
||||||
self.server.state.fail_upload_attempt = 2
|
self.server.state.fail_upload_attempt = 2
|
||||||
failed = self.run_script(*arguments, check=False)
|
failed = self.run_script(*arguments, check=False)
|
||||||
self.assertNotEqual(failed.returncode, 0)
|
self.assertNotEqual(failed.returncode, 0)
|
||||||
@@ -442,6 +579,106 @@ class GiteaReleaseTest(unittest.TestCase):
|
|||||||
self.assertNotEqual(rejected.returncode, 0)
|
self.assertNotEqual(rejected.returncode, 0)
|
||||||
self.assertIn("empty allowlist", rejected.stderr)
|
self.assertIn("empty allowlist", rejected.stderr)
|
||||||
|
|
||||||
|
def test_nightly_version_uses_next_patch_after_published_release(self) -> None:
|
||||||
|
cmake_file = Path(self.temporary.name, "CMakeLists.txt")
|
||||||
|
cmake_file.write_text(
|
||||||
|
"project(Echoion VERSION 1.0.0 LANGUAGES CXX)\n",
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
|
releases = [
|
||||||
|
("v1.9.9", False, "2026-07-20T00:00:00Z"),
|
||||||
|
("v2.4.0-beta.1", False, "2026-07-19T00:00:00Z"),
|
||||||
|
("v9.0.0", True, None),
|
||||||
|
("nightly-20260726-16", False, "2026-07-26T00:00:00Z"),
|
||||||
|
]
|
||||||
|
for release_id, (tag, draft, published_at) in enumerate(releases, 1):
|
||||||
|
self.server.state.releases[release_id] = {
|
||||||
|
"id": release_id,
|
||||||
|
"tag_name": tag,
|
||||||
|
"target_commitish": "0123456789abcdef0123456789abcdef01234567",
|
||||||
|
"name": tag,
|
||||||
|
"body": "",
|
||||||
|
"prerelease": "-" in tag,
|
||||||
|
"draft": draft,
|
||||||
|
"assets": [],
|
||||||
|
"created_at": f"2026-07-{release_id:02d}T00:00:00Z",
|
||||||
|
"published_at": published_at,
|
||||||
|
}
|
||||||
|
|
||||||
|
completed = self.run_script(
|
||||||
|
"derive-nightly-version",
|
||||||
|
"--owner",
|
||||||
|
"Void",
|
||||||
|
"--repo",
|
||||||
|
"Echoion",
|
||||||
|
"--cmake-file",
|
||||||
|
os.fspath(cmake_file),
|
||||||
|
"--date-id",
|
||||||
|
"20260726",
|
||||||
|
"--run-number",
|
||||||
|
"17",
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
completed.stdout.strip(),
|
||||||
|
"2.4.1-nightly.20260726.17",
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_nightly_version_falls_back_to_root_cmake_version(self) -> None:
|
||||||
|
cmake_file = Path(self.temporary.name, "CMakeLists.txt")
|
||||||
|
cmake_file.write_text(
|
||||||
|
"cmake_minimum_required(VERSION 4.0)\n"
|
||||||
|
"project(\n"
|
||||||
|
" Echoion\n"
|
||||||
|
" VERSION 3.2.1\n"
|
||||||
|
" LANGUAGES CXX\n"
|
||||||
|
")\n",
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
|
self.server.state.releases[1] = {
|
||||||
|
"id": 1,
|
||||||
|
"tag_name": "nightly-20260726-16",
|
||||||
|
"target_commitish": "0123456789abcdef0123456789abcdef01234567",
|
||||||
|
"name": "nightly",
|
||||||
|
"body": "",
|
||||||
|
"prerelease": True,
|
||||||
|
"draft": False,
|
||||||
|
"assets": [],
|
||||||
|
"created_at": "2026-07-26T00:00:00Z",
|
||||||
|
"published_at": "2026-07-26T00:00:00Z",
|
||||||
|
}
|
||||||
|
self.server.state.releases[2] = {
|
||||||
|
"id": 2,
|
||||||
|
"tag_name": "v9.0.0",
|
||||||
|
"target_commitish": "0123456789abcdef0123456789abcdef01234567",
|
||||||
|
"name": "failed draft",
|
||||||
|
"body": "",
|
||||||
|
"prerelease": False,
|
||||||
|
"draft": True,
|
||||||
|
"assets": [],
|
||||||
|
"created_at": "2026-07-26T00:00:00Z",
|
||||||
|
"published_at": None,
|
||||||
|
}
|
||||||
|
|
||||||
|
completed = self.run_script(
|
||||||
|
"derive-nightly-version",
|
||||||
|
"--owner",
|
||||||
|
"Void",
|
||||||
|
"--repo",
|
||||||
|
"Echoion",
|
||||||
|
"--cmake-file",
|
||||||
|
os.fspath(cmake_file),
|
||||||
|
"--date-id",
|
||||||
|
"20260727",
|
||||||
|
"--run-number",
|
||||||
|
"18",
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
completed.stdout.strip(),
|
||||||
|
"3.2.1-nightly.20260727.18",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
@@ -44,7 +44,11 @@ PLUGIN_VERSION_PATTERN = re.compile(
|
|||||||
r"(?:-(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)"
|
r"(?:-(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)"
|
||||||
r"(?:\.(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*)?$"
|
r"(?:\.(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*)?$"
|
||||||
)
|
)
|
||||||
PLUGIN_RUNPATH = "$ORIGIN/../../../../../lib"
|
PLUGIN_RUNPATH = (
|
||||||
|
"$ORIGIN/../../../../../../current/lib:"
|
||||||
|
"$ORIGIN/../../current/lib:"
|
||||||
|
"$ORIGIN/lib"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def parse_version(value: str) -> tuple[int, ...]:
|
def parse_version(value: str) -> tuple[int, ...]:
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ def load_and_validate(root: Path, expected_version: str | None = None) -> dict:
|
|||||||
"core": "lib/Echoion.ts",
|
"core": "lib/Echoion.ts",
|
||||||
"web dashboard": "share/echoion/web/index.html",
|
"web dashboard": "share/echoion/web/index.html",
|
||||||
"configuration template": "share/echoion/config.example.json",
|
"configuration template": "share/echoion/config.example.json",
|
||||||
|
"TLS trust bundle": "share/echoion/certs/ca-certificates.crt",
|
||||||
"manifest validator": "share/echoion/tools/validate-release-manifest.py",
|
"manifest validator": "share/echoion/tools/validate-release-manifest.py",
|
||||||
"service template": "service/echoion.service.in",
|
"service template": "service/echoion.service.in",
|
||||||
"updater service template": "service/echoion-updater.service.in",
|
"updater service template": "service/echoion-updater.service.in",
|
||||||
|
|||||||
@@ -66,7 +66,17 @@ if [[ ! -f "$allowed_signers" || -L "$allowed_signers" ||
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
tag_ref="refs/tags/$tag"
|
tag_ref="refs/tags/$tag"
|
||||||
tag_object=$(git rev-parse --verify "$tag_ref^{tag}")
|
if ! tag_object=$(git rev-parse --verify "$tag_ref"); then
|
||||||
|
printf '%s\n' \
|
||||||
|
'verify-gitea-release-tag: tag ref does not exist' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ "$(git cat-file -t "$tag_object")" != tag ]]; then
|
||||||
|
printf '%s\n' \
|
||||||
|
'verify-gitea-release-tag: lightweight tags are not allowed; create a signed annotated tag' \
|
||||||
|
>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
tag_target=$(
|
tag_target=$(
|
||||||
git cat-file tag "$tag_object" |
|
git cat-file tag "$tag_object" |
|
||||||
sed -n '1s/^object //p'
|
sed -n '1s/^object //p'
|
||||||
|
|||||||
Reference in new issue
Block a user