Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
80e3aa1
fix: check ThingsVis database readiness in installer
zjhong Nov 1, 2026
9f513d3
feat: add draft Linux agent state kernel
zjhong Nov 1, 2026
282eb7c
fix: avoid exposing native preparation command errors
zjhong Nov 1, 2026
05470e0
chore: preserve installer team handoff before closeout
zjhong Nov 1, 2026
22d970e
fix(installer): make updates recoverable and preserve activation boun…
zjhong Nov 2, 2026
552f030
fix(installer): persist configuration activation and secure service i…
zjhong Nov 2, 2026
524435a
feat(agent): persist create-only container preparation and original-k…
zjhong Nov 2, 2026
90ff8bb
feat(installer): add fail-closed signed release manifest verification
zjhong Nov 2, 2026
bf52877
feat: verify signed release manifest inside the update transaction
zjhong Nov 2, 2026
8cab056
feat(compose): make host ports overridable via TP_PORT_* with unchang…
zjhong Nov 3, 2026
f6d5698
feat(compose): allow overriding fixed ThingsVis container names (defa…
zjhong Nov 3, 2026
3190552
feat(compose): optional tdengine history profile (off by default)
zjhong Nov 3, 2026
b1fa99c
fix(compose): restart notification-core when backend is recreated
zjhong Nov 3, 2026
ea86ef7
feat(update): --reconcile-activation closes an unresolved activation …
zjhong Nov 3, 2026
4e1796c
feat(update): reconcile re-runs migration bootstrap, compose up and v…
zjhong Nov 3, 2026
851eea8
Revert "fix(compose): restart notification-core when backend is recre…
zjhong Nov 3, 2026
10a05b6
feat(prepare): pin reviewed local backend/TDengine images by exact ID…
zjhong Nov 3, 2026
ac35a6e
fix(update): restart services whose single-file bind mounts were repl…
zjhong Nov 3, 2026
10fbe97
docs(native): correct restart order after refreshing device allowlist
zjhong Nov 3, 2026
71ba953
fix(update): let a completed installation be relocated to another dir…
zjhong Nov 3, 2026
cc4a7b9
feat(release): tools/sign_release.py builds and signs the release man…
zjhong Nov 3, 2026
f95c27f
fix(update): version check reads the reviewed default of the overrida…
zjhong Nov 3, 2026
feb2312
ci(release): sign the release manifest when RELEASE_SIGNING_KEY is co…
zjhong Nov 3, 2026
87960f9
feat(agent): activation grants, revocation, lease expiry and takeover…
zjhong Nov 3, 2026
07558ea
feat(agent): tp-agent service (Unix socket, bearer token, sweeper) wi…
zjhong Nov 3, 2026
0307bb6
feat(agent): optional network/env/reviewed-image profile fields and t…
zjhong Nov 3, 2026
118abed
feat(tools): signed plugin catalog and a one-command plugin installer…
zjhong Nov 4, 2026
6e5f356
WIP(unverified): plugin installer issues a managed runtime identity p…
zjhong Nov 4, 2026
7e19230
plugins: add signed-catalog entry for the Home Assistant connector (T6)
zjhong Nov 4, 2026
b9639de
feat(installer): issue/revoke runtime identity per generation, inject…
zjhong Nov 4, 2026
71647da
plugins: homeassistant on the SDK v0.2.0 image (local), version 1.0.0-t5
zjhong Nov 4, 2026
d60464b
fix(installer): takeover also after uninstall; uninstall only revokes…
zjhong Nov 4, 2026
e0102f9
docs: T5 delivery note
zjhong Nov 4, 2026
cf242df
docs: T7 delivery note (HA end-to-end: install/identity pass, data pa…
zjhong Nov 4, 2026
f043844
feat(installer): idempotent service plugin registration, stable netwo…
zjhong Nov 4, 2026
4470874
Merge plugin install chain: Agent, signed catalog, managed runtime id…
zjhong Nov 4, 2026
7b97e9d
feat(installer): auto 33.sql migration, plugin devices in platform Br…
zjhong Nov 4, 2026
2a18f81
docs: P1 delivery note; installer prints the scope line
zjhong Nov 4, 2026
27840cd
Merge P1: auto 33.sql migration, plugin devices in platform Broker sc…
zjhong Nov 4, 2026
8fb9e81
fix(installer): retry and serialize broker scope restarts
zjhong Nov 4, 2026
a7f2a70
fix(installer): surface busy watcher startup
zjhong Nov 4, 2026
a540634
Merge P1 fix: retry scope restarts and serialize watcher
zjhong Nov 4, 2026
c7a0c10
fix(installer): align default postgres config with A1
zjhong Nov 4, 2026
4a8f286
Merge default postgres config alignment
zjhong Nov 4, 2026
efdf2d4
fix(bootstrap): fail when a new backend image lacks sql/33.sql; skip+…
zjhong Nov 5, 2026
e57b99c
docs: PH1-S2 real-image verification
zjhong Nov 5, 2026
d1a87f1
agent: catalog-driven install API with secret store
zjhong Nov 5, 2026
1d2546e
installer: agent_host.py (catalog-mode Agent), run sql/34-35 at boots…
zjhong Nov 5, 2026
13b2366
installer: plugin_install.py becomes a thin client of the platform's …
zjhong Nov 5, 2026
571404a
Merge branch 'wp/pui-agent' into wp/ph1-s2-migration-guard
zjhong Nov 5, 2026
9e95e4d
fix(bootstrap): per-migration markers (33<->pluginidentity, 34/35<->p…
zjhong Nov 5, 2026
c551440
Merge PH1-S2 per-migration image guard and plugin install UI installe…
zjhong Nov 5, 2026
97dacf9
fix(agent): renew only a live running plugin lease
zjhong Nov 6, 2026
1a71812
fix(agent): keep grant identity during lease renewal
zjhong Nov 6, 2026
0b57f7a
test(plugin): keep HA credentials out of install form
zjhong Nov 6, 2026
6974478
test(agent): keep HA access credentials out of catalog fixtures
zjhong Nov 6, 2026
e6e2f2d
feat(installer): start verified plugin agent before backend
zjhong Nov 6, 2026
960a45e
fix(installer): keep plugin trust root out of payload
zjhong Nov 6, 2026
0707fdc
build(plugin): align HA candidate manifest and image digest
zjhong Nov 6, 2026
75e08be
build(plugin): refresh HA candidate without image labels
zjhong Nov 6, 2026
fb0173a
feat(installer): verify and preload HA image
zjhong Nov 6, 2026
a90b27f
fix(installer): verify HA archive digest before load
zjhong Nov 6, 2026
b42943c
fix(release): include signed manifest in release assets
zjhong Nov 6, 2026
309e4c9
feat(installer): stage verified plugin bundles
zjhong Nov 6, 2026
a13b5e8
build: prepare signed HA plugin candidates
zjhong Nov 6, 2026
74a9344
build: record installer source in HA catalog
zjhong Nov 6, 2026
7515ad8
fix(installer): defer scope watcher until update unlocks
zjhong Nov 6, 2026
2bd2e8d
fix(installer): resume verified HA bundle activation
zjhong Nov 7, 2026
4b2b3c6
fix(installer): allow deferred PostgreSQL password in preflight
zjhong Nov 7, 2026
6123bc9
fix(installer): keep verified scripts LF-normalized
zjhong Nov 7, 2026
8a09db6
fix(installer): preserve Windows atomic config replacement
zjhong Nov 7, 2026
42bcb3c
fix(installer): handle Windows read-only staged files
zjhong Nov 7, 2026
1f2f5a9
refactor(workflow): make HA signing reusable
zjhong Nov 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.py text eol=lf
*.sh text eol=lf
*.bash text eol=lf
116 changes: 116 additions & 0 deletions .github/workflows/ha-plugin-candidate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Build signed Home Assistant plugin candidate

on:
workflow_call:
inputs:
version:
description: Plugin version, for example 1.0.0
required: true
type: string
connector_commit:
description: Full reviewed Home Assistant connector commit
required: true
type: string
sdk_tag:
description: Published connector SDK tag used by the connector
required: true
type: string
sdk_commit:
description: Full commit referenced by the SDK tag
required: true
type: string
installer_commit:
description: Full reviewed installer commit containing this workflow and its build inputs
required: true
type: string
secrets:
TP_PLUGIN_CATALOG_SIGNING_KEY:
required: true

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.installer_commit }}
- name: Validate release inputs
env:
VERSION: ${{ inputs.version }}
CONNECTOR_COMMIT: ${{ inputs.connector_commit }}
SDK_TAG: ${{ inputs.sdk_tag }}
SDK_COMMIT: ${{ inputs.sdk_commit }}
run: |
set -euo pipefail
[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
[[ "$CONNECTOR_COMMIT" =~ ^[0-9a-f]{40}$ ]]
[[ "$SDK_COMMIT" =~ ^[0-9a-f]{40}$ ]]
[[ "$SDK_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]
git ls-remote --tags https://github.com/ThingsPanel/device-connector-sdk-go.git "refs/tags/$SDK_TAG" "refs/tags/$SDK_TAG^{}" > "$RUNNER_TEMP/sdk-ref"
actual=$(awk '/\^\{\}$/ {print $1; found=1} END {if (!found) {}}' "$RUNNER_TEMP/sdk-ref")
if [ -z "$actual" ]; then actual=$(awk 'NR==1 {print $1}' "$RUNNER_TEMP/sdk-ref"); fi
test "$actual" = "$SDK_COMMIT"
- uses: actions/checkout@v4
with:
repository: ThingsPanel/thingspanel-device-connector-homeassistant
ref: ${{ inputs.connector_commit }}
path: ha-connector
- uses: actions/setup-go@v5
with:
go-version: '1.24.x'
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Build architecture-specific Agent and connector image
env:
ARCH: ${{ matrix.arch }}
VERSION: ${{ inputs.version }}
CONNECTOR_COMMIT: ${{ inputs.connector_commit }}
SDK_TAG: ${{ inputs.sdk_tag }}
run: |
set -euo pipefail
test "$(git -C ha-connector rev-parse HEAD)" = "$CONNECTOR_COMMIT"
test -z "$(git -C ha-connector status --porcelain)"
python3 -c 'import pathlib,sys; s=pathlib.Path("ha-connector/go.mod").read_text(); assert "replace github.com/thingspanel/device-connector-sdk-go" not in s; assert ("github.com/thingspanel/device-connector-sdk-go " + sys.argv[1]) in s' "$SDK_TAG"
mkdir -p out
(cd agent && GOOS=linux GOARCH="$ARCH" CGO_ENABLED=0 go build -trimpath -buildvcs=false -o "../out/tp-agent-linux-$ARCH" ./cmd/tp-agent)
docker buildx build --platform "linux/$ARCH" --provenance=false --load --tag "thingspanel/homeassistant-connector:$VERSION-$ARCH" ha-connector
docker image inspect "thingspanel/homeassistant-connector:$VERSION-$ARCH" > "$RUNNER_TEMP/image.json"
python3 -c 'import json,os,pathlib; i=json.loads(pathlib.Path(os.environ["RUNNER_TEMP"],"image.json").read_text())[0]; assert i["Os"]=="linux" and i["Architecture"]==os.environ["ARCH"]; assert not (i.get("Config",{}).get("Labels") or i.get("Config",{}).get("Volumes") or i.get("Config",{}).get("OnBuild")); pathlib.Path(os.environ["RUNNER_TEMP"],"image-id").write_text(i["Id"])'
docker save -o "out/ha-image-linux-$ARCH.tar" "thingspanel/homeassistant-connector:$VERSION-$ARCH"
- name: Sign and verify the catalog
env:
ARCH: ${{ matrix.arch }}
VERSION: ${{ inputs.version }}
CONNECTOR_COMMIT: ${{ inputs.connector_commit }}
SDK_COMMIT: ${{ inputs.sdk_commit }}
INSTALLER_COMMIT: ${{ inputs.installer_commit }}
SIGNING_KEY: ${{ secrets.TP_PLUGIN_CATALOG_SIGNING_KEY }}
run: |
set -euo pipefail
test -n "$SIGNING_KEY"
umask 077
key="$RUNNER_TEMP/plugin-signing-key.pem"
trap 'rm -f "$key"' EXIT
printf '%s\n' "$SIGNING_KEY" > "$key"
export IMAGE_ID="$(cat "$RUNNER_TEMP/image-id")"
export IMAGE_SHA="$(sha256sum "out/ha-image-linux-$ARCH.tar" | cut -d' ' -f1)"
export AGENT_SHA="$(sha256sum "out/tp-agent-linux-$ARCH" | cut -d' ' -f1)"
python3 -c 'import json,os,pathlib; e=json.loads(pathlib.Path("plugins/homeassistant.json").read_text()); e.update(version=os.environ["VERSION"], image_id=os.environ["IMAGE_ID"], image_platform="linux/"+os.environ["ARCH"], image_archive_sha256=os.environ["IMAGE_SHA"], source_commit=os.environ["CONNECTOR_COMMIT"], sdk_commit=os.environ["SDK_COMMIT"], installer_commit=os.environ["INSTALLER_COMMIT"]); pathlib.Path(os.environ["RUNNER_TEMP"],"homeassistant.json").write_text(json.dumps(e,sort_keys=True,indent=2)+"\n")'
python3 tools/plugin_catalog.py publish --key "$key" --out "$RUNNER_TEMP/catalog" --version "$VERSION" --valid-days 3650 --plugin-file "$RUNNER_TEMP/homeassistant.json" --target-platform "linux/$ARCH" --release-tag "plugin-ha-v$VERSION" --agent-sha256 "$AGENT_SHA"
python3 tools/plugin_catalog.py verify --trust-root config/native/plugin_catalog_trust.pem --catalog "$RUNNER_TEMP/catalog/plugin-catalog.json"
cp "$RUNNER_TEMP/catalog/plugin-catalog.json" "out/catalog-linux-$ARCH.json"
cp "$RUNNER_TEMP/catalog/plugin-catalog.json.sig" "out/catalog-linux-$ARCH.json.sig"
- uses: actions/upload-artifact@v4
with:
name: homeassistant-plugin-linux-${{ matrix.arch }}
path: out/*
if-no-files-found: error
retention-days: 14
41 changes: 39 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ concurrency:

jobs:

update-transaction:
uses: ./.github/workflows/update-transaction.yml

# ── 确定版本号 ──────────────────────────────────────────────────────────────
prepare:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,9 +55,13 @@ jobs:
TP_AUTOMATION_TOKEN=syntax-check-only
TP_MQTT_USER=syntax-check-only
TP_MQTT_PASSWORD=syntax-check-only
TP_PROTOCOL_MQTT_USER=syntax-check-only
TP_PROTOCOL_MQTT_PASSWORD=syntax-check-only
TP_NATIVE_DB_PASSWORD=syntax-check-only
TP_NOTIFICATION_KEYRING_B64=syntax-check-only
TP_THINGSVIS_AUTH_SECRET=syntax-check-only-not-a-runtime-auth-secret
EOF
python3 config/native/prepare.py

- name: Validate docker-compose syntax
run: docker compose config --quiet
Expand All @@ -68,6 +75,7 @@ jobs:
--add-host thingsvis-studio:127.0.0.1 \
--add-host encore-api:127.0.0.1 \
--add-host notification-core:127.0.0.1 \
-v "$PWD/config/native:/run/config:ro" \
-v "$PWD/niginx.conf:/etc/nginx/nginx.conf:ro" \
nginx:alpine nginx -t
fi
Expand All @@ -81,7 +89,7 @@ jobs:

build-windows:
runs-on: windows-latest
needs: [prepare, validate]
needs: [prepare, validate, update-transaction]
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -117,7 +125,7 @@ jobs:

build-macos:
runs-on: macos-latest
needs: [prepare, validate]
needs: [prepare, validate, update-transaction]
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -169,9 +177,36 @@ jobs:
sha256sum ../install.sh >> SHA256SUMS.txt
cat SHA256SUMS.txt

# The signing key is a repository secret (an ECDSA P-256 private key, PEM). Without
# it no manifest is produced and installers keep their unsigned behaviour.
# The matching public key is the trust root installers receive out of band; it is never
# taken from this repository or from the payload.
- name: Sign release manifest
id: sign
env:
RELEASE_SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
run: |
if [ -z "$RELEASE_SIGNING_KEY" ]; then
echo "::warning::RELEASE_SIGNING_KEY is not configured; the release manifest is not signed"
echo "signed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
umask 077
key="$RUNNER_TEMP/release-key.pem"
printf '%s\n' "$RELEASE_SIGNING_KEY" > "$key"
mkdir -p dist/signed
git archive HEAD | tar -x -C dist/signed
python3 tools/sign_release.py --payload dist/signed --key "$key" \
--version "${{ needs.prepare.outputs.version }}" --commit "$GITHUB_SHA" \
--publisher "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/.github/workflows/release.yml"
shred -u "$key" 2>/dev/null || rm -f "$key"
cp dist/signed/release-manifest.json dist/signed/release-manifest.json.sig dist/
echo "signed=true" >> "$GITHUB_OUTPUT"

- name: Create Release
uses: softprops/action-gh-release@v2
with:
fail_on_unmatched_files: false
tag_name: ${{ needs.prepare.outputs.version }}
name: "ThingsPanel All-in-One ${{ needs.prepare.outputs.version }}"
body: |
Expand All @@ -196,6 +231,8 @@ jobs:
draft: false
prerelease: ${{ contains(needs.prepare.outputs.version, 'rc') || contains(needs.prepare.outputs.version, 'beta') }}
files: |
dist/release-manifest.json
dist/release-manifest.json.sig
dist/windows/*.exe
dist/macos/*.pkg
dist/SHA256SUMS.txt
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/update-transaction.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Installer update transaction

on:
workflow_call:

jobs:
transaction:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Test staged update, recovery and locking without Docker or network
run: python -m unittest discover -s tests -v
- name: Parse PowerShell entrypoints without executing installation
if: runner.os == 'Windows'
shell: pwsh
run: |
foreach ($path in @('install.core.ps1', 'upgrade.ps1')) {
$tokens = $null
$errors = $null
[void][System.Management.Automation.Language.Parser]::ParseFile((Join-Path $PWD $path), [ref]$tokens, [ref]$errors)
if ($errors.Count -gt 0) { throw "PowerShell parse failed: $path" }
}
5 changes: 5 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ on:
- 'uninstall.ps1'
- '*.bash'
- 'config/native/**'
- 'tests/**'
- 'packaging/**'
- '.github/workflows/validate.yml'
- '.github/workflows/update-transaction.yml'
- '.github/workflows/release.yml'

jobs:
update-transaction:
uses: ./.github/workflows/update-transaction.yml

validate:
runs-on: ubuntu-latest
steps:
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ Desktop.ini
packaging/macos/.build/
*.bak
*.bak.*
.thingspanel-update/
__pycache__/
# Isolated regression temporary roots (sandbox tempfile may choose cwd).
tp-stage-synthetic-*/
tp-update-unit-*/

# IDE
.vscode/settings.json
Expand Down
Loading
Loading