Rename GitTally to Werkator
`gitTally` is the name of another product in the git space, so the rename is a precaution; nothing about what the build system does changes. The name follows one rule: `Werkator` where it is prose, capitalized where it is a Kotlin type and its file, lowercase everywhere a machine reads it — the command, packages, paths, configuration keys and values, the Gitea check context. Environment variables keep their convention and are uppercase throughout. Every configuration file is still found under its pre-rename name (`ConfigFiles`): `.gittally.yml` at the repository root, in a build worktree and as committed on a branch, `.git/gittally/.gittally.yml` for the machine layer. The current name wins where both exist, and the old file is then ignored rather than merged — two files side by side are a half-done rename, not a layering. Without the fallback an installation that updated without renaming would not fail: a configuration that is not found leaves every setting at its default, so it would come up looking healthy while having forgotten its credentials and its builds. `docs/werkator-migrationsplan.md` lists what the fallback does not cover and has to be moved by hand — above all the state directory `.git/werkator/`, which holds the build history, the control token and the worktrees, and has no fallback of its own. `docs/migration-from-legacy.md` is deleted with this: it mapped the legacy script's environment variables, and every host it addressed has long since moved to the YAML configuration. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
7f550689dd
commit
35f06ec1ec
Executable
+108
@@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env bash
|
||||
# Example: start a Werkator test server watching a scratch repository with a fake build.
|
||||
# This is the setup used for the manual UI/API smoke tests during development:
|
||||
# a local bare origin (with a second branch for the Branches view), a slow fake
|
||||
# build with live log output and a demo report artifact, and a fast poll
|
||||
# interval — no Gitea, no credentials, no Docker.
|
||||
#
|
||||
# Usage:
|
||||
# ./docs/examples/setup-werkator-testserver.sh
|
||||
# BUILD_SECONDS=5 SERVER_PORT=18981 ./docs/examples/setup-werkator-testserver.sh
|
||||
#
|
||||
# While the server runs, trigger builds by pushing from the "work" clone:
|
||||
# git -C ~/werkator-testserver/work commit --allow-empty -m "trigger build" && git -C ~/werkator-testserver/work push
|
||||
# A commit message containing "[fail]" makes the fake build fail;
|
||||
# pushing a new branch exercises the new-origin-branch path.
|
||||
set -euo pipefail
|
||||
|
||||
INSTALL_DIR="${INSTALL_DIR:-$HOME/werkator-testserver}"
|
||||
SERVER_PORT="${SERVER_PORT:-18980}"
|
||||
export BUILD_SECONDS="${BUILD_SECONDS:-25}" # inherited by the build process at runtime
|
||||
|
||||
DEV_CHECKOUT=$(git rev-parse --show-toplevel)
|
||||
|
||||
# 1. Build the Werkator jar.
|
||||
(cd "$DEV_CHECKOUT" && ./gradlew --console=plain build)
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
cp "$DEV_CHECKOUT/build/libs/werkator.jar" "$INSTALL_DIR/werkator.jar"
|
||||
|
||||
# 2. Scratch bare origin plus a "work" clone for triggering builds by pushing.
|
||||
if [ ! -d "$INSTALL_DIR/origin.git" ]; then
|
||||
git init --bare --quiet --initial-branch=main "$INSTALL_DIR/origin.git"
|
||||
fi
|
||||
if [ ! -d "$INSTALL_DIR/work/.git" ]; then
|
||||
git clone --quiet "$INSTALL_DIR/origin.git" "$INSTALL_DIR/work"
|
||||
fi
|
||||
|
||||
# First run only: commit the fake build and the project config to the scratch repo.
|
||||
if ! git -C "$INSTALL_DIR/work" rev-parse --quiet --verify HEAD >/dev/null; then
|
||||
cat > "$INSTALL_DIR/work/fake-build.sh" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
# Fake build: visible progress for the live log, then a demo report artifact.
|
||||
# Werkator exports `branch`; BUILD_SECONDS is inherited from the server process.
|
||||
set -euo pipefail
|
||||
echo "fake build of branch ${branch:-unknown} at commit $(git rev-parse --short HEAD)"
|
||||
if git log -1 --pretty=%s | grep -qF '[fail]'; then
|
||||
echo "commit message requests a failing build" >&2
|
||||
exit 1
|
||||
fi
|
||||
for i in $(seq 1 "${BUILD_SECONDS:-25}"); do
|
||||
echo "build step $i of ${BUILD_SECONDS:-25}"
|
||||
sleep 1
|
||||
done
|
||||
mkdir -p build/reports/demo
|
||||
printf '<!DOCTYPE html><html><body><h1>Demo Report</h1><p>branch %s, commit %s</p></body></html>\n' \
|
||||
"${branch:-unknown}" "$(git rev-parse --short HEAD)" > build/reports/demo/index.html
|
||||
echo "fake build done"
|
||||
EOF
|
||||
chmod +x "$INSTALL_DIR/work/fake-build.sh"
|
||||
cat > "$INSTALL_DIR/work/.werkator.yml" <<'EOF'
|
||||
watcher:
|
||||
pollInterval: 5s
|
||||
|
||||
branches:
|
||||
default:
|
||||
cleanCommand: rm -rf build
|
||||
buildCommand: ./fake-build.sh
|
||||
artifactDirs:
|
||||
- build/reports
|
||||
EOF
|
||||
git -C "$INSTALL_DIR/work" add fake-build.sh .werkator.yml
|
||||
git -C "$INSTALL_DIR/work" commit --quiet -m "fake build setup"
|
||||
git -C "$INSTALL_DIR/work" commit --quiet --allow-empty -m "kick-start build"
|
||||
git -C "$INSTALL_DIR/work" push --quiet origin main
|
||||
fi
|
||||
|
||||
# A second branch on origin, so the Branches view shows more than just main.
|
||||
# Guarded separately so existing installs gain it on a re-run.
|
||||
if ! git -C "$INSTALL_DIR/origin.git" show-ref --quiet refs/heads/feature/demo; then
|
||||
git -C "$INSTALL_DIR/work" switch --quiet -c feature/demo main
|
||||
git -C "$INSTALL_DIR/work" commit --quiet --allow-empty -m "demo branch for the branches view"
|
||||
git -C "$INSTALL_DIR/work" push --quiet -u origin feature/demo
|
||||
git -C "$INSTALL_DIR/work" switch --quiet main
|
||||
fi
|
||||
|
||||
# 3. The watched clone; the server runs here. No `init` needed: the project config
|
||||
# is committed, and without gitea.baseUrl/git.token no statuses are published.
|
||||
if [ ! -d "$INSTALL_DIR/repo/.git" ]; then
|
||||
git clone --quiet "$INSTALL_DIR/origin.git" "$INSTALL_DIR/repo"
|
||||
fi
|
||||
cd "$INSTALL_DIR/repo"
|
||||
mkdir -p .git/werkator
|
||||
cat > .git/werkator/.werkator.yml <<EOF
|
||||
server:
|
||||
port: $SERVER_PORT
|
||||
bindAddress: 127.0.0.1
|
||||
EOF
|
||||
|
||||
# 4. Kick-start: put the local ref one commit behind origin so the very first
|
||||
# poll triggers a build. Builds never move this ref, so lagging is harmless.
|
||||
git reset --hard --quiet HEAD~1 || true
|
||||
|
||||
# 5. Run it (Ctrl-C stops it cleanly).
|
||||
echo
|
||||
echo "Werkator test server: http://localhost:$SERVER_PORT/"
|
||||
echo "Trigger a build: git -C $INSTALL_DIR/work commit --allow-empty -m 'trigger build' && git -C $INSTALL_DIR/work push"
|
||||
echo "Trigger a failure: same with commit message 'trigger [fail]'"
|
||||
echo
|
||||
exec java -jar "$INSTALL_DIR/werkator.jar" server
|
||||
Reference in New Issue
Block a user