feat: publish Gamertan Tend preview source
Sanitized root snapshot from private source commit a72903c63e1753f9e6ffbf40453c0830bdfc05c5 and tree 295641e67eef5979da76746d8ae271249568263e. Private development history and workflows are excluded by the exact allowlist. AI-assisted: OpenAI Codex helped implement, test, and audit this preview. Signed-off-by: Cole Speelman <crspeelman@gmail.com>
This commit is contained in:
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
set -euo pipefail
|
||||
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
test -s "$root/LICENSE"
|
||||
test -s "$root/COPYRIGHT"
|
||||
test -s "$root/examples/LICENSE"
|
||||
while IFS= read -r file; do
|
||||
grep -Fq 'SPDX-License-Identifier: AGPL-3.0-only' "$file" || { echo "missing SPDX identifier: $file" >&2; exit 1; }
|
||||
done < <(find "$root/cmd" "$root/internal" -type f -name '*.go' -print | LC_ALL=C sort)
|
||||
echo "license boundaries verified"
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
set -euo pipefail
|
||||
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
usage(){ echo "Usage: export-public.sh --destination ABSOLUTE-PATH" >&2; }
|
||||
destination=
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--destination) destination=$2; shift 2 ;;
|
||||
*) usage; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
[[ $destination == /* && $destination != / && ! -e $destination ]] || { usage; exit 2; }
|
||||
destination=$(realpath -m "$destination");root=$(realpath -e "$root")
|
||||
case $destination/ in "$root"/*) echo "destination must be outside the private worktree" >&2;exit 1;;esac
|
||||
git_dir_raw=$(git -C "$root" rev-parse --git-dir)
|
||||
common_dir_raw=$(git -C "$root" rev-parse --git-common-dir)
|
||||
[[ $git_dir_raw == /* ]] || git_dir_raw=$root/$git_dir_raw
|
||||
[[ $common_dir_raw == /* ]] || common_dir_raw=$root/$common_dir_raw
|
||||
git_dir=$(realpath -e "$git_dir_raw")
|
||||
common_dir=$(realpath -e "$common_dir_raw")
|
||||
case $destination/ in "$git_dir"/*|"$common_dir"/*) echo "destination must be outside Git metadata" >&2;exit 1;;esac
|
||||
[[ -z $(git -C "$root" status --porcelain=v1 --untracked-files=all) ]] || { echo "private worktree is not clean" >&2;exit 1; }
|
||||
commit=$(git -C "$root" rev-parse HEAD);tree=$(git -C "$root" rev-parse HEAD^{tree})
|
||||
[[ $(git -C "$root" ls-remote --exit-code origin refs/heads/main | awk 'NR==1{print $1}') == "$commit" ]] || { echo "private HEAD is not exact pushed origin/main" >&2;exit 1; }
|
||||
allow=$root/scripts/public-snapshot.allow
|
||||
LC_ALL=C sort -c "$allow"
|
||||
[[ $(LC_ALL=C sort "$allow" | uniq -d | wc -l) -eq 0 ]]
|
||||
mapfile -t files <"$allow"
|
||||
[[ ${#files[@]} -gt 0 ]]
|
||||
for file in "${files[@]}"; do
|
||||
[[ -n $file && $file != /* && $file != *..* && $file != .gitea/* && $file != .github/* ]]
|
||||
git -C "$root" cat-file -e "$commit:$file"
|
||||
done
|
||||
parent=$(dirname "$destination")
|
||||
mkdir -p "$parent"
|
||||
stage=$(mktemp -d "$parent/.tend-public.XXXXXX")
|
||||
trap 'rm -rf -- "$stage"' EXIT
|
||||
git -C "$root" archive "$commit" -- "${files[@]}" | tar -xf - -C "$stage"
|
||||
while IFS= read -r file; do
|
||||
relative=${file#"$stage"/}
|
||||
cmp "$file" "$root/$relative"
|
||||
done < <(find "$stage" -type f -print | LC_ALL=C sort)
|
||||
epoch=$(git -C "$root" show -s --format=%ct "$commit")
|
||||
printf '{"schema_version":1,"source_commit":"%s","source_tree":"%s","source_date_epoch":%s,"file_count":%d}\n' "$commit" "$tree" "$epoch" "${#files[@]}" >"$stage/PUBLIC-SNAPSHOT.json"
|
||||
(cd "$stage" && sha256sum PUBLIC-SNAPSHOT.json >PUBLIC-SNAPSHOT.sha256)
|
||||
if (cd "$stage" && rg -n --hidden --glob '!.git/**' --glob '!PUBLIC-SNAPSHOT.json' --glob '!scripts/export-public.sh' '/home/cole|BEGIN (RSA|OPENSSH|EC) PRIVATE KEY|gitea-api\.token' .); then
|
||||
echo "private material found" >&2
|
||||
exit 1
|
||||
fi
|
||||
mv "$stage" "$destination"
|
||||
trap - EXIT
|
||||
printf 'destination=%s\nsource_commit=%s\nsource_tree=%s\n' "$destination" "$commit" "$tree"
|
||||
@@ -0,0 +1,44 @@
|
||||
.gitattributes
|
||||
.gitignore
|
||||
COPYRIGHT
|
||||
LICENSE
|
||||
README.md
|
||||
RELEASE.md
|
||||
SECURITY.md
|
||||
cmd/tend/main.go
|
||||
docs/ARCHITECTURE.md
|
||||
docs/DOGFOOD_EVIDENCE.md
|
||||
docs/PUBLIC_SNAPSHOT.md
|
||||
docs/THREAT_MODEL.md
|
||||
examples/LICENSE
|
||||
examples/README.md
|
||||
examples/blue-green/caddy-handler.template
|
||||
examples/blue-green/example-site@.service
|
||||
examples/blue-green/tend.json
|
||||
examples/singleton/tend.json
|
||||
go.mod
|
||||
internal/config/config.go
|
||||
internal/config/config_test.go
|
||||
internal/deploy/deploy.go
|
||||
internal/deploy/deploy_test.go
|
||||
internal/deploy/lock_linux.go
|
||||
internal/deploy/lock_other.go
|
||||
internal/deploy/operator.go
|
||||
internal/deploy/operator_test.go
|
||||
internal/deploy/ownership_linux.go
|
||||
internal/deploy/ownership_other.go
|
||||
internal/deploy/release.go
|
||||
internal/deploy/release_test.go
|
||||
internal/packager/packager.go
|
||||
internal/packager/packager_test.go
|
||||
internal/process/run.go
|
||||
internal/provenance/git.go
|
||||
internal/state/state.go
|
||||
internal/state/state_test.go
|
||||
internal/version/version.go
|
||||
release/tend.json
|
||||
scripts/check-licenses.sh
|
||||
scripts/export-public.sh
|
||||
scripts/public-snapshot.allow
|
||||
scripts/test-public-snapshot.sh
|
||||
scripts/verify.sh
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
set -euo pipefail
|
||||
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
work=$(mktemp -d)
|
||||
trap 'rm -rf -- "$work"' EXIT
|
||||
destination=$work/public
|
||||
"$root/scripts/export-public.sh" --destination "$destination" >/dev/null
|
||||
test -f "$destination/PUBLIC-SNAPSHOT.json"
|
||||
test -f "$destination/PUBLIC-SNAPSHOT.sha256"
|
||||
(cd "$destination" && sha256sum -c PUBLIC-SNAPSHOT.sha256)
|
||||
test ! -e "$destination/.git"
|
||||
test ! -e "$destination/.gitea"
|
||||
test ! -e "$destination/.github"
|
||||
while IFS= read -r file; do
|
||||
cmp "$root/$file" "$destination/$file"
|
||||
done <"$root/scripts/public-snapshot.allow"
|
||||
echo "public snapshot isolation verified"
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
set -euo pipefail
|
||||
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
cd "$root"
|
||||
./scripts/check-licenses.sh
|
||||
go test -count=1 ./...
|
||||
go test -race -count=1 ./...
|
||||
go vet ./...
|
||||
for script in scripts/*.sh; do bash -n "$script"; done
|
||||
work=$(mktemp -d); trap 'rm -rf -- "$work"' EXIT
|
||||
GOWORK=off CGO_ENABLED=0 go build -mod=readonly -trimpath -o "$work/tend-1" ./cmd/tend
|
||||
GOWORK=off CGO_ENABLED=0 go build -mod=readonly -trimpath -o "$work/tend-2" ./cmd/tend
|
||||
cmp "$work/tend-1" "$work/tend-2"
|
||||
"$work/tend-1" check --config "$root/examples/blue-green/tend.json" >/dev/null
|
||||
"$work/tend-1" check --config "$root/examples/singleton/tend.json" >/dev/null
|
||||
[[ $(GOWORK=off go list -m all | wc -l) -eq 1 ]]
|
||||
git diff --check
|
||||
echo "Tend verification passed"
|
||||
Reference in New Issue
Block a user