Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f78004e822 | ||
|
|
8c69efc56f |
No files matched your search
+34
-6
@@ -47,7 +47,7 @@ Never work around a rotation by disabling strict host-key checking.
|
||||
The Docker-capable runner executes only protected `main` pushes, manual runs,
|
||||
scheduled nightlies, and signed release tags. The container CI workflow does
|
||||
not run for pull requests because contributor-controlled scripts must not
|
||||
receive a privileged Docker socket or the private-submodule checkout key. If
|
||||
receive a privileged Docker socket or release checkout credentials. If
|
||||
pre-merge CI is required, register a separate ephemeral `echoion-pr` runner
|
||||
without release secrets or host-level Docker access and give it a dedicated
|
||||
workflow. A global runner such as the default installation shown in Gitea must
|
||||
@@ -58,14 +58,42 @@ Enable Actions and add these repository secrets:
|
||||
|
||||
| Secret | Purpose |
|
||||
| --- | --- |
|
||||
| `RELEASE_CHECKOUT_SSH_KEY` | Read-only deploy key that can clone every private nested repository in `.gitmodules`. |
|
||||
| `RELEASE_BOT_TOKEN` | PAT owned by a dedicated bot, limited to writing releases, tags, and the `release-feed` branch in this repository. |
|
||||
| `RELEASE_CHECKOUT_SSH_KEY` | Read-only key used for the root checkout. |
|
||||
| `RELEASE_BOT_TOKEN` | PAT owned by a dedicated bot. It needs read access to the component repositories plus release/tag and `release-feed` write access in this repository. |
|
||||
| `RELEASE_TAG_ALLOWED_SIGNERS` | Complete OpenSSH `allowed_signers` lines for maintainers allowed to publish `v*` tags. |
|
||||
| `RELEASE_FEED_ED25519_PRIVATE_KEY` | PEM private key matching `release-keys/echoion-release-2026-07.pub.pem`. Preserve its newlines. |
|
||||
|
||||
The release PAT must not be shared with checkout of nested repositories. The
|
||||
feed signing key must not be stored in Git, runner images, Actions variables,
|
||||
or release assets.
|
||||
Component checkouts use the release PAT with `persist-credentials: false`, so
|
||||
the credential is removed before repository scripts run. The feed signing key
|
||||
must not be stored in Git, runner images, Actions variables, or release assets.
|
||||
|
||||
## Independent component repositories
|
||||
|
||||
Echoion does not use Git submodules. `components.lock.json` is the immutable
|
||||
checkout manifest for `EchoionApi`, `EchoionCore`, and `EchoionDesktop`. CMake
|
||||
uses a component already present beside the root checkout; otherwise it fetches
|
||||
the locked revision. All three Gitea workflows check out those revisions as
|
||||
ordinary repositories before entering Docker.
|
||||
|
||||
For a new developer checkout:
|
||||
|
||||
```bash
|
||||
python3 scripts/sync-components.py
|
||||
```
|
||||
|
||||
After changing a component, commit and push that component first, then refresh
|
||||
and commit the root lock:
|
||||
|
||||
```bash
|
||||
python3 scripts/sync-components.py --record
|
||||
git add components.lock.json
|
||||
```
|
||||
|
||||
`--record` refuses dirty component repositories, so a lock can never point at
|
||||
uncommitted source. `--update` moves existing clean component checkouts to the
|
||||
locked revisions. Product version changes are separate: edit only
|
||||
`project(Echoion VERSION ...)` in root `CMakeLists.txt`; orchestrated component
|
||||
builds and release overrides inherit that value.
|
||||
|
||||
Create an orphan `release-feed` branch containing a tracked `feeds/`
|
||||
directory, then protect it so only the release bot can push. Protect the `v*`
|
||||
|
||||
+53
-2
@@ -22,17 +22,68 @@ jobs:
|
||||
docker version
|
||||
docker info
|
||||
|
||||
- name: Check out source and nested repositories
|
||||
- name: Check out source
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
ssh-key: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }}
|
||||
ssh-user: gitea
|
||||
ssh-known-hosts: >-
|
||||
git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw==
|
||||
persist-credentials: false
|
||||
|
||||
- name: Read locked component repositories
|
||||
id: components
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 - "$GITHUB_OUTPUT" <<'PY'
|
||||
import json
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
lock = json.loads(pathlib.Path("components.lock.json").read_text())
|
||||
with pathlib.Path(sys.argv[1]).open("a") as output:
|
||||
for component, key in (
|
||||
("EchoionApi", "api"),
|
||||
("EchoionCore", "core"),
|
||||
("EchoionDesktop", "desktop"),
|
||||
):
|
||||
entry = lock["components"][component]
|
||||
print(f"{key}_repository={entry['repository']}", file=output)
|
||||
print(f"{key}_revision={entry['revision']}", file=output)
|
||||
PY
|
||||
|
||||
- name: Check out EchoionApi
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
repository: ${{ steps.components.outputs.api_repository }}
|
||||
ref: ${{ steps.components.outputs.api_revision }}
|
||||
path: EchoionApi
|
||||
fetch-depth: 1
|
||||
token: ${{ secrets.RELEASE_BOT_TOKEN }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Check out EchoionCore
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
repository: ${{ steps.components.outputs.core_repository }}
|
||||
ref: ${{ steps.components.outputs.core_revision }}
|
||||
path: EchoionCore
|
||||
fetch-depth: 1
|
||||
token: ${{ secrets.RELEASE_BOT_TOKEN }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Check out EchoionDesktop
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
repository: ${{ steps.components.outputs.desktop_repository }}
|
||||
ref: ${{ steps.components.outputs.desktop_revision }}
|
||||
path: EchoionDesktop
|
||||
fetch-depth: 1
|
||||
token: ${{ secrets.RELEASE_BOT_TOKEN }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Build, test, and package without starting Echoion
|
||||
env:
|
||||
CI_VERSION: 0.0.0-ci.${{ gitea.run_number }}.${{ gitea.run_attempt }}
|
||||
|
||||
@@ -21,18 +21,69 @@ jobs:
|
||||
docker version
|
||||
docker info
|
||||
|
||||
- name: Check out main and nested repositories
|
||||
- name: Check out main
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
ssh-key: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }}
|
||||
ssh-user: gitea
|
||||
ssh-known-hosts: >-
|
||||
git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw==
|
||||
persist-credentials: false
|
||||
|
||||
- name: Read locked component repositories
|
||||
id: components
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 - "$GITHUB_OUTPUT" <<'PY'
|
||||
import json
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
lock = json.loads(pathlib.Path("components.lock.json").read_text())
|
||||
with pathlib.Path(sys.argv[1]).open("a") as output:
|
||||
for component, key in (
|
||||
("EchoionApi", "api"),
|
||||
("EchoionCore", "core"),
|
||||
("EchoionDesktop", "desktop"),
|
||||
):
|
||||
entry = lock["components"][component]
|
||||
print(f"{key}_repository={entry['repository']}", file=output)
|
||||
print(f"{key}_revision={entry['revision']}", file=output)
|
||||
PY
|
||||
|
||||
- name: Check out EchoionApi
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
repository: ${{ steps.components.outputs.api_repository }}
|
||||
ref: ${{ steps.components.outputs.api_revision }}
|
||||
path: EchoionApi
|
||||
fetch-depth: 1
|
||||
token: ${{ secrets.RELEASE_BOT_TOKEN }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Check out EchoionCore
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
repository: ${{ steps.components.outputs.core_repository }}
|
||||
ref: ${{ steps.components.outputs.core_revision }}
|
||||
path: EchoionCore
|
||||
fetch-depth: 1
|
||||
token: ${{ secrets.RELEASE_BOT_TOKEN }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Check out EchoionDesktop
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
repository: ${{ steps.components.outputs.desktop_repository }}
|
||||
ref: ${{ steps.components.outputs.desktop_revision }}
|
||||
path: EchoionDesktop
|
||||
fetch-depth: 1
|
||||
token: ${{ secrets.RELEASE_BOT_TOKEN }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Derive the nightly identity
|
||||
shell: bash
|
||||
env:
|
||||
@@ -160,6 +211,12 @@ jobs:
|
||||
python3 scripts/aggregate_update_feed.py \
|
||||
--new-payload \
|
||||
"dist/echoion-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
|
||||
--new-payload \
|
||||
"dist/echoion-core-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
|
||||
--new-payload \
|
||||
"dist/url-shortener-internal-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
|
||||
--new-payload \
|
||||
"dist/url-shortener-external-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
|
||||
"${existing[@]}" \
|
||||
--public-key \
|
||||
.gitea/release-keys/echoion-release-2026-07.pub.pem \
|
||||
|
||||
@@ -26,13 +26,64 @@ jobs:
|
||||
with:
|
||||
ref: ${{ gitea.ref }}
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
ssh-key: ${{ secrets.RELEASE_CHECKOUT_SSH_KEY }}
|
||||
ssh-user: gitea
|
||||
ssh-known-hosts: >-
|
||||
git.faumaray.ru ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzZEz9JLrzk6oLiloSbueAN28vYL58Y/dTHBgRuBMMib9IJ1aDJShhr3kwC9sfOT0AzK0uwcMAqCAIkwJwttde8dIg0Mee0cmB/1JkoqFF4X3MUGD1r3nk8SSZNhIiPqo16hDF9Hf3FkovztIlBVntkyP9Iy9hYfP818Tiq3yRXROGdHjR7IfY4jR2QGfGrd/RtvPGExVqusxidy141240A8aRAwMFUqFdEvmXWjizrtCUqcrL/k1GEh0yJzbCdNOVUI6OuWd8tPluSBvmmeoNpKnCSl4Mkg36HObbOyrsme0asZqjcj0od65WYWApMPN0pUqhNu2CP83Nfor2VFwkdPRwe7cAZ0OD/8wyT6Hz5q1wWgf82y4tYDoDRYsd8JU86eebkJ07T5nCrEeC4Sj+qT4S5xv/kECAhxyP4QGnunORnY2fYsdNGzpPvbMN7gHe9UcIcQdOIgV3wrR1qpMVNcd8AEC2A3TRv/jzMCHSjmGGpgiy1Db2CZAjp5+PcjNmjvoPNN0NiA9X4rIVSeTfflWnDRmeNRJeZa73StjpU17EcAf97COUQPGWJQDgpJqINSpYU50fuaLBfzKnIRuiHjKQmyKe/zgRSmulnYFYM3AJfn8Ykg2VvkUQGvCt1+fqYiUa1iVFuwPP3ZigYF1mOZRpPnos5kaNmlB01q2sZw==
|
||||
persist-credentials: false
|
||||
|
||||
- name: Read locked component repositories
|
||||
id: components
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 - "$GITHUB_OUTPUT" <<'PY'
|
||||
import json
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
lock = json.loads(pathlib.Path("components.lock.json").read_text())
|
||||
with pathlib.Path(sys.argv[1]).open("a") as output:
|
||||
for component, key in (
|
||||
("EchoionApi", "api"),
|
||||
("EchoionCore", "core"),
|
||||
("EchoionDesktop", "desktop"),
|
||||
):
|
||||
entry = lock["components"][component]
|
||||
print(f"{key}_repository={entry['repository']}", file=output)
|
||||
print(f"{key}_revision={entry['revision']}", file=output)
|
||||
PY
|
||||
|
||||
- name: Check out EchoionApi
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
repository: ${{ steps.components.outputs.api_repository }}
|
||||
ref: ${{ steps.components.outputs.api_revision }}
|
||||
path: EchoionApi
|
||||
fetch-depth: 1
|
||||
token: ${{ secrets.RELEASE_BOT_TOKEN }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Check out EchoionCore
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
repository: ${{ steps.components.outputs.core_repository }}
|
||||
ref: ${{ steps.components.outputs.core_revision }}
|
||||
path: EchoionCore
|
||||
fetch-depth: 1
|
||||
token: ${{ secrets.RELEASE_BOT_TOKEN }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Check out EchoionDesktop
|
||||
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
repository: ${{ steps.components.outputs.desktop_repository }}
|
||||
ref: ${{ steps.components.outputs.desktop_revision }}
|
||||
path: EchoionDesktop
|
||||
fetch-depth: 1
|
||||
token: ${{ secrets.RELEASE_BOT_TOKEN }}
|
||||
persist-credentials: false
|
||||
|
||||
- name: Verify protected annotated SSH tag
|
||||
shell: bash
|
||||
env:
|
||||
@@ -168,6 +219,12 @@ jobs:
|
||||
python3 scripts/aggregate_update_feed.py \
|
||||
--new-payload \
|
||||
"dist/echoion-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
|
||||
--new-payload \
|
||||
"dist/echoion-core-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
|
||||
--new-payload \
|
||||
"dist/url-shortener-internal-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
|
||||
--new-payload \
|
||||
"dist/url-shortener-external-${RELEASE_VERSION}-linux-x86_64.update-payload.json" \
|
||||
"${existing[@]}" \
|
||||
--public-key \
|
||||
.gitea/release-keys/echoion-release-2026-07.pub.pem \
|
||||
|
||||
@@ -10,3 +10,9 @@ __pycache__/
|
||||
AGENTS.md
|
||||
.vscode
|
||||
.opencode/
|
||||
|
||||
# Independently cloned component repositories. Their immutable release
|
||||
# revisions are recorded in components.lock.json.
|
||||
/EchoionApi/
|
||||
/EchoionCore/
|
||||
/EchoionDesktop/
|
||||
@@ -1,9 +0,0 @@
|
||||
[submodule "EchoionApi"]
|
||||
path = EchoionApi
|
||||
url = ssh://gitea@git.faumaray.ru/void/echoionapi.git
|
||||
[submodule "EchoionCore"]
|
||||
path = EchoionCore
|
||||
url = ssh://gitea@git.faumaray.ru/void/echoioncore.git
|
||||
[submodule "EchoionDesktop"]
|
||||
path = EchoionDesktop
|
||||
url = ssh://gitea@git.faumaray.ru/void/echoiondesktop.git
|
||||
+20
-3
@@ -4,6 +4,20 @@ project(Echoion VERSION 1.0.7 LANGUAGES CXX)
|
||||
include(GNUInstallDirs)
|
||||
include(cmake/DependencyLock.cmake)
|
||||
|
||||
# The root product version is the only manually edited version. Every
|
||||
# component project consumes this value when orchestrated by Echoion; their
|
||||
# standalone fallback is intentionally 0.0.0 and is never used for a product
|
||||
# release.
|
||||
if(DEFINED ECHOION_RELEASE_VERSION AND
|
||||
NOT ECHOION_RELEASE_VERSION STREQUAL "")
|
||||
set(ECHOION_COMPONENT_VERSION "${ECHOION_RELEASE_VERSION}")
|
||||
string(REGEX REPLACE "[-+].*$" ""
|
||||
ECHOION_PRODUCT_VERSION "${ECHOION_RELEASE_VERSION}")
|
||||
else()
|
||||
set(ECHOION_PRODUCT_VERSION "${PROJECT_VERSION}")
|
||||
set(ECHOION_COMPONENT_VERSION "${PROJECT_VERSION}")
|
||||
endif()
|
||||
|
||||
# Default to a Release build when the developer/CI did not pick a config.
|
||||
# Without this, single-config generators leave CMAKE_BUILD_TYPE empty and GCC
|
||||
# falls back to -O0, so "production" builds shipped unoptimised. Set this before
|
||||
@@ -82,6 +96,7 @@ file(
|
||||
EXPECTED_HASH SHA256=78ba32abdf798bc616bab7c73aac32a17bbd7b06ad9e26a6add69de8f3ae4791
|
||||
)
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake)
|
||||
include(cmake/EchoionComponents.cmake)
|
||||
|
||||
# Include PackageProject.cmake
|
||||
CPMAddPackage(
|
||||
@@ -131,6 +146,8 @@ set(CXX_SCAN_FOR_MODULES OFF)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16)
|
||||
# Guard to C++ only — vendored C dependencies (quickjs) must not see it.
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-freflection>)
|
||||
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-omit-frame-pointer>)
|
||||
endif()
|
||||
|
||||
# Link-time optimisation for Release configs only (keeps Debug builds fast).
|
||||
@@ -181,7 +198,7 @@ find_package(Threads REQUIRED)
|
||||
|
||||
# Add subdirectories
|
||||
if(BUILD_API)
|
||||
add_subdirectory(EchoionApi)
|
||||
echoion_add_component(EchoionApi)
|
||||
endif()
|
||||
|
||||
if(BUILD_FIRST_PARTY_PLUGINS)
|
||||
@@ -193,7 +210,7 @@ if(BUILD_STANDALONE)
|
||||
endif()
|
||||
|
||||
if(BUILD_CORE)
|
||||
add_subdirectory(EchoionCore)
|
||||
echoion_add_component(EchoionCore)
|
||||
endif()
|
||||
|
||||
# EchoionWeb is added after Core so it can reuse the single Boost header
|
||||
@@ -224,7 +241,7 @@ if(BUILD_STANDALONE)
|
||||
endif()
|
||||
|
||||
if(BUILD_DESKTOP)
|
||||
add_subdirectory(EchoionDesktop)
|
||||
echoion_add_component(EchoionDesktop)
|
||||
endif()
|
||||
|
||||
# The release install component is deliberately runtime-only. Nested projects
|
||||
|
||||
-1
Submodule EchoionApi deleted from 3d61e6952f.
-1
Submodule EchoionCore deleted from a277f2102b.
Submodule EchoionDesktop deleted from 2aa44fae9e.
@@ -1,5 +1,8 @@
|
||||
cmake_minimum_required(VERSION 4.0.0)
|
||||
project(EchoionHost VERSION 1.0.0 LANGUAGES CXX)
|
||||
if(NOT DEFINED ECHOION_PRODUCT_VERSION)
|
||||
set(ECHOION_PRODUCT_VERSION 0.0.0)
|
||||
endif()
|
||||
project(EchoionHost VERSION "${ECHOION_PRODUCT_VERSION}" LANGUAGES CXX)
|
||||
|
||||
add_library(EchoionHost STATIC
|
||||
src/CoreLoader.cpp
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
# and implements IPluginInterface with the reusable VoidTeamspeak client.
|
||||
|
||||
cmake_minimum_required(VERSION 4.0.0)
|
||||
project(EchoionStandalone VERSION 1.0.7 LANGUAGES CXX)
|
||||
if(NOT DEFINED ECHOION_PRODUCT_VERSION)
|
||||
set(ECHOION_PRODUCT_VERSION 0.0.0)
|
||||
endif()
|
||||
project(EchoionStandalone VERSION "${ECHOION_PRODUCT_VERSION}" LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 26)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
@@ -105,7 +108,7 @@ set_target_properties(EchoionStandalone PROPERTIES
|
||||
|
||||
install(TARGETS EchoionStandalone RUNTIME DESTINATION bin)
|
||||
|
||||
if(BUILD_TESTS)
|
||||
if(BUILD_TESTS AND TARGET EchoionCore)
|
||||
add_executable(echoion_core_loader_reload_tests
|
||||
tests/test_core_loader_reload.cpp)
|
||||
target_link_libraries(echoion_core_loader_reload_tests PRIVATE
|
||||
@@ -116,7 +119,9 @@ if(BUILD_TESTS)
|
||||
add_dependencies(echoion_core_loader_reload_tests EchoionCore)
|
||||
add_test(NAME echoion_core_loader_reload_tests
|
||||
COMMAND echoion_core_loader_reload_tests)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTS)
|
||||
add_executable(echoion_standalone_message_tests
|
||||
tests/test_message_chunker.cpp
|
||||
src/MessageChunker.cpp
|
||||
|
||||
@@ -97,4 +97,14 @@ namespace Echoion::Standalone
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> impl_;
|
||||
};
|
||||
|
||||
using UpdateControlHandler = std::function<Api::Result<std::string>(
|
||||
const std::string&, const std::string&)>;
|
||||
|
||||
// Keep the service alive for the complete duration of an in-flight host
|
||||
// control request. StandaloneClientInterface intentionally invokes a copied
|
||||
// handler outside its mutex, so clearing the registered handler cannot
|
||||
// cancel a callback which has already started.
|
||||
[[nodiscard]] UpdateControlHandler
|
||||
bindUpdateService(std::shared_ptr<UpdateService> service);
|
||||
} // namespace Echoion::Standalone
|
||||
@@ -3162,6 +3162,15 @@ namespace Echoion::Standalone
|
||||
return impl_->handle(method, requestJson);
|
||||
}
|
||||
|
||||
UpdateControlHandler bindUpdateService(std::shared_ptr<UpdateService> service)
|
||||
{
|
||||
return [service = std::move(service)](
|
||||
const std::string& method,
|
||||
const std::string& requestJson) {
|
||||
return service->handle(method, requestJson);
|
||||
};
|
||||
}
|
||||
|
||||
Api::Result<ManagedCoreStartupSelection>
|
||||
selectManagedCoreForStartup(const std::filesystem::path& stateDirectory,
|
||||
const std::filesystem::path& bundledCore,
|
||||
|
||||
@@ -720,7 +720,7 @@ int main(int argc, char** argv)
|
||||
|
||||
const auto updaterExecutable =
|
||||
runningExecutable->parent_path() / "echoion-updater";
|
||||
auto updateService = std::make_unique<Echoion::Standalone::UpdateService>(
|
||||
auto updateService = std::make_shared<Echoion::Standalone::UpdateService>(
|
||||
Echoion::Standalone::UpdateService::Options{
|
||||
.configPath = cfgPath,
|
||||
.stateDirectory = stateDirectory,
|
||||
@@ -784,10 +784,7 @@ int main(int argc, char** argv)
|
||||
updateService.reset();
|
||||
} else {
|
||||
interface->setHostControlHandler(
|
||||
[service = updateService.get()](const std::string& method,
|
||||
const std::string& request) {
|
||||
return service->handle(method, request);
|
||||
});
|
||||
Echoion::Standalone::bindUpdateService(updateService));
|
||||
}
|
||||
|
||||
core->triggerAutoConnect();
|
||||
|
||||
@@ -250,6 +250,25 @@ int main()
|
||||
};
|
||||
|
||||
TemporaryTree tree;
|
||||
{
|
||||
auto ownedService =
|
||||
std::make_shared<Echoion::Standalone::UpdateService>(
|
||||
Echoion::Standalone::UpdateService::Options{},
|
||||
Echoion::Standalone::UpdateService::Hooks{});
|
||||
std::weak_ptr<Echoion::Standalone::UpdateService> observedService =
|
||||
ownedService;
|
||||
auto handler =
|
||||
Echoion::Standalone::bindUpdateService(ownedService);
|
||||
ownedService.reset();
|
||||
check(!observedService.expired(),
|
||||
"host control handler did not retain UpdateService");
|
||||
check(handler("updates.getStatus", "{}").has_value(),
|
||||
"retained UpdateService handler could not serve status");
|
||||
handler = {};
|
||||
check(observedService.expired(),
|
||||
"cleared host control handler retained UpdateService");
|
||||
}
|
||||
|
||||
const auto startupState = tree.path() / "startup-state";
|
||||
const auto bundledStartupCore =
|
||||
tree.path() / "startup-runtime" / "lib" / "Echoion.ts";
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
cmake_minimum_required(VERSION 4.0.0)
|
||||
project(EchoionWeb VERSION 1.0.0 LANGUAGES CXX)
|
||||
if(NOT DEFINED ECHOION_PRODUCT_VERSION)
|
||||
set(ECHOION_PRODUCT_VERSION 0.0.0)
|
||||
endif()
|
||||
project(EchoionWeb VERSION "${ECHOION_PRODUCT_VERSION}" LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 26)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
Vendored
+5
-1
@@ -25,7 +25,11 @@ pipeline {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
sh 'git submodule update --init --recursive'
|
||||
// Components are independent repositories pinned by immutable
|
||||
// revisions in components.lock.json. Configure HTTPS
|
||||
// credentials for git.faumaray.ru on the agent when the
|
||||
// repositories are private.
|
||||
sh 'python3 scripts/sync-components.py --update'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@ set(ECHOION_VOID_REVISION
|
||||
"053ee5b296d1f41b0653b4301bbea1e857be2279"
|
||||
CACHE STRING "VoidLibrary commit used by Echoion")
|
||||
set(ECHOION_VOID_TEAMSPEAK_REVISION
|
||||
"5c0c0c525fe76645bbcdd5ae16c7396993ca8f1d"
|
||||
"cd4e303259ed32fee1fa77b387d3c675b5e672cd"
|
||||
CACHE STRING "VoidTeamspeak commit used by Echoion")
|
||||
@@ -0,0 +1,46 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
set(ECHOION_COMPONENT_LOCK
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../components.lock.json"
|
||||
CACHE FILEPATH "Echoion component repository lock file")
|
||||
|
||||
if(NOT EXISTS "${ECHOION_COMPONENT_LOCK}")
|
||||
message(FATAL_ERROR
|
||||
"Echoion component lock does not exist: ${ECHOION_COMPONENT_LOCK}")
|
||||
endif()
|
||||
|
||||
file(READ "${ECHOION_COMPONENT_LOCK}" _echoionComponentLockJson)
|
||||
string(JSON _echoionComponentLockSchema ERROR_VARIABLE _echoionLockError
|
||||
GET "${_echoionComponentLockJson}" schemaVersion)
|
||||
if(_echoionLockError OR NOT _echoionComponentLockSchema EQUAL 1)
|
||||
message(FATAL_ERROR
|
||||
"Unsupported Echoion component lock: ${ECHOION_COMPONENT_LOCK}")
|
||||
endif()
|
||||
|
||||
function(echoion_add_component component)
|
||||
string(JSON repository ERROR_VARIABLE repositoryError
|
||||
GET "${_echoionComponentLockJson}" components "${component}" url)
|
||||
string(JSON revision ERROR_VARIABLE revisionError
|
||||
GET "${_echoionComponentLockJson}" components "${component}" revision)
|
||||
if(repositoryError OR revisionError OR repository STREQUAL "" OR
|
||||
revision STREQUAL "")
|
||||
message(FATAL_ERROR
|
||||
"Component ${component} is incomplete in "
|
||||
"${ECHOION_COMPONENT_LOCK}")
|
||||
endif()
|
||||
|
||||
# A workspace created by scripts/sync-components.py or by the Gitea
|
||||
# workflow wins over network fetching. This keeps private credentials out
|
||||
# of Docker while a clean public checkout can still resolve through CPM.
|
||||
set(localSource "${CMAKE_SOURCE_DIR}/${component}")
|
||||
if(EXISTS "${localSource}/CMakeLists.txt")
|
||||
set("CPM_${component}_SOURCE" "${localSource}" CACHE PATH
|
||||
"Local ${component} source directory")
|
||||
endif()
|
||||
|
||||
CPMAddPackage(
|
||||
NAME "${component}"
|
||||
GIT_REPOSITORY "${repository}"
|
||||
GIT_TAG "${revision}"
|
||||
)
|
||||
endfunction()
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"components": {
|
||||
"EchoionApi": {
|
||||
"repository": "Void/EchoionApi",
|
||||
"url": "https://git.faumaray.ru/void/echoionapi.git",
|
||||
"revision": "06e06b7622c72fe27a6b65654d62a1536acffbe9"
|
||||
},
|
||||
"EchoionCore": {
|
||||
"repository": "Void/EchoionCore",
|
||||
"url": "https://git.faumaray.ru/void/echoioncore.git",
|
||||
"revision": "9637f1eef75dbe79ed8dff564233a57db64bc32f"
|
||||
},
|
||||
"EchoionDesktop": {
|
||||
"repository": "Void/EchoionDesktop",
|
||||
"url": "https://git.faumaray.ru/void/echoiondesktop.git",
|
||||
"revision": "1fc5aaecfe888e1c480bcb31d7d3b64986c84e1d"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,6 +197,15 @@
|
||||
}
|
||||
},
|
||||
|
||||
"logging": {
|
||||
"_section": "Rolling process logs (the active file is archived on every start)",
|
||||
"console": true,
|
||||
"level": "debug",
|
||||
"fileName": "echoion.log",
|
||||
"maxFileSizeBytes": 10485760,
|
||||
"maxFiles": 10
|
||||
},
|
||||
|
||||
"advanced": {
|
||||
"_section": "Advanced Settings (Modify with caution)",
|
||||
"_cache": "Local audio track cache (files reused across plays and restarts)",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
set(ECHOION_URL_SHORTENER_INTERNAL_VERSION "1.0.0")
|
||||
set(ECHOION_URL_SHORTENER_EXTERNAL_VERSION "1.0.0")
|
||||
set(ECHOION_URL_SHORTENER_INTERNAL_VERSION "${ECHOION_COMPONENT_VERSION}")
|
||||
set(ECHOION_URL_SHORTENER_EXTERNAL_VERSION "${ECHOION_COMPONENT_VERSION}")
|
||||
|
||||
find_package(OpenSSL REQUIRED COMPONENTS Crypto)
|
||||
find_package(Boost REQUIRED COMPONENTS url)
|
||||
|
||||
@@ -320,7 +320,9 @@ def atomic_write(path: Path, content: bytes, mode: int = 0o644) -> None:
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--new-payload", type=Path, required=True)
|
||||
parser.add_argument(
|
||||
"--new-payload", type=Path, action="append", required=True
|
||||
)
|
||||
parser.add_argument("--existing-envelope", type=Path)
|
||||
parser.add_argument("--public-key", type=Path, required=True)
|
||||
parser.add_argument("--private-key", type=Path, required=True)
|
||||
@@ -346,7 +348,9 @@ def main() -> None:
|
||||
fail("--valid-days must be between 1 and 365")
|
||||
if arguments.nightly_retention < 1:
|
||||
fail("--nightly-retention must be positive")
|
||||
new_payload_path = regular_file(arguments.new_payload, "new payload")
|
||||
new_payload_paths = [
|
||||
regular_file(path, "new payload") for path in arguments.new_payload
|
||||
]
|
||||
public_key = regular_file(arguments.public_key, "Ed25519 public key")
|
||||
private_key = regular_file(
|
||||
arguments.private_key, "Ed25519 private key", private=True
|
||||
@@ -368,8 +372,17 @@ def main() -> None:
|
||||
if previous is not None and previous != key_path:
|
||||
fail(f"conflicting public keys for key id: {key_id}")
|
||||
trusted_existing_keys[key_id] = key_path
|
||||
new_document = load_json_bytes(new_payload_path.read_bytes(), "new feed payload")
|
||||
new_releases = validate_payload(new_document, "new feed payload")
|
||||
new_documents = [
|
||||
load_json_bytes(path.read_bytes(), "new feed payload")
|
||||
for path in new_payload_paths
|
||||
]
|
||||
new_document = new_documents[0]
|
||||
new_releases: list[dict[str, Any]] = []
|
||||
for document in new_documents:
|
||||
releases = validate_payload(document, "new feed payload")
|
||||
if document["feedId"] != new_document["feedId"]:
|
||||
fail("new feed identifiers differ")
|
||||
new_releases.extend(releases)
|
||||
|
||||
existing_document: dict[str, Any] | None = None
|
||||
existing_payload_bytes = b""
|
||||
@@ -389,7 +402,7 @@ def main() -> None:
|
||||
output_payload = arguments.output_payload.resolve()
|
||||
output_envelope = arguments.output_envelope.resolve()
|
||||
inputs = {
|
||||
new_payload_path,
|
||||
*new_payload_paths,
|
||||
private_key,
|
||||
*trusted_existing_keys.values(),
|
||||
}
|
||||
@@ -422,7 +435,10 @@ def main() -> None:
|
||||
)
|
||||
generated = max(
|
||||
generated,
|
||||
parse_timestamp(new_document["generatedAt"], "new feed generatedAt"),
|
||||
max(
|
||||
parse_timestamp(document["generatedAt"], "new feed generatedAt")
|
||||
for document in new_documents
|
||||
),
|
||||
)
|
||||
if existing_document is not None:
|
||||
generated = max(
|
||||
@@ -431,7 +447,9 @@ def main() -> None:
|
||||
existing_document["generatedAt"], "existing feed generatedAt"
|
||||
),
|
||||
)
|
||||
minimum_sequence = int(new_document["sequence"])
|
||||
minimum_sequence = max(
|
||||
int(document["sequence"]) for document in new_documents
|
||||
)
|
||||
if existing_document is not None:
|
||||
minimum_sequence = max(minimum_sequence, int(existing_document["sequence"]) + 1)
|
||||
sequence = arguments.sequence
|
||||
|
||||
+66
-4
@@ -341,6 +341,7 @@ configure_args=(
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DECHOION_STATIC_LINK=OFF
|
||||
-DECHOION_REPRODUCIBLE_BUILD=ON
|
||||
"-DECHOION_RELEASE_VERSION=$version"
|
||||
"-DECHOION_RUNTIME_VERSION=$version"
|
||||
)
|
||||
official_update_keys="$source_dir/.gitea/release-keys/official-update-keys.json"
|
||||
@@ -428,9 +429,9 @@ cmake \
|
||||
# Bootstrap plugins are copied into writable managed-plugin state by the
|
||||
# installer. Search the active release closure from managed, portable/manual,
|
||||
# and immutable bootstrap locations, then allow plugin-private dependencies.
|
||||
# shellcheck disable=SC2016 # Dynamic linker token, not a shell variable.
|
||||
plugin_runpath='$ORIGIN/../../../../../../current/lib:$ORIGIN/../../current/lib:$ORIGIN/lib'
|
||||
for plugin_library in "${resolver_libraries[@]:1}"; do
|
||||
# shellcheck disable=SC2016 # Dynamic linker token, not a shell variable.
|
||||
patchelf --set-rpath "$plugin_runpath" "$plugin_library"
|
||||
done
|
||||
|
||||
@@ -550,10 +551,19 @@ installer="$dist_dir/$artifact_base.run"
|
||||
external_manifest="$dist_dir/$artifact_base.manifest.json"
|
||||
external_report="$dist_dir/$artifact_base.dependencies.txt"
|
||||
feed_payload="$dist_dir/$artifact_base.update-payload.json"
|
||||
core_artifact="$dist_dir/echoion-core-${version}-linux-x86_64.so"
|
||||
core_feed_payload="$dist_dir/echoion-core-${version}-linux-x86_64.update-payload.json"
|
||||
internal_plugin_artifact="$dist_dir/url-shortener-internal-${version}-linux-x86_64.so"
|
||||
internal_plugin_feed_payload="$dist_dir/url-shortener-internal-${version}-linux-x86_64.update-payload.json"
|
||||
external_plugin_artifact="$dist_dir/url-shortener-external-${version}-linux-x86_64.so"
|
||||
external_plugin_feed_payload="$dist_dir/url-shortener-external-${version}-linux-x86_64.update-payload.json"
|
||||
rm -f -- \
|
||||
"$archive" "$archive.tmp" \
|
||||
"$installer" "$installer.tmp" \
|
||||
"$external_manifest" "$external_report" "$feed_payload" \
|
||||
"$core_artifact" "$core_feed_payload" \
|
||||
"$internal_plugin_artifact" "$internal_plugin_feed_payload" \
|
||||
"$external_plugin_artifact" "$external_plugin_feed_payload" \
|
||||
"$dist_dir/SHA256SUMS"
|
||||
|
||||
bash "$source_dir/scripts/package-release-payload.sh" \
|
||||
@@ -562,6 +572,13 @@ bash "$source_dir/scripts/package-release-payload.sh" \
|
||||
|
||||
install -m 0644 "$stage/manifest.json" "$external_manifest"
|
||||
install -m 0644 "$dependency_report" "$external_report"
|
||||
install -m 0644 "$stage/lib/Echoion.ts" "$core_artifact"
|
||||
install -m 0644 \
|
||||
"$stage/share/echoion/bootstrap-plugins/url-shortener-internal/$version/url-shortener-internal.so" \
|
||||
"$internal_plugin_artifact"
|
||||
install -m 0644 \
|
||||
"$stage/share/echoion/bootstrap-plugins/url-shortener-external/$version/url-shortener-external.so" \
|
||||
"$external_plugin_artifact"
|
||||
if [[ -n $update_url ]]; then
|
||||
feed_args=(
|
||||
--artifact "$archive"
|
||||
@@ -576,6 +593,35 @@ if [[ -n $update_url ]]; then
|
||||
[[ -z $update_sequence ]] ||
|
||||
feed_args+=(--sequence "$update_sequence")
|
||||
python3 "$source_dir/scripts/generate-update-feed.py" "${feed_args[@]}"
|
||||
artifact_url_root=${update_url%/*}
|
||||
component_feed_args=(
|
||||
--version "$version"
|
||||
--channel "$update_channel"
|
||||
--feed-id "$update_feed_id"
|
||||
--valid-days "$update_valid_days"
|
||||
)
|
||||
[[ -z $update_sequence ]] ||
|
||||
component_feed_args+=(--sequence "$update_sequence")
|
||||
python3 "$source_dir/scripts/generate-update-feed.py" \
|
||||
--artifact "$core_artifact" \
|
||||
--component core \
|
||||
--url "$artifact_url_root/$(basename "$core_artifact")" \
|
||||
--output-payload "$core_feed_payload" \
|
||||
"${component_feed_args[@]}"
|
||||
python3 "$source_dir/scripts/generate-update-feed.py" \
|
||||
--artifact "$internal_plugin_artifact" \
|
||||
--component plugin \
|
||||
--artifact-id url-shortener-internal \
|
||||
--url "$artifact_url_root/$(basename "$internal_plugin_artifact")" \
|
||||
--output-payload "$internal_plugin_feed_payload" \
|
||||
"${component_feed_args[@]}"
|
||||
python3 "$source_dir/scripts/generate-update-feed.py" \
|
||||
--artifact "$external_plugin_artifact" \
|
||||
--component plugin \
|
||||
--artifact-id url-shortener-external \
|
||||
--url "$artifact_url_root/$(basename "$external_plugin_artifact")" \
|
||||
--output-payload "$external_plugin_feed_payload" \
|
||||
"${component_feed_args[@]}"
|
||||
fi
|
||||
(
|
||||
cd "$dist_dir"
|
||||
@@ -583,9 +629,17 @@ fi
|
||||
"$(basename "$archive")" \
|
||||
"$(basename "$installer")" \
|
||||
"$(basename "$external_manifest")" \
|
||||
"$(basename "$external_report")"
|
||||
"$(basename "$external_report")" \
|
||||
"$(basename "$core_artifact")" \
|
||||
"$(basename "$internal_plugin_artifact")" \
|
||||
"$(basename "$external_plugin_artifact")"
|
||||
)
|
||||
[[ -z $update_url ]] || checksum_files+=(
|
||||
"$(basename "$feed_payload")"
|
||||
"$(basename "$core_feed_payload")"
|
||||
"$(basename "$internal_plugin_feed_payload")"
|
||||
"$(basename "$external_plugin_feed_payload")"
|
||||
)
|
||||
[[ -z $update_url ]] || checksum_files+=("$(basename "$feed_payload")")
|
||||
sha256sum "${checksum_files[@]}" >SHA256SUMS
|
||||
)
|
||||
|
||||
@@ -594,5 +648,13 @@ echo " $archive"
|
||||
echo " $installer"
|
||||
echo " $external_manifest"
|
||||
echo " $external_report"
|
||||
[[ -z $update_url ]] || echo " $feed_payload"
|
||||
echo " $core_artifact"
|
||||
echo " $internal_plugin_artifact"
|
||||
echo " $external_plugin_artifact"
|
||||
if [[ -n $update_url ]]; then
|
||||
echo " $feed_payload"
|
||||
echo " $core_feed_payload"
|
||||
echo " $internal_plugin_feed_payload"
|
||||
echo " $external_plugin_feed_payload"
|
||||
fi
|
||||
echo " $dist_dir/SHA256SUMS"
|
||||
Executable
+87
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Clone the independently versioned Echoion component repositories."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def run(*args: str, cwd: Path | None = None) -> None:
|
||||
subprocess.run(args, cwd=cwd, check=True)
|
||||
|
||||
|
||||
def output(*args: str, cwd: Path) -> str:
|
||||
return subprocess.check_output(args, cwd=cwd, text=True).strip()
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--update",
|
||||
action="store_true",
|
||||
help="fetch and check out locked revisions in existing clean repositories",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--record",
|
||||
action="store_true",
|
||||
help="record the current clean component HEADs in components.lock.json",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
if args.update and args.record:
|
||||
parser.error("--update and --record are mutually exclusive")
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
lock_path = root / "components.lock.json"
|
||||
lock = json.loads(lock_path.read_text())
|
||||
if lock.get("schemaVersion") != 1:
|
||||
raise SystemExit("unsupported components.lock.json schema")
|
||||
|
||||
if args.record:
|
||||
for name, component in lock["components"].items():
|
||||
destination = root / name
|
||||
if not (destination / ".git").exists():
|
||||
raise SystemExit(f"component repository is missing: {destination}")
|
||||
if output("git", "status", "--porcelain", cwd=destination):
|
||||
raise SystemExit(
|
||||
f"refusing to record dirty repository: {destination}"
|
||||
)
|
||||
component["revision"] = output(
|
||||
"git", "rev-parse", "HEAD", cwd=destination
|
||||
)
|
||||
temporary = lock_path.with_suffix(".json.tmp")
|
||||
temporary.write_text(json.dumps(lock, indent=2) + "\n")
|
||||
temporary.replace(lock_path)
|
||||
return 0
|
||||
|
||||
for name, component in lock["components"].items():
|
||||
destination = root / name
|
||||
revision = component["revision"]
|
||||
if not destination.exists():
|
||||
run(
|
||||
"git",
|
||||
"clone",
|
||||
"--no-checkout",
|
||||
component["url"],
|
||||
str(destination),
|
||||
)
|
||||
run("git", "fetch", "--depth=1", "origin", revision, cwd=destination)
|
||||
run("git", "checkout", "--detach", "FETCH_HEAD", cwd=destination)
|
||||
continue
|
||||
|
||||
if not (destination / ".git").exists():
|
||||
raise SystemExit(f"{destination} exists but is not a Git repository")
|
||||
if not args.update:
|
||||
continue
|
||||
if output("git", "status", "--porcelain", cwd=destination):
|
||||
raise SystemExit(f"refusing to update dirty repository: {destination}")
|
||||
run("git", "fetch", "origin", revision, cwd=destination)
|
||||
run("git", "checkout", "--detach", revision, cwd=destination)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -178,6 +178,34 @@ class AggregateUpdateFeedTest(unittest.TestCase):
|
||||
self.assertNotEqual(collision.returncode, 0)
|
||||
self.assertIn("immutable release identity", collision.stderr)
|
||||
|
||||
def test_multiple_component_payloads_are_signed_together(self) -> None:
|
||||
runtime_payload = self.root / "runtime.json"
|
||||
core_payload = self.root / "core.json"
|
||||
runtime_release = release("1.2.3", "stable")
|
||||
core_release = {
|
||||
**release("1.2.3", "stable"),
|
||||
"component": "core",
|
||||
"url": "https://updates.example.invalid/echoion-core-1.2.3.so",
|
||||
"packageType": "shared-library",
|
||||
}
|
||||
core_release.pop("releaseManifestSha256")
|
||||
payload(runtime_payload, [runtime_release], 100)
|
||||
payload(core_payload, [core_release], 100)
|
||||
|
||||
output = self.root / "components-output.json"
|
||||
self.run_script(
|
||||
runtime_payload,
|
||||
output,
|
||||
self.root / "components-envelope.json",
|
||||
"--new-payload",
|
||||
os.fspath(core_payload),
|
||||
)
|
||||
releases = json.loads(output.read_text(encoding="utf-8"))["releases"]
|
||||
self.assertEqual(
|
||||
{(item["component"], item["version"]) for item in releases},
|
||||
{("runtime", "1.2.3"), ("core", "1.2.3")},
|
||||
)
|
||||
|
||||
def test_tampered_existing_envelope_is_rejected(self) -> None:
|
||||
first = self.root / "first.json"
|
||||
first_output = self.root / "first-output.json"
|
||||
|
||||
Reference in new issue
Block a user