mirror of
https://github.com/storytold/deckcraft.git
synced 2026-11-26 21:29:57 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b81421cab6 | ||
|
|
a3386f3f7b | ||
|
|
08ba5072a7 |
@@ -2,13 +2,13 @@
|
||||
"schema": "craft-nightly-release-policy/v3",
|
||||
"repository": "storytold/deckcraft",
|
||||
"repository_id": 1408294296,
|
||||
"producer_workflow_id": null,
|
||||
"producer_workflow_id": 429734568,
|
||||
"producer_workflow_path": ".github/workflows/nightly.yml",
|
||||
"producer_tooling_revision": "605d58766e8f536564da8fc81d3676ac86816dea",
|
||||
"producer_workflow_ref": "storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@605d58766e8f536564da8fc81d3676ac86816dea",
|
||||
"producer_tooling_revision": "be00e5ccd18b68e950c8a08532f2230e7c3d0cba",
|
||||
"producer_workflow_ref": "storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@be00e5ccd18b68e950c8a08532f2230e7c3d0cba",
|
||||
"signer_workflow_path": ".github/workflows/nightly-sign.yml",
|
||||
"signer_tooling_revision": "605d58766e8f536564da8fc81d3676ac86816dea",
|
||||
"release_branch": "release",
|
||||
"signer_tooling_revision": "be00e5ccd18b68e950c8a08532f2230e7c3d0cba",
|
||||
"release_branch": "nightly-signer",
|
||||
"manual_actors": [
|
||||
"bflatastic",
|
||||
"dylanmtaylor",
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
name: DeckCraft release-ref nightly signer
|
||||
|
||||
# Enabled for supervised manual dispatch on release. Main/release contents must match.
|
||||
# A reusable callee does not change context; this must be a real top-level release dispatch.
|
||||
# Enabled for supervised manual dispatch on the dedicated nightly-signer branch, which only ever
|
||||
# fast-forwards to reviewed main commits (never the stable release branch).
|
||||
# A reusable callee does not change context; this must be a real top-level signer-branch dispatch.
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
@@ -22,21 +23,23 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
# Actual context guards: official repository, manual dispatch, real release branch.
|
||||
# Actual context guards: official repository, manual dispatch, real nightly-signer branch.
|
||||
if: >-
|
||||
github.repository == 'storytold/deckcraft' &&
|
||||
github.event_name == 'workflow_dispatch' &&
|
||||
github.ref == 'refs/heads/release' && github.ref_type == 'branch'
|
||||
github.ref == 'refs/heads/nightly-signer' && github.ref_type == 'branch'
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
checks: read
|
||||
attestations: write
|
||||
id-token: write
|
||||
uses: storytold/craft-common-actions/.github/workflows/nightly-release.yml@605d58766e8f536564da8fc81d3676ac86816dea
|
||||
uses: storytold/craft-common-actions/.github/workflows/nightly-release.yml@be00e5ccd18b68e950c8a08532f2230e7c3d0cba
|
||||
with:
|
||||
tooling-revision: 605d58766e8f536564da8fc81d3676ac86816dea
|
||||
tooling-revision: be00e5ccd18b68e950c8a08532f2230e7c3d0cba
|
||||
app-name: deckcraft
|
||||
producer_run_id: ${{ inputs.producer_run_id }}
|
||||
producer_run_attempt: ${{ inputs.producer_run_attempt }}
|
||||
# No secrets: inherit or raw platform values in this caller. Only the isolated native
|
||||
# callee job may bind the existing release environment and export keys in its signing step.
|
||||
# callee job may bind the release environment and export its keys; that environment must
|
||||
# admit nightly-signer alongside release before the first dispatch.
|
||||
|
||||
@@ -22,13 +22,13 @@ jobs:
|
||||
actions: read
|
||||
attestations: write
|
||||
id-token: write
|
||||
uses: storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@605d58766e8f536564da8fc81d3676ac86816dea
|
||||
uses: storytold/craft-common-actions/.github/workflows/nightly-unsigned.yml@be00e5ccd18b68e950c8a08532f2230e7c3d0cba
|
||||
with:
|
||||
tooling-revision: 605d58766e8f536564da8fc81d3676ac86816dea
|
||||
tooling-revision: be00e5ccd18b68e950c8a08532f2230e7c3d0cba
|
||||
app-name: deckcraft
|
||||
manual-actors: '["bflatastic","dylanmtaylor","echelon","FredApps","skylartaylor"]'
|
||||
craft-fonts-ref: 37827adc41fd165f9a9234ac40f94dbad353aa69
|
||||
# One producer run builds every listed platform for one all-or-nothing release. The pin is the
|
||||
# craft-common-actions main commit that merged #339 (bounded lineage compares), on top of the
|
||||
# Linux/macOS signer (#342).
|
||||
# craft-common-actions main commit that merged the exact-analysis admission (#371, after #370,
|
||||
# #369 and #364).
|
||||
platforms: '["windows-x86_64","linux-x86_64","macos-aarch64"]'
|
||||
|
||||
Generated
+19
-19
@@ -1268,7 +1268,7 @@ checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f"
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"chrono",
|
||||
@@ -1292,7 +1292,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-anim"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"deckcraft-geom",
|
||||
"deckcraft-model",
|
||||
@@ -1301,7 +1301,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-cli"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"deckcraft-engine",
|
||||
"deckcraft-mcp",
|
||||
@@ -1311,14 +1311,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-color"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"craft-drawingml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-engine"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"craft-mime",
|
||||
@@ -1346,7 +1346,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-fonts"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"epaint_default_fonts",
|
||||
"harfrust 0.13.3",
|
||||
@@ -1358,7 +1358,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-format"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"craft-deckcraft-format",
|
||||
"craft-rtf",
|
||||
@@ -1369,7 +1369,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-geom"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"craft-drawingml",
|
||||
"kurbo",
|
||||
@@ -1378,7 +1378,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-mcp"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"craft-mcp-server",
|
||||
"deckcraft-engine",
|
||||
@@ -1389,7 +1389,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-media"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"craft-audio",
|
||||
"craft-media",
|
||||
@@ -1402,7 +1402,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-model"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"craft-drawingml",
|
||||
"deckcraft-color",
|
||||
@@ -1415,7 +1415,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-pdf"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"craft-pdf",
|
||||
"deckcraft-fonts",
|
||||
@@ -1433,7 +1433,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-ppt"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"deckcraft-color",
|
||||
"deckcraft-engine",
|
||||
@@ -1448,7 +1448,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-pptx"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"craft-cfb",
|
||||
"craft-drawingml",
|
||||
@@ -1468,7 +1468,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-render"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"craft-metafile",
|
||||
"deckcraft-anim",
|
||||
@@ -1487,7 +1487,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-text"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"deckcraft-color",
|
||||
@@ -1501,7 +1501,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-ui-egui"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"craft-ui",
|
||||
"craft-update",
|
||||
@@ -1527,7 +1527,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deckcraft-web"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"craft-web-api",
|
||||
"craft-web-host",
|
||||
@@ -6740,7 +6740,7 @@ checksum = "9440ea3e5aeabb0ac63af70daf835274065238cdd0cec83418f417eae38bacee"
|
||||
|
||||
[[package]]
|
||||
name = "xtask"
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ members = ["crates/*", "apps/*", "xtask"]
|
||||
default-members = ["crates/*", "apps/deckcraft", "apps/deckcraft-cli"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.19.1"
|
||||
version = "0.19.0"
|
||||
edition = "2024"
|
||||
license = "MIT OR Apache-2.0"
|
||||
rust-version = "1.95"
|
||||
|
||||
@@ -183,10 +183,13 @@ dictionary or single window state. The Nightly app is started only by ArtCraft L
|
||||
fenced against every stable data and install folder, so a Nightly window cannot fall back to
|
||||
stable state. Nightly is managed by the Launcher and does not self-update.
|
||||
|
||||
On Linux, every Nightly format starts through the same launcher
|
||||
(`packaging/linux/nightly-launch.sh`): the `.tar.gz` and AppImage, the deb/rpm package, the Flatpak
|
||||
and the Arch handoff all pass `--launch-profile nightly-v1 --profile-root <dir> -- <files>` to the
|
||||
GUI, so an unpacked or distro-installed copy is isolated without the Launcher.
|
||||
On Linux, the plain nightly `.tar.gz` starts through the canonical shared launcher template
|
||||
(`packaging/linux/nightly-launch.sh`, rendered from `craft-common-actions`'s
|
||||
`scripts/nightly-launcher.sh.in`): `deckcraft` starts `deckcraft-bin` beside it on the nightly-v1
|
||||
profile under the Nightly package identity. The distro formats keep their own launcher
|
||||
(`packaging/linux/nightly-package-launch.sh`) and their own profile folder; the AppImage, the deb/rpm
|
||||
package, the Flatpak and the Arch handoff all pass `--launch-profile nightly-v1 --profile-root <dir>
|
||||
-- <files>` to the GUI, so an unpacked or distro-installed copy is isolated without the Launcher.
|
||||
|
||||
The channel's packaging lives in `packaging/nightly-common.sh`, `packaging/{linux,macos,windows}/nightly*`
|
||||
and `.github/workflows/nightly*.yml`. The producer and signer workflows are registered and can be
|
||||
|
||||
@@ -253,12 +253,20 @@ fn initialize_nightly_process_identity() -> Result<(), process_identity::Identit
|
||||
)
|
||||
}
|
||||
|
||||
/// Whether a refusal may also open a native message box. Standard error always carries the reason;
|
||||
/// this only adds a box where one renders without the app's event loop. Never on macOS: rfd's alert
|
||||
/// there needs the AppKit run loop this start has not reached, so a refused nightly launch hung in
|
||||
/// an invisible modal instead of exiting (GridCraft Mac smoke, 2026-11-26).
|
||||
fn refusal_dialog(flavor: build_flavor::BuildFlavor, desktop_session: bool, macos: bool) -> bool {
|
||||
build_flavor::needs_native_error(flavor, desktop_session) && !macos
|
||||
}
|
||||
|
||||
fn report_launch_profile_error(error: &str) {
|
||||
eprintln!("DeckCraft launch profile: {error}");
|
||||
let desktop_session = cfg!(windows)
|
||||
|| cfg!(target_os = "macos")
|
||||
|| (cfg!(target_os = "linux") && ["DISPLAY", "WAYLAND_DISPLAY"].into_iter().any(|key| std::env::var_os(key).is_some_and(|v| !v.is_empty())));
|
||||
if build_flavor::needs_native_error(build_flavor::COMPILED, desktop_session) {
|
||||
if refusal_dialog(build_flavor::COMPILED, desktop_session, cfg!(target_os = "macos")) {
|
||||
if let Err(error) = initialize_nightly_process_identity() {
|
||||
eprintln!("DeckCraft launch profile: {error}");
|
||||
return;
|
||||
@@ -672,3 +680,17 @@ mod tests {
|
||||
assert!(script.contains("has no embedded icon"), "package.ps1 does not reject an iconless exe");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod refusal_dialog_tests {
|
||||
use super::refusal_dialog;
|
||||
use crate::build_flavor::BuildFlavor;
|
||||
|
||||
#[test]
|
||||
fn a_refusal_never_blocks_on_a_modal_before_the_event_loop_on_macos() {
|
||||
assert!(refusal_dialog(BuildFlavor::NightlyV1, true, false), "a desktop refusal still shows the box where one renders");
|
||||
assert!(!refusal_dialog(BuildFlavor::NightlyV1, true, true), "macOS has no run loop yet: the modal would hang");
|
||||
assert!(!refusal_dialog(BuildFlavor::NightlyV1, false, false), "a headless session has no box");
|
||||
assert!(!refusal_dialog(BuildFlavor::Stable, true, false), "only a nightly refusal explains itself in a box");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# Windows, Linux and macOS release-ref nightly: supervised manual go-live
|
||||
|
||||
**Enabled for supervised manual runs, not yet qualified.** The producer (`nightly.yml`, main) and the
|
||||
signer (`nightly-sign.yml`, release) keep only their exact context guards and run when one of the reviewed
|
||||
manual actors dispatches them. There is no schedule and no automatic dispatch transport yet. The installed
|
||||
policy [`.github/nightly-signing-policy.json`](../.github/nightly-signing-policy.json) is the real v3
|
||||
policy. Once `nightly.yml` lands on `main`, populate `producer_workflow_id` with its registration ID:
|
||||
signer (`nightly-sign.yml`, on the dedicated `nightly-signer` branch) keep only their exact context
|
||||
guards and run when one of the reviewed manual actors dispatches them. There is no schedule and no
|
||||
automatic dispatch transport yet. The installed policy
|
||||
[`.github/nightly-signing-policy.json`](../.github/nightly-signing-policy.json) is the real v3 policy.
|
||||
Its `producer_workflow_id` is `nightly.yml`'s registration on `main`:
|
||||
|
||||
```bash
|
||||
gh api repos/storytold/deckcraft/actions/workflows/nightly.yml --jq .id
|
||||
@@ -13,26 +14,40 @@ gh api repos/storytold/deckcraft/actions/workflows/nightly.yml --jq .id
|
||||
The callers pass no platform secrets. The unsigned reusable caller's maximum OIDC/attestation
|
||||
permissions are for its isolated attester; its compiler narrows to contents and Actions read
|
||||
only, with no OIDC, attestation write, release environment or platform signing secrets.
|
||||
Shared tooling is pinned to `605d58766e8f536564da8fc81d3676ac86816dea`, the craft-common-actions
|
||||
main commit that merged [#339](https://github.com/storytold/craft-common-actions/pull/339) (bounded
|
||||
lineage compares and an issue reread at the end of candidate admission) on top of
|
||||
[#342](https://github.com/storytold/craft-common-actions/pull/342) (policy v3, the `platforms` input
|
||||
and the Linux and macOS legs). Both callers name it in `uses` and `tooling-revision`. A pin is reviewed
|
||||
source availability, not provider, queue, native signing or crypto qualification.
|
||||
Shared tooling is pinned to `be00e5ccd18b68e950c8a08532f2230e7c3d0cba`, the craft-common-actions
|
||||
main commit that merged [#371](https://github.com/storytold/craft-common-actions/pull/371) (the
|
||||
candidate is admitted on the built commit's own Sonar analysis, not main's latest) after
|
||||
[#370](https://github.com/storytold/craft-common-actions/pull/370) (the Windows and macOS nightly
|
||||
registry rows for the 14 apps) and
|
||||
[#369](https://github.com/storytold/craft-common-actions/pull/369) (shared helper checkouts kept out
|
||||
of the app's clean-source check, and macOS on `macos-15`), following
|
||||
[#364](https://github.com/storytold/craft-common-actions/pull/364) (the signer may run on the
|
||||
policy's signer branch) and [#363](https://github.com/storytold/craft-common-actions/pull/363) (the
|
||||
multi-app pipeline, which makes the signer's `app-name` input required and admits any reviewed
|
||||
registry app), with #342 (`a4f6fd51`, policy v3 and the `platforms` input) and #339 (`605d5876`)
|
||||
earlier. Both callers name it in `uses` and `tooling-revision`. A pin is reviewed source
|
||||
availability, not provider, queue, native signing or crypto qualification.
|
||||
Existing stable workflows are unchanged.
|
||||
|
||||
**The shared-workflow port is a prerequisite.** At this pin both reusable workflows admit only
|
||||
PhotoCraft: `nightly-unsigned.yml` requires `inputs.app-name == 'photocraft'` and
|
||||
`github.repository == 'storytold/photocraft'` on its build jobs, and `nightly-release.yml` requires the
|
||||
same repository in `validate` and every signing job (its concurrency group is
|
||||
`craft-release-ref-signer-photocraft`). A DeckCraft dispatch therefore builds and signs nothing until
|
||||
`storytold/craft-common-actions` admits `storytold/deckcraft`. No dispatch can produce a release before
|
||||
that port, and both callers' `uses`, `tooling-revision` and the policy pins must move to the same
|
||||
reviewed revision together.
|
||||
|
||||
**First runs.** The first runs are manual dispatches in this order: `nightly.yml` on main (only a
|
||||
listed manual actor passes the producer's plan step), then `nightly-sign.yml` on `release` with that
|
||||
producer run ID and attempt, by a listed manual actor.
|
||||
listed manual actor passes the producer's plan step), then `nightly-sign.yml` on `nightly-signer`
|
||||
with that producer run ID and attempt, by a listed manual actor.
|
||||
|
||||
**Signer branch.** The signer runs on `refs/heads/nightly-signer`, not on the stable `release`
|
||||
branch, so nightly signer files never need a stable release sync. The policy's `release_branch`
|
||||
names it and the signer's guard requires it; this app has no automatic dispatch transport, so
|
||||
nothing else targets the branch. The branch only fast-forwards to reviewed main commits, through the
|
||||
settings script's `advance` (no queued signer run, a trust-closure scan, then the full diff of
|
||||
`.github/` and `packaging/`), and the existing `release` environment must admit `nightly-signer`
|
||||
alongside `release` before the first dispatch (a repository settings change, not a workflow one).
|
||||
Its trust closure is all of `.github/` and `packaging/`, including `packaging/common.sh` (this app
|
||||
ships no `packaging/env.sh`), which `import-cert.sh` sources with the Apple keys. On that branch
|
||||
only the pinned `nightly-sign.yml` caller may reach an environment: no app workflow binds one, and
|
||||
the only caller of the shared stable `release.yml` is `release.yml`, whose callee must carry the
|
||||
stable-only environment guard. The contract tests check the in-repo part on every main PR; the
|
||||
settings scan also resolves the callee. Stable releases still come only from `refs/heads/release`.
|
||||
History does not carry over a switch between `release` and `nightly-signer`, so the switch happens
|
||||
before the first publication.
|
||||
|
||||
**Manual actors.** `bflatastic`, `dylanmtaylor`, `echelon`, `FredApps` and `skylartaylor`, in the
|
||||
producer's `manual-actors` and the policy's `manual_actors`. The list mirrors the release-managers
|
||||
@@ -51,28 +66,28 @@ there is no separate Linux or macOS caller job and the signer caller has no plat
|
||||
|
||||
## Installed policy values and their sources
|
||||
|
||||
Read on 2026-11-24; re-read anything that may have moved before the policy is promoted to `release`.
|
||||
Read on 2026-11-24, with `producer_workflow_id` filled on 2026-11-25; re-read anything that may have moved before `nightly-signer` is advanced to it.
|
||||
|
||||
| Field | Value | Source |
|
||||
|---|---|---|
|
||||
| `repository_id` | `1408294296` | `gh api repos/storytold/deckcraft --jq .id` |
|
||||
| `producer_workflow_id` | `null` (populate after `nightly.yml` reaches `main`) | `gh api repos/storytold/deckcraft/actions/workflows/nightly.yml --jq .id` |
|
||||
| `producer_tooling_revision`, `signer_tooling_revision`, `producer_workflow_ref` | `605d5876…` (craft-common-actions #339) | The callers' pin |
|
||||
| `producer_workflow_id` | `429734568` | `gh api repos/storytold/deckcraft/actions/workflows/nightly.yml --jq .id` on `main` |
|
||||
| `producer_tooling_revision`, `signer_tooling_revision`, `producer_workflow_ref` | `be00e5cc…` (the exact-analysis admission, #371 after #370 and #369, following #364 on #363) | The callers' pin |
|
||||
| `manual_actors` / `automatic_signer_actors` | the five release managers / `[]` | release-managers team (id 19837241) members who can push; equals the producer caller's `manual-actors` |
|
||||
| `max_age_seconds`, `max_artifact_bytes` | `86400`, `2147483648` | Go-live checklist |
|
||||
| `platforms` | three rows | Storytold stable signing identities (`windows-x86_64`, `linux-x86_64`, `macos-aarch64`) |
|
||||
| `candidate_policy.required_workflows` | CI (`ci.yml`, workflow `377160704`), 2 jobs | Workflow list API; jobs that succeeded on recent `main` push runs |
|
||||
| `candidate_policy.sonar` | `storytold` / `storytold_deckcraft`, app `12526` | `sonar-project.properties`; the SonarCloud check on `main` commits |
|
||||
| Sonar conditions | `new_security_rating` accepted (max 5); the other five required | Standard Storytold SonarCloud quality gate |
|
||||
| Sonar `issue_types` / `debt` | `VULNERABILITY` / `[]` | Update before promotion if any unresolved `main` vulnerabilities exist |
|
||||
| Sonar `issue_types` / `debt` | `VULNERABILITY` / `[]` | Update before advancing `nightly-signer` if any unresolved `main` vulnerabilities exist |
|
||||
|
||||
## Ownership and interface
|
||||
|
||||
- `.github/workflows/nightly.yml`: default-main registration of the unsigned producer, named
|
||||
`DeckCraft unsigned nightly`, enabled for manual dispatch by `manual-actors`; no signing secrets
|
||||
may be passed or inherited.
|
||||
- `.github/workflows/nightly-sign.yml`: top-level release registration, enabled for manual dispatch,
|
||||
and identical on `main` and `release` after reviewed promotion. It rejects wrong repository/event/actual
|
||||
- `.github/workflows/nightly-sign.yml`: top-level signer registration, enabled for manual dispatch on
|
||||
`nightly-signer`, which carries a reviewed main commit. It rejects wrong repository/event/actual
|
||||
branch, including same-name tags. Its constant whole-run concurrency is distinct from stable,
|
||||
cancellation is off and `queue: max` must be hosted-qualified. The caller itself passes no
|
||||
credentials; only the shared callee's sign jobs bind the `release` environment.
|
||||
@@ -85,4 +100,5 @@ Read on 2026-11-24; re-read anything that may have moved before the policy is pr
|
||||
`python3 packaging/nightly-release-tests.py` verifies the installed v3 policy, exact context guards
|
||||
on `nightly.yml` and `nightly-sign.yml`, manual actor alignment, platform list and trust anchors,
|
||||
shared tooling pin alignment, no-cache/no-platform-secret boundaries, and root concurrency
|
||||
serialization (`deckcraft-nightly-release`, `queue: max`, `cancel-in-progress: false`).
|
||||
serialization (`deckcraft-nightly-release`, `cancel-in-progress: false`), the signer branch and
|
||||
`app-name` agreement, and the trust-closure scan.
|
||||
|
||||
@@ -13,7 +13,7 @@ mkdir -p "$work"
|
||||
cp -R "$source_tree" "$stage"
|
||||
mkdir "$stage/bin/.deckcraft-nightly"
|
||||
mv "$stage/bin/deckcraft" "$stage/bin/.deckcraft-nightly/deckcraft-bin"
|
||||
cp "$here/nightly-launch.sh" "$stage/bin/deckcraft"
|
||||
cp "$here/nightly-package-launch.sh" "$stage/bin/deckcraft"
|
||||
chmod 755 "$stage/bin/deckcraft"
|
||||
tar -C "$work" -czf "$destination/$basename.tar.gz" "$basename"
|
||||
echo "wrote $destination/$basename.tar.gz"
|
||||
|
||||
@@ -1,17 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# Validate the nightly launcher in every Linux placement without building or opening DeckCraft:
|
||||
# the flat nightly tar (`deckcraft` + `deckcraft-bin`), the AppImage (`AppRun` + `usr/bin/deckcraft`),
|
||||
# the distro tree (`bin/deckcraft-nightly` + `bin/deckcraft-bin`) and the /usr/bin rule that reaches
|
||||
# the fixed /usr/lib copy. A recorder binary stands in for the GUI and prints its argv.
|
||||
# Validate both Nightly Linux launchers without building or opening DeckCraft.
|
||||
#
|
||||
# The flat nightly tar's `deckcraft` is the canonical shared template
|
||||
# (`packaging/linux/nightly-launch.sh`, rendered from craft-common-actions's
|
||||
# `scripts/nightly-launcher.sh.in`), which the nightly producer accepts byte for byte: it starts
|
||||
# `deckcraft-bin` beside itself on the nightly-v1 profile under the Nightly package identity.
|
||||
#
|
||||
# The distro formats keep `packaging/linux/nightly-package-launch.sh` and their own profile folder:
|
||||
# the AppImage (`AppRun` + `usr/bin/deckcraft-bin`), the distro tree (`bin/deckcraft-nightly` +
|
||||
# `bin/deckcraft-bin`) and the /usr/bin rule that reaches the fixed /usr/lib copy. A recorder binary
|
||||
# stands in for the GUI and prints its argv.
|
||||
set -euo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
work="$(mktemp -d)"
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
launcher="$HERE/nightly-launch.sh"
|
||||
package_launcher="$HERE/nightly-package-launch.sh"
|
||||
export HOME="$work/home"
|
||||
mkdir -p "$HOME"
|
||||
export XDG_CONFIG_HOME="$HOME/.config" XDG_DATA_HOME="$HOME/.local/share"
|
||||
identity=ai.storyteller.deckcraft.nightly
|
||||
tar_profile="$XDG_DATA_HOME/$identity"
|
||||
profile="$XDG_DATA_HOME/deckcraft-nightly/launcher/profiles/deckcraft"
|
||||
|
||||
recorder() {
|
||||
@@ -36,30 +46,52 @@ expect() {
|
||||
nightly_argv() {
|
||||
printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$profile" --
|
||||
}
|
||||
tar_argv() {
|
||||
printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$tar_profile" --
|
||||
}
|
||||
|
||||
# ---- the flat nightly tar: `deckcraft` launcher, `deckcraft-bin` GUI ----
|
||||
# ---- the flat nightly tar: the canonical template `deckcraft`, `deckcraft-bin` GUI ----
|
||||
flat="$work/flat"
|
||||
recorder "$flat/deckcraft-bin"
|
||||
cp "$launcher" "$flat/deckcraft"
|
||||
chmod 755 "$flat/deckcraft"
|
||||
expect "$flat/deckcraft" "$(nightly_argv)"
|
||||
expect "$flat/deckcraft" "$(nightly_argv; printf '<%s>\n' 'deck with spaces.pptx' '--other-name.pptx')" \
|
||||
expect "$flat/deckcraft" "$(tar_argv)"
|
||||
expect "$flat/deckcraft" "$(tar_argv; printf '<%s>\n' 'deck with spaces.pptx' '--other-name.pptx')" \
|
||||
'deck with spaces.pptx' '--other-name.pptx'
|
||||
expect "$flat/deckcraft" "$(nightly_argv; printf '<%s>\n' 'deck.pptx')" -- deck.pptx
|
||||
expect "$flat/deckcraft" '<--version>' --version
|
||||
expect "$flat/deckcraft" '<-V>' -V
|
||||
expect "$flat/deckcraft" '<--help>' --help
|
||||
expect "$flat/deckcraft" "$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$work/launcher" -- 'deck.pptx')" \
|
||||
--launch-profile nightly-v1 --profile-root "$work/launcher" -- 'deck.pptx'
|
||||
test ! -e "$profile"
|
||||
# Both version spellings reach the GUI as one plain `--version`.
|
||||
expect "$flat/deckcraft" "$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$tar_profile" --version)" --version
|
||||
expect "$flat/deckcraft" "$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$tar_profile" --version)" -V
|
||||
# The ArtCraft Launcher starts the entry point with its own profile pair; the template hands that
|
||||
# line to the GUI unchanged.
|
||||
launcher_line=(--launch-profile nightly-v1 --profile-root "$work/launcher root" -- deck.pptx)
|
||||
expect "$flat/deckcraft" "$(printf '<%s>\n' "${launcher_line[@]}")" "${launcher_line[@]}"
|
||||
# Anything else is a file argument with the template's own profile, including a query the template
|
||||
# does not answer (`--help`) and a profile line that does not open the arguments.
|
||||
expect "$flat/deckcraft" "$(tar_argv; printf '<%s>\n' --help)" --help
|
||||
expect "$flat/deckcraft" "$(tar_argv; printf '<%s>\n' --profile-root "$work/launcher" --)" --profile-root "$work/launcher" --
|
||||
test ! -e "$tar_profile"
|
||||
# The launcher resolves its own folder physically and starts only the GUI beside it.
|
||||
linked="$work/linked/bin"
|
||||
mkdir -p "$(dirname "$linked")"
|
||||
ln -s "$flat" "$linked"
|
||||
expect "$linked/deckcraft" "$(tar_argv; printf '<%s>\n' book.pptx)" book.pptx
|
||||
mkdir -p "$work/flat-empty"
|
||||
cp "$launcher" "$work/flat-empty/deckcraft"
|
||||
chmod 755 "$work/flat-empty/deckcraft"
|
||||
status=0
|
||||
"$work/flat-empty/deckcraft" book.pptx >/dev/null 2>&1 || status=$?
|
||||
[[ "$status" -ne 0 ]] || { echo 'the tar launcher started without its GUI beside it' >&2; exit 1; }
|
||||
status=0
|
||||
env -u XDG_DATA_HOME -u HOME "$flat/deckcraft" book.pptx >/dev/null 2>&1 || status=$?
|
||||
[[ "$status" -ne 0 ]] || { echo 'the tar launcher started without a data folder' >&2; exit 1; }
|
||||
|
||||
# ---- the AppImage: AppRun at the mount root, the GUI and the entry's copy in usr/bin ----
|
||||
appdir="$work/DeckCraft.AppDir"
|
||||
recorder "$appdir/usr/bin/deckcraft-bin"
|
||||
cp "$launcher" "$appdir/AppRun"
|
||||
cp "$package_launcher" "$appdir/AppRun"
|
||||
chmod 755 "$appdir/AppRun"
|
||||
expect "$appdir/AppRun" "$(nightly_argv; printf '<%s>\n' book.pptx)" book.pptx
|
||||
cp "$launcher" "$appdir/usr/bin/deckcraft-nightly"
|
||||
cp "$package_launcher" "$appdir/usr/bin/deckcraft-nightly"
|
||||
chmod 755 "$appdir/usr/bin/deckcraft-nightly"
|
||||
expect "$appdir/usr/bin/deckcraft-nightly" "$(nightly_argv; printf '<%s>\n' book.pptx)" book.pptx
|
||||
test ! -e "$profile"
|
||||
@@ -67,7 +99,7 @@ test ! -e "$profile"
|
||||
# ---- the distro tree tarball: bin/deckcraft-nightly beside bin/deckcraft-bin ----
|
||||
tree="$work/tree/bin"
|
||||
recorder "$tree/deckcraft-bin"
|
||||
cp "$launcher" "$tree/deckcraft-nightly"
|
||||
cp "$package_launcher" "$tree/deckcraft-nightly"
|
||||
chmod 755 "$tree/deckcraft-nightly"
|
||||
actual=$(PATH="$tree:$PATH" deckcraft-nightly book.pptx)
|
||||
[[ "$actual" == "$(nightly_argv; printf '<%s>\n' book.pptx)" ]] || { printf 'a PATH invocation printed:\n%s\n' "$actual" >&2; exit 1; }
|
||||
@@ -76,13 +108,13 @@ test ! -e "$profile"
|
||||
# ---- a missing GUI fails closed, and so does a tree with no data folder ----
|
||||
empty="$work/empty"
|
||||
mkdir -p "$empty"
|
||||
cp "$launcher" "$empty/deckcraft"
|
||||
cp "$package_launcher" "$empty/deckcraft"
|
||||
chmod 755 "$empty/deckcraft"
|
||||
status=0
|
||||
"$empty/deckcraft" book.pptx >/dev/null 2>&1 || status=$?
|
||||
[[ "$status" -eq 2 ]] || { printf 'a launcher with no GUI must exit 2, got %s\n' "$status" >&2; exit 1; }
|
||||
recorder "$work/nodata/deckcraft-bin"
|
||||
cp "$launcher" "$work/nodata/deckcraft"
|
||||
cp "$package_launcher" "$work/nodata/deckcraft"
|
||||
chmod 755 "$work/nodata/deckcraft"
|
||||
status=0
|
||||
env -u XDG_DATA_HOME -u HOME "$work/nodata/deckcraft" book.pptx >/dev/null 2>&1 || status=$?
|
||||
@@ -92,14 +124,21 @@ actual=$(env -u XDG_DATA_HOME -u HOME "$work/nodata/deckcraft" --version) \
|
||||
|| { printf 'a no-data-folder --version must still answer\n' >&2; exit 1; }
|
||||
[[ "$actual" == '<--version>' ]] || { printf 'a no-data-folder --version printed:\n%s\n' "$actual" >&2; exit 1; }
|
||||
|
||||
# ---- the /usr/bin rule: the fixed /usr/lib copy is named, and no parent path is ever used ----
|
||||
# ---- the /usr/bin rule stays with the distro launcher: the fixed /usr/lib copy, never a parent path ----
|
||||
# The launcher's text is searched literally, so `$here` must not expand here.
|
||||
# shellcheck disable=SC2016
|
||||
grep -Fq '[ "$here" = /usr/bin ]' "$launcher"
|
||||
grep -Fq '/usr/lib/deckcraft-nightly/deckcraft' "$launcher"
|
||||
if grep -q '\.\.' "$launcher"; then
|
||||
echo "the launcher must not reach outside its own folder or the fixed /usr/lib path" >&2
|
||||
grep -Fq '[ "$here" = /usr/bin ]' "$package_launcher"
|
||||
grep -Fq '/usr/lib/deckcraft-nightly/deckcraft' "$package_launcher"
|
||||
if grep -q '\.\.' "$package_launcher"; then
|
||||
echo "the distro launcher must not reach outside its own folder or the fixed /usr/lib path" >&2
|
||||
exit 1
|
||||
fi
|
||||
# ---- the tar launcher is the shared template, unedited ----
|
||||
grep -Fq '# Nightly launcher generated by craft-common-actions scripts/nightly-launcher.sh.in.' "$launcher"
|
||||
# shellcheck disable=SC2016
|
||||
grep -Fq 'target="$dir/deckcraft-bin"' "$launcher"
|
||||
# shellcheck disable=SC2016
|
||||
grep -Fq ' --launch-profile) exec "$target" "$@" ;;' "$launcher"
|
||||
grep -Fq "}/$identity\"" "$launcher"
|
||||
|
||||
echo "PASS: nightly launcher starts the GUI with the profile in every layout and refuses the rest"
|
||||
echo "PASS: the nightly tar's template launcher and the distro launcher start the GUI with their profile"
|
||||
|
||||
@@ -1,63 +1,16 @@
|
||||
#!/bin/sh
|
||||
# The DeckCraft Nightly launcher every Linux format ships: the plain nightly tar's `deckcraft`, the
|
||||
# distro tree's `bin/deckcraft-nightly`, the AppImage's `AppRun`, the Arch handoff's `bin/deckcraft`
|
||||
# and the Flatpak's `/app/bin/deckcraft-nightly`. A nightly build refuses to start without
|
||||
# `--launch-profile nightly-v1 --profile-root <dir>`, and the profile is its only data root, so
|
||||
# this is what keeps a Nightly run out of the stable app's settings, prefs, logs and recovery.
|
||||
# Nightly launcher generated by craft-common-actions scripts/nightly-launcher.sh.in. Do not edit:
|
||||
# the shared nightly producer accepts this file only byte for byte as rendered for the app.
|
||||
set -eu
|
||||
|
||||
# Resolve this script's own folder from `$0`. A shell that finds it through PATH passes a bare
|
||||
# name, so ask the shell where that is instead of using the working directory.
|
||||
case "$0" in
|
||||
*/*) self="$0" ;;
|
||||
*) self="$(command -v "$0" || printf '%s' "$0")" ;;
|
||||
esac
|
||||
case "$self" in
|
||||
/*) ;;
|
||||
*) self="$PWD/$self" ;;
|
||||
esac
|
||||
here="$(CDPATH='' cd "$(dirname "$self")" && pwd -P)"
|
||||
self="$here/$(basename "$self")"
|
||||
|
||||
# The GUI each placement keeps inside its own tree, never from a parent folder: `deckcraft-bin`
|
||||
# beside the launcher (the flat nightly tar, the distro tree, the Flatpak sandbox), the same name
|
||||
# in an AppImage's `usr/bin`, and the hidden copy the Arch handoff keeps. A candidate that is this
|
||||
# same file is never started, so a launcher cannot recurse into itself.
|
||||
real=
|
||||
for candidate in "$here/deckcraft-bin" "$here/usr/bin/deckcraft-bin" "$here/.deckcraft-nightly/deckcraft-bin"; do
|
||||
if [ -f "$candidate" ] && [ -x "$candidate" ] && [ ! "$candidate" -ef "$self" ]; then
|
||||
real="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
# A distro package keeps the GUI in /usr/lib. Reach that fixed path only from /usr/bin, so a
|
||||
# writable parent folder can never plant a program for this launcher to run.
|
||||
if [ -z "$real" ] && [ "$here" = /usr/bin ] && [ -f /usr/lib/deckcraft-nightly/deckcraft ] && [ -x /usr/lib/deckcraft-nightly/deckcraft ]; then
|
||||
real=/usr/lib/deckcraft-nightly/deckcraft
|
||||
fi
|
||||
if [ -z "$real" ]; then
|
||||
echo "deckcraft-nightly: no DeckCraft binary beside $self" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# A bare version/help query and the Launcher's own protocol pass straight through: they are not
|
||||
# file names, need no data folder, and a profile the caller already supplied is never wrapped
|
||||
# twice. This runs before the data-folder check, so `deckcraft-nightly --version` still answers
|
||||
# where HOME and XDG_DATA_HOME are both unset.
|
||||
dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)
|
||||
readonly dir
|
||||
target="$dir/deckcraft-bin"
|
||||
readonly target
|
||||
profile_root="${XDG_DATA_HOME:-$HOME/.local/share}/ai.storyteller.deckcraft.nightly"
|
||||
readonly profile_root
|
||||
case "${1-}" in
|
||||
--launch-profile | --profile-root | --version | -V | --help | -h) exec "$real" "$@" ;;
|
||||
# The ArtCraft Launcher passes its own profile and per-install root; the app validates the pair.
|
||||
--launch-profile) exec "$target" "$@" ;;
|
||||
--version | -V) exec "$target" --launch-profile nightly-v1 --profile-root "$profile_root" --version ;;
|
||||
esac
|
||||
|
||||
if [ -z "${XDG_DATA_HOME:-}" ] && [ -z "${HOME:-}" ]; then
|
||||
echo "deckcraft-nightly: XDG_DATA_HOME and HOME are both unset, so there is no Nightly data folder" >&2
|
||||
exit 2
|
||||
fi
|
||||
# The same root as every other format's launcher: beside the fenced stable `deckcraft` folder,
|
||||
# never inside it.
|
||||
profile="${XDG_DATA_HOME:-$HOME/.local/share}/deckcraft-nightly/launcher/profiles/deckcraft"
|
||||
# A caller-written `--` is the separator this launcher adds below. Drop it, so it can never reach
|
||||
# the app as a file name.
|
||||
if [ "${1-}" = "--" ]; then
|
||||
shift
|
||||
fi
|
||||
exec "$real" --launch-profile nightly-v1 --profile-root "$profile" -- "$@"
|
||||
exec "$target" --launch-profile nightly-v1 --profile-root "$profile_root" -- "$@"
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
#!/bin/sh
|
||||
# The DeckCraft Nightly launcher for the distro formats this app builds itself: the deb/rpm's
|
||||
# `bin/deckcraft-nightly`, the AppImage's `AppRun` and `usr/bin/deckcraft-nightly`, the Arch handoff's
|
||||
# `bin/deckcraft`, and the flat distro tree. Those packages keep their own profile folder
|
||||
# (`XDG_DATA_HOME/deckcraft-nightly/…`), and this file is unchanged by the shared template: the
|
||||
# plain nightly tar is the only artifact the canonical file below applies to.
|
||||
# The DeckCraft Nightly launcher every Linux format ships: the plain nightly tar's `deckcraft`, the
|
||||
# distro tree's `bin/deckcraft-nightly`, the AppImage's `AppRun`, the Arch handoff's `bin/deckcraft`
|
||||
# and the Flatpak's `/app/bin/deckcraft-nightly`. A nightly build refuses to start without
|
||||
# `--launch-profile nightly-v1 --profile-root <dir>`, and the profile is its only data root, so
|
||||
# this is what keeps a Nightly run out of the stable app's settings, prefs, logs and recovery.
|
||||
set -eu
|
||||
|
||||
# Resolve this script's own folder from `$0`. A shell that finds it through PATH passes a bare
|
||||
# name, so ask the shell where that is instead of using the working directory.
|
||||
case "$0" in
|
||||
*/*) self="$0" ;;
|
||||
*) self="$(command -v "$0" || printf '%s' "$0")" ;;
|
||||
esac
|
||||
case "$self" in
|
||||
/*) ;;
|
||||
*) self="$PWD/$self" ;;
|
||||
esac
|
||||
here="$(CDPATH='' cd "$(dirname "$self")" && pwd -P)"
|
||||
self="$here/$(basename "$self")"
|
||||
|
||||
# The GUI each placement keeps inside its own tree, never from a parent folder: `deckcraft-bin`
|
||||
# beside the launcher (the flat nightly tar, the distro tree, the Flatpak sandbox), the same name
|
||||
# in an AppImage's `usr/bin`, and the hidden copy the Arch handoff keeps. A candidate that is this
|
||||
# same file is never started, so a launcher cannot recurse into itself.
|
||||
real=
|
||||
for candidate in "$here/deckcraft-bin" "$here/usr/bin/deckcraft-bin" "$here/.deckcraft-nightly/deckcraft-bin"; do
|
||||
if [ -f "$candidate" ] && [ -x "$candidate" ] && [ ! "$candidate" -ef "$self" ]; then
|
||||
real="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
# A distro package keeps the GUI in /usr/lib. Reach that fixed path only from /usr/bin, so a
|
||||
# writable parent folder can never plant a program for this launcher to run.
|
||||
if [ -z "$real" ] && [ "$here" = /usr/bin ] && [ -f /usr/lib/deckcraft-nightly/deckcraft ] && [ -x /usr/lib/deckcraft-nightly/deckcraft ]; then
|
||||
real=/usr/lib/deckcraft-nightly/deckcraft
|
||||
fi
|
||||
if [ -z "$real" ]; then
|
||||
echo "deckcraft-nightly: no DeckCraft binary beside $self" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# A bare version/help query and the Launcher's own protocol pass straight through: they are not
|
||||
# file names, need no data folder, and a profile the caller already supplied is never wrapped
|
||||
# twice. This runs before the data-folder check, so `deckcraft-nightly --version` still answers
|
||||
# where HOME and XDG_DATA_HOME are both unset.
|
||||
case "${1-}" in
|
||||
--launch-profile | --profile-root | --version | -V | --help | -h) exec "$real" "$@" ;;
|
||||
esac
|
||||
|
||||
if [ -z "${XDG_DATA_HOME:-}" ] && [ -z "${HOME:-}" ]; then
|
||||
echo "deckcraft-nightly: XDG_DATA_HOME and HOME are both unset, so there is no Nightly data folder" >&2
|
||||
exit 2
|
||||
fi
|
||||
# The same root as every other format's launcher: beside the fenced stable `deckcraft` folder,
|
||||
# never inside it.
|
||||
profile="${XDG_DATA_HOME:-$HOME/.local/share}/deckcraft-nightly/launcher/profiles/deckcraft"
|
||||
# A caller-written `--` is the separator this launcher adds below. Drop it, so it can never reach
|
||||
# the app as a file name.
|
||||
if [ "${1-}" = "--" ]; then
|
||||
shift
|
||||
fi
|
||||
exec "$real" --launch-profile nightly-v1 --profile-root "$profile" -- "$@"
|
||||
@@ -117,7 +117,7 @@ if has tar; then
|
||||
# bin/deckcraft-bin), because the binary alone refuses to run without a launch profile.
|
||||
install -Dm755 "$WORK/tar/$BASENAME/bin/deckcraft" "$WORK/tar/$BASENAME/bin/deckcraft-bin"
|
||||
rm -f "$WORK/tar/$BASENAME/bin/deckcraft"
|
||||
install -Dm755 "$HERE/nightly-launch.sh" "$WORK/tar/$BASENAME/bin/deckcraft-nightly"
|
||||
install -Dm755 "$HERE/nightly-package-launch.sh" "$WORK/tar/$BASENAME/bin/deckcraft-nightly"
|
||||
TAR_DESK="$WORK/tar/$BASENAME/share/applications/$APP_ID.desktop"
|
||||
sed -e "s#^Exec=deckcraft\([[:space:]]\|$\)#Exec=deckcraft-nightly\1#" \
|
||||
-e "s|^TryExec=deckcraft$|TryExec=deckcraft-nightly|" \
|
||||
@@ -164,7 +164,7 @@ if has deb || has rpm; then
|
||||
# The GUI keeps its name under /usr/lib; /usr/bin/deckcraft-nightly is the launcher, whose
|
||||
# /usr/bin gate is what reaches that fixed path (the same file as the tar and AppImage use).
|
||||
install -Dm755 "$NFPM_STAGE/usr/bin/deckcraft" "$NFPM_STAGE/usr/lib/deckcraft-nightly/deckcraft"
|
||||
install -Dm755 "$HERE/nightly-launch.sh" "$NFPM_STAGE/usr/bin/$NFPM_BIN"
|
||||
install -Dm755 "$HERE/nightly-package-launch.sh" "$NFPM_STAGE/usr/bin/$NFPM_BIN"
|
||||
rm -f "$NFPM_STAGE/usr/bin/deckcraft"
|
||||
mv "$NFPM_STAGE/usr/bin/deckcraft-cli" "$NFPM_STAGE/usr/bin/$NFPM_CLI"
|
||||
mv "$NFPM_STAGE/usr/share/doc/deckcraft" "$NFPM_STAGE/usr/share/doc/$NFPM_NAME"
|
||||
@@ -227,8 +227,8 @@ if has appimage; then
|
||||
# read it.
|
||||
install -Dm755 "$APPDIR/usr/bin/deckcraft" "$APPDIR/usr/bin/deckcraft-bin"
|
||||
rm -f "$APPDIR/usr/bin/deckcraft"
|
||||
install -Dm755 "$HERE/nightly-launch.sh" "$APPDIR/AppRun"
|
||||
install -Dm755 "$HERE/nightly-launch.sh" "$APPDIR/usr/bin/deckcraft-nightly"
|
||||
install -Dm755 "$HERE/nightly-package-launch.sh" "$APPDIR/AppRun"
|
||||
install -Dm755 "$HERE/nightly-package-launch.sh" "$APPDIR/usr/bin/deckcraft-nightly"
|
||||
else
|
||||
ln -s usr/bin/deckcraft "$APPDIR/AppRun"
|
||||
fi
|
||||
|
||||
@@ -9,6 +9,9 @@ import unittest
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
INSTALLED_POLICY = ROOT / ".github/nightly-signing-policy.json"
|
||||
|
||||
# The dedicated signer branch the installed policy names and the signer guard requires.
|
||||
SIGNER_BRANCH = "nightly-signer"
|
||||
|
||||
NIGHTLY_PLATFORMS = ("windows-x86_64", "linux-x86_64", "macos-aarch64")
|
||||
# Each platform's one trust field in policy v3, and the public stable identity it must name.
|
||||
NIGHTLY_TRUST = {
|
||||
@@ -213,7 +216,7 @@ class NightlyEnabledCallers(unittest.TestCase):
|
||||
"github.ref_type == 'branch' && (github.event_name == 'schedule' || "
|
||||
"github.event_name == 'workflow_dispatch')",
|
||||
"nightly-sign.yml": "github.repository == 'storytold/deckcraft' && github.event_name == 'workflow_dispatch' && "
|
||||
"github.ref == 'refs/heads/release' && github.ref_type == 'branch'",
|
||||
"github.ref == 'refs/heads/" + SIGNER_BRANCH + "' && github.ref_type == 'branch'",
|
||||
}
|
||||
|
||||
def test_enabled_jobs_keep_exact_context_guards(self):
|
||||
@@ -267,16 +270,15 @@ class NightlyInstalledPolicy(unittest.TestCase):
|
||||
self.assertEqual(set(self.policy), expected)
|
||||
self.assertEqual(self.policy["schema"], "craft-nightly-release-policy/v3")
|
||||
self.assertEqual(self.policy["repository"], "storytold/deckcraft")
|
||||
self.assertEqual(self.policy["release_branch"], "release")
|
||||
self.assertIs(type(self.policy["repository_id"]), int)
|
||||
self.assertGreater(self.policy["repository_id"], 0)
|
||||
# producer_workflow_id is null until nightly.yml is registered on main; once set, it must be a positive int.
|
||||
if self.policy["producer_workflow_id"] is not None:
|
||||
self.assertIs(type(self.policy["producer_workflow_id"]), int)
|
||||
self.assertGreater(self.policy["producer_workflow_id"], 0)
|
||||
self.assertNotEqual(self.policy["producer_workflow_id"],
|
||||
self.policy["candidate_policy"]["required_workflows"][0]["workflow_id"],
|
||||
"the producer is not its own quality workflow")
|
||||
self.assertEqual(self.policy["release_branch"], SIGNER_BRANCH, "the signer runs on its dedicated branch")
|
||||
# Both read from the GitHub API (the repository and nightly.yml's registration on main).
|
||||
for key in ("repository_id", "producer_workflow_id"):
|
||||
with self.subTest(key=key):
|
||||
self.assertIs(type(self.policy[key]), int)
|
||||
self.assertGreater(self.policy[key], 0)
|
||||
self.assertNotEqual(self.policy["producer_workflow_id"],
|
||||
self.policy["candidate_policy"]["required_workflows"][0]["workflow_id"],
|
||||
"the producer is not its own quality workflow")
|
||||
|
||||
def test_paths_and_tooling_match_the_callers(self):
|
||||
pin = caller_pin("nightly.yml")
|
||||
@@ -351,6 +353,316 @@ class NightlyInstalledPolicy(unittest.TestCase):
|
||||
self.assertIn(item["type"], sonar["issue_types"])
|
||||
self.assertRegex(item["hash"], r"^[0-9a-f]{32}$")
|
||||
|
||||
def test_sonar_policy_keeps_the_shared_candidate_contract(self):
|
||||
"""The Sonar shape craft-common-actions' candidate contract() admits, refused here first.
|
||||
|
||||
An empty issue scope, an accepted condition outside the reviewed issue types, a metric in both
|
||||
lists, a missing live gate condition or a widened security bound is refused at admission, so
|
||||
this suite must catch it before a nightly run can. `debt` stays empty, so any unresolved
|
||||
vulnerability on main is still refused; accepting the new-code rating only records the
|
||||
reviewed A threshold instead of demanding a clean rating the live gate does not.
|
||||
"""
|
||||
sonar = self.policy["candidate_policy"]["sonar"]
|
||||
accepted = {"bugs": "BUG", "vulnerabilities": "VULNERABILITY", "code_smells": "CODE_SMELL",
|
||||
"security_rating": "VULNERABILITY", "new_security_rating": "VULNERABILITY"}
|
||||
gate = {"new_reliability_rating", "new_security_rating", "new_maintainability_rating",
|
||||
"new_coverage", "new_duplicated_lines_density", "new_security_hotspots_reviewed"}
|
||||
self.assertTrue(sonar["issue_types"], "an empty issue scope is refused as unreviewed")
|
||||
self.assertEqual(len(sonar["issue_types"]), len(set(sonar["issue_types"])))
|
||||
metrics = {}
|
||||
for field in ("accepted_conditions", "required_conditions"):
|
||||
for condition in sonar[field]:
|
||||
with self.subTest(field=field, metric=condition.get("metric")):
|
||||
expected = {"metric", "comparator", "error_threshold"}
|
||||
if field == "accepted_conditions":
|
||||
expected.add("maximum")
|
||||
self.assertEqual(set(condition), expected)
|
||||
self.assertNotIn(condition["metric"], metrics, "one condition per gate metric")
|
||||
metrics[condition["metric"]] = condition
|
||||
self.assertIn(condition["comparator"], ("GT", "LT"))
|
||||
self.assertRegex(condition["error_threshold"], r"^(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$")
|
||||
if field != "accepted_conditions":
|
||||
continue
|
||||
self.assertIn(condition["metric"], accepted, "an accepted metric outside the reviewed map")
|
||||
self.assertIn(accepted[condition["metric"]], sonar["issue_types"],
|
||||
"an accepted failure must lie inside the reviewed issue scope")
|
||||
self.assertEqual(condition["comparator"], "GT")
|
||||
self.assertRegex(condition["maximum"], r"^(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$")
|
||||
maximum = float(condition["maximum"])
|
||||
if condition["metric"] in ("security_rating", "new_security_rating"):
|
||||
self.assertEqual(int(maximum), maximum, "the A..E bound is a whole rating")
|
||||
self.assertTrue(1 <= maximum <= 5, "the security bound stays A..E")
|
||||
self.assertEqual(condition["error_threshold"], "1", "the reviewed A threshold stays")
|
||||
else:
|
||||
self.assertLessEqual(maximum, len(sonar["debt"]), "accepted failures exceed the reviewed debt")
|
||||
self.assertEqual({accepted[c["metric"]] for c in sonar["accepted_conditions"]}, set(sonar["issue_types"]),
|
||||
"accepted conditions and reviewed issue types must cover the same scope")
|
||||
self.assertEqual(set(metrics), gate, "every live gate condition stays gated exactly once")
|
||||
|
||||
|
||||
SHARED = "storytold/craft-common-actions/.github/workflows/"
|
||||
# App workflows reviewed to call the shared stable release.yml. That callee must carry the
|
||||
# stable-only environment guard (dry runs and non-release refs bind no environment); the
|
||||
# nightly-signer settings scan checks the resolved callee before creating or advancing the branch.
|
||||
REVIEWED_STABLE_RELEASE_CALLERS = {"release.yml"}
|
||||
|
||||
|
||||
def app_workflows():
|
||||
return {path.name: path.read_text() for path in sorted((ROOT / ".github/workflows").glob("*.y*ml"))}
|
||||
|
||||
|
||||
WORKFLOW_KEY = re.compile(r'''("(?:[^"\\]|\\.)*"|'(?:[^']|'')*'|[^\s'"#{}\[\],:&*!|>%@`?-][^:#,{}]*?|-[^\s:#][^:#,{}]*?)\s*:(?:\s+(.*))?$''')
|
||||
|
||||
|
||||
def _workflow_key(text):
|
||||
if text.startswith('"'):
|
||||
return None if "\\" in text else text[1:-1]
|
||||
if text.startswith("'"):
|
||||
return text[1:-1].replace("''", "'")
|
||||
return text
|
||||
|
||||
|
||||
def _workflow_value(text):
|
||||
"""A one-line scalar value without its comment and quotes; None when escaped or unterminated."""
|
||||
text = text.strip()
|
||||
if text.startswith('"'):
|
||||
quoted = re.match(r'"((?:[^"\\]|\\.)*)"\s*(?:#.*)?$', text)
|
||||
return None if quoted is None or "\\" in quoted.group(1) else quoted.group(1)
|
||||
if text.startswith("'"):
|
||||
quoted = re.match(r"'((?:[^']|'')*)'\s*(?:#.*)?$", text)
|
||||
return None if quoted is None else quoted.group(1).replace("''", "'")
|
||||
return re.split(r"\s+#", text, maxsplit=1)[0].strip()
|
||||
|
||||
|
||||
def _strip_comment(text):
|
||||
"""(text without its comment, unterminated) using a quote-aware scan.
|
||||
|
||||
As in YAML, a quote opens a quoted scalar only where a scalar starts (line start or after
|
||||
`:`, `-`, `,`, `{` or `[`), and a `#` starts a comment only outside quotes, at the start or
|
||||
after whitespace.
|
||||
"""
|
||||
quote, index = None, 0
|
||||
while index < len(text):
|
||||
char = text[index]
|
||||
if quote == '"':
|
||||
if char == "\\":
|
||||
index += 2
|
||||
continue
|
||||
if char == '"':
|
||||
quote = None
|
||||
elif quote == "'":
|
||||
if char == "'":
|
||||
if text[index + 1:index + 2] == "'":
|
||||
index += 2
|
||||
continue
|
||||
quote = None
|
||||
elif char in "\"'" and text[:index].rstrip()[-1:] in ("", ":", "-", ",", "{", "["):
|
||||
quote = char
|
||||
elif char == "#" and (index == 0 or text[index - 1] in " \t"):
|
||||
return text[:index].rstrip(), False
|
||||
index += 1
|
||||
return text.rstrip(), quote is not None
|
||||
|
||||
|
||||
FLOW_QUOTED = re.compile(r"\"(?:[^\"\\]|\\.)*\"|'(?:[^']|'')*'")
|
||||
FLOW_FORBIDDEN_KEYS = {"environment", "uses"}
|
||||
|
||||
|
||||
def workflow_entries(source):
|
||||
"""Every mapping entry in a workflow, plus the YAML forms this reader refuses.
|
||||
|
||||
A narrow reader, not a YAML parser (none ships with the runner's Python). Each entry is
|
||||
(line, key, value, multiline): plain, single- and double-quoted keys and one-line values in
|
||||
block and simple one-line flow mappings. Block scalar bodies are skipped, and an entry whose
|
||||
value is a block scalar or continues on the next lines is marked multiline. It refuses whatever
|
||||
could hide a key from it: escaped double-quoted keys, explicit `?` keys, merge keys, anchors,
|
||||
aliases, tags, tab indentation and nested or multi-line flow.
|
||||
"""
|
||||
lines = source.splitlines()
|
||||
entries, refused, block = [], [], None
|
||||
|
||||
def continues(index, indent):
|
||||
for follow in lines[index + 1:]:
|
||||
stripped = follow.strip()
|
||||
if not stripped or stripped.startswith("#"):
|
||||
continue
|
||||
deeper = len(follow) - len(follow.lstrip(" ")) > indent
|
||||
return deeper and not stripped.startswith("- ") and WORKFLOW_KEY.match(stripped) is None
|
||||
return False
|
||||
|
||||
for index, raw in enumerate(lines):
|
||||
number = index + 1
|
||||
stripped = raw.strip()
|
||||
indent = len(raw) - len(raw.lstrip(" "))
|
||||
if block is not None:
|
||||
if not stripped or indent > block:
|
||||
continue
|
||||
block = None
|
||||
if not stripped or stripped.startswith("#"):
|
||||
continue
|
||||
if "\t" in raw[:indent + 1]:
|
||||
refused.append(f"line {number}: tab indentation"); continue
|
||||
body, unterminated = _strip_comment(stripped)
|
||||
if unterminated:
|
||||
refused.append(f"line {number}: unterminated or multi-line quoted scalar"); continue
|
||||
if not body:
|
||||
continue
|
||||
while body.startswith("- "):
|
||||
body = body[2:].lstrip()
|
||||
if body == "?" or body.startswith("? "):
|
||||
refused.append(f"line {number}: explicit key"); continue
|
||||
match = WORKFLOW_KEY.match(body)
|
||||
value = body
|
||||
if match is not None:
|
||||
key, value = _workflow_key(match.group(1)), match.group(2) or ""
|
||||
if key is None:
|
||||
refused.append(f"line {number}: escaped double-quoted key"); continue
|
||||
if key == "<<":
|
||||
refused.append(f"line {number}: merge key"); continue
|
||||
plain = re.sub(r"\$\{\{.*?\}\}", "", value).strip()
|
||||
bare = re.sub(r"\"(?:[^\"\\]|\\.)*\"|'(?:[^']|'')*'", "''", plain)
|
||||
if re.match(r"[&*!]", plain):
|
||||
refused.append(f"line {number}: anchor, alias or tag")
|
||||
is_block = re.fullmatch(r"[|>][0-9+-]*", plain) is not None
|
||||
if match is not None:
|
||||
entries.append((number, key, _workflow_value(value),
|
||||
is_block or ((value == "" or not is_block) and continues(index, indent))))
|
||||
if "{" in bare and bare != "{}":
|
||||
masked = re.fullmatch(r"\{([^{}\[\]]*)\}", FLOW_QUOTED.sub("''", value.strip()))
|
||||
flow = re.fullmatch(r"\{([^{}\[\]]*)\}", value.strip())
|
||||
if any(set(scalar[1:-1]) & set("#{}[],") for scalar in FLOW_QUOTED.findall(value)):
|
||||
refused.append(f"line {number}: flow mapping quoted scalar with # or flow punctuation")
|
||||
elif masked is None or flow is None:
|
||||
refused.append(f"line {number}: nested or multi-line flow mapping")
|
||||
else:
|
||||
# The masked text only proves the shape: a quoted key ("uses", 'environment') keeps
|
||||
# its identity, so the entries are read from the original mapping text, never ''.
|
||||
for item in flow.group(1).split(","):
|
||||
entry = WORKFLOW_KEY.match(item.strip())
|
||||
key = _workflow_key(entry.group(1)) if entry else None
|
||||
if key is None:
|
||||
refused.append(f"line {number}: unreadable flow mapping entry")
|
||||
elif key in FLOW_FORBIDDEN_KEYS:
|
||||
refused.append(f"line {number}: {key} in a flow mapping (must be block style)")
|
||||
else:
|
||||
entries.append((number, key, _workflow_value(entry.group(2) or ""), False))
|
||||
if match is not None and is_block:
|
||||
block = indent
|
||||
return entries, refused
|
||||
|
||||
|
||||
def workflow_keys(source):
|
||||
"""(line, key) for every mapping entry, plus the refused YAML forms."""
|
||||
entries, refused = workflow_entries(source)
|
||||
return [(number, key) for number, key, _, _ in entries], refused
|
||||
|
||||
|
||||
SHARED_CALLEE = re.compile(r"storytold/craft-common-actions/\.github/workflows/([\w.-]+\.ya?ml)@(\S+)", re.IGNORECASE)
|
||||
INSPECTED_KEYS = {"environment", "uses"}
|
||||
|
||||
|
||||
def trust_closure_problems(workflows):
|
||||
"""The nightly-signer trust-closure scan over app workflow sources; empty when the tree is safe.
|
||||
|
||||
Every key it inspects comes from workflow_entries(), never a regex over the raw text.
|
||||
"""
|
||||
problems, stable_callers, signer_calls = [], set(), 0
|
||||
for name, source in workflows.items():
|
||||
entries, refused = workflow_entries(source)
|
||||
problems.extend(name + " uses YAML the scan cannot read (" + reason + ")" for reason in refused)
|
||||
for number, key, value, multiline in entries:
|
||||
if key not in INSPECTED_KEYS:
|
||||
continue
|
||||
if key == "environment":
|
||||
problems.append(f"{name} binds an environment directly (line {number})")
|
||||
continue
|
||||
if value is None or multiline:
|
||||
problems.append(f"{name} has a uses value the scan cannot read (line {number})")
|
||||
continue
|
||||
callee = SHARED_CALLEE.fullmatch(value)
|
||||
if callee is None:
|
||||
if re.search(r"craft-common-actions", value, re.IGNORECASE) and re.search(r"workflows/(nightly-)?release\.ya?ml", value, re.IGNORECASE):
|
||||
problems.append(f"{name} has an unrecognised shared release caller (line {number})")
|
||||
continue
|
||||
workflow, ref = callee.group(1), callee.group(2)
|
||||
if workflow.lower() in ("nightly-release.yml", "nightly-release.yaml"):
|
||||
if name == "nightly-sign.yml":
|
||||
signer_calls += 1
|
||||
if name != "nightly-sign.yml" or not re.fullmatch(r"[0-9a-f]{40}", ref):
|
||||
problems.append(name + " calls nightly-release.yml@" + ref)
|
||||
if workflow.lower() in ("release.yml", "release.yaml"):
|
||||
stable_callers.add(name)
|
||||
if ref != "main" and not re.fullmatch(r"[0-9a-f]{40}", ref):
|
||||
problems.append(name + " calls release.yml@" + ref + "; use @main or a reviewed full SHA")
|
||||
if stable_callers != REVIEWED_STABLE_RELEASE_CALLERS:
|
||||
problems.append("shared release.yml callers are " + ", ".join(sorted(stable_callers)))
|
||||
if signer_calls != 1:
|
||||
problems.append("nightly-sign.yml must call nightly-release.yml exactly once")
|
||||
return problems
|
||||
|
||||
|
||||
class NightlySignerBranchTrustClosure(unittest.TestCase):
|
||||
"""On refs/heads/nightly-signer, only the pinned signer caller may reach an environment."""
|
||||
|
||||
def test_trust_closure_scan_passes_on_this_tree(self):
|
||||
self.assertEqual(trust_closure_problems(app_workflows()), [])
|
||||
|
||||
def test_trust_closure_scan_refuses_each_route_into_an_environment(self):
|
||||
tree = app_workflows()
|
||||
bad = {
|
||||
"a workflow binds an environment": {**tree, "extra.yml": "jobs:\n x:\n runs-on: ubuntu-latest\n environment: release\n"},
|
||||
"a double-quoted environment key": {**tree, "extra.yml": 'jobs:\n x:\n runs-on: ubuntu-latest\n "environment": release\n'},
|
||||
"a single-quoted environment key": {**tree, "extra.yml": "jobs:\n x:\n runs-on: ubuntu-latest\n 'environment' : release\n"},
|
||||
"an environment mapping": {**tree, "extra.yml": "jobs:\n x:\n runs-on: ubuntu-latest\n environment:\n name: release\n"},
|
||||
"an environment in a flow mapping": {**tree, "extra.yml": "jobs:\n x: {runs-on: ubuntu-latest, environment: release}\n"},
|
||||
"an escaped key": {**tree, "extra.yml": 'jobs:\n x:\n runs-on: ubuntu-latest\n "environ\\u006dent": release\n'},
|
||||
"a merge key": {**tree, "extra.yml": "base: &b\n runs-on: ubuntu-latest\njobs:\n x:\n <<: *b\n"},
|
||||
"an explicit key": {**tree, "extra.yml": "jobs:\n x:\n ? environment\n : release\n"},
|
||||
"a nested flow mapping": {**tree, "extra.yml": "jobs:\n x: {steps: [{run: a}]}\n"},
|
||||
"a double-quoted uses key copying the signer": {**tree, "extra.yml": 'jobs:\n x:\n "uses": ' + SHARED + "nightly-release.yml@" + "a" * 40 + "\n"},
|
||||
"a single-quoted uses key": {**tree, "extra.yml": "jobs:\n x:\n 'uses': " + SHARED + "nightly-release.yml@" + "a" * 40 + "\n"},
|
||||
"a quoted uses value": {**tree, "extra.yml": 'jobs:\n x:\n uses: "' + SHARED + "nightly-release.yml@" + "a" * 40 + '"\n'},
|
||||
"uses in a flow mapping": {**tree, "extra.yml": "jobs:\n x: {uses: " + SHARED + "nightly-release.yml@" + "a" * 40 + "}\n"},
|
||||
"a differently cased owner": {**tree, "extra.yml": "jobs:\n x:\n uses: Storytold/Craft-Common-Actions/.github/workflows/nightly-release.yml@" + "a" * 40 + "\n"},
|
||||
"a folded uses value": {**tree, "extra.yml": "jobs:\n x:\n uses: >-\n " + SHARED + "nightly-release.yml@" + "a" * 40 + "\n"},
|
||||
"a continued uses value": {**tree, "extra.yml": "jobs:\n x:\n uses: " + SHARED + "\n nightly-release.yml@" + "a" * 40 + "\n"},
|
||||
"a quoted second signer call": {**tree, "nightly-sign.yml": tree["nightly-sign.yml"] + " again:\n \"uses\": " + SHARED + "nightly-release.yml@" + "a" * 40 + "\n"},
|
||||
"a hash inside a quoted flow scalar": {**tree, "extra.yml": 'jobs:\n x: {name: "a} # b", runs-on: ubuntu-latest, environment: release, steps: []}\n'},
|
||||
"a single-quoted hash in a flow scalar": {**tree, "extra.yml": "jobs:\n x: {name: 'a # b', runs-on: ubuntu-latest}\n"},
|
||||
"a comma inside a quoted flow scalar": {**tree, "extra.yml": 'jobs:\n x: {name: "a, environment: release", runs-on: ubuntu-latest}\n'},
|
||||
"a bracket inside a quoted flow scalar": {**tree, "extra.yml": 'jobs:\n x: {name: "[a]", runs-on: ubuntu-latest}\n'},
|
||||
"an unterminated quote": {**tree, "extra.yml": 'jobs:\n x:\n name: "a\n b"\n runs-on: ubuntu-latest\n'},
|
||||
"environment in any flow mapping": {**tree, "extra.yml": "jobs:\n x:\n runs-on: ubuntu-latest\n with: {environment: release}\n"},
|
||||
"a double-quoted environment key in a flow mapping": {**tree, "extra.yml": 'jobs:\n x:\n runs-on: ubuntu-latest\n with: {"environment": release}\n'},
|
||||
"a single-quoted environment key in a flow mapping": {**tree, "extra.yml": "jobs:\n x:\n runs-on: ubuntu-latest\n with: {'environment': release}\n"},
|
||||
"a double-quoted uses key in a flow mapping": {**tree, "extra.yml": 'jobs:\n x: {"uses": ' + SHARED + "nightly-release.yml@" + "a" * 40 + "}\n"},
|
||||
"uses in any flow mapping": {**tree, "extra.yml": "jobs:\n x:\n steps:\n - {uses: actions/checkout@v4}\n"},
|
||||
"another caller of the signer": {**tree, "extra.yml": "jobs:\n x:\n uses: " + SHARED + "nightly-release.yml@" + "a" * 40 + "\n"},
|
||||
"a mutable signer pin": {**tree, "nightly-sign.yml": re.sub(r"nightly-release\.yml@[0-9a-f]{40}", "nightly-release.yml@main", tree["nightly-sign.yml"])},
|
||||
"a new stable release caller": {**tree, "extra.yml": "jobs:\n x:\n uses: " + SHARED + "release.yml@main\n"},
|
||||
"a stable caller on a branch or tag ref": {**tree, "release.yml": tree["release.yml"].replace(SHARED + "release.yml@main", SHARED + "release.yml@v1")},
|
||||
}
|
||||
for label, workflows in bad.items():
|
||||
with self.subTest(case=label):
|
||||
self.assertTrue(trust_closure_problems(workflows))
|
||||
|
||||
def test_quoted_keys_in_a_flow_mapping_are_read_not_masked(self):
|
||||
entries, refused = workflow_entries('jobs:\n x: {runs-on: ubuntu-latest, "name": build}\n')
|
||||
self.assertEqual(refused, [])
|
||||
self.assertIn((2, "name", "build", False), entries, "a quoted key keeps its identity")
|
||||
self.assertIn((2, "runs-on", "ubuntu-latest", False), entries)
|
||||
_, refused = workflow_entries("jobs:\n x: {runs-on: ubuntu-latest, 'environment': release}\n")
|
||||
self.assertEqual(refused, ["line 2: environment in a flow mapping (must be block style)"])
|
||||
|
||||
def test_signer_guard_and_policy_name_the_same_branch(self):
|
||||
app = json.loads(INSTALLED_POLICY.read_text())["repository"].split("/", 1)[1]
|
||||
sign = (ROOT / ".github/workflows/nightly-sign.yml").read_text()
|
||||
(_, guard), = job_conditions(sign.split("\njobs:\n", 1)[1])
|
||||
self.assertIn("github.ref == 'refs/heads/" + SIGNER_BRANCH + "'", guard)
|
||||
self.assertNotIn("refs/heads/release", sign, "the signer no longer runs on the stable branch")
|
||||
self.assertEqual(re.findall(r"(?m)^ app-name: (\S+)$", sign), [app], "the shared signer needs the reviewed registry app")
|
||||
self.assertEqual(json.loads(INSTALLED_POLICY.read_text())["release_branch"], SIGNER_BRANCH)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(verbosity=2)
|
||||
|
||||
Reference in New Issue
Block a user