Repository navigation
v2.17.1
A changed [build] repo no longer leaves the box on the old repo. The next build uses the new repo, or fails loud.
Fixed
- After a change of
[build] repoandbay up, the box kept the old repo. Aremotebuild reused its checkout, whoseoriginstill named the old repo, so the build server went on building the old code with no error (with a token, only a fullbay deploy --tags git_deployresetorigin; with an SSH URL, nothing did). Alocalbuild keys its checkout folder on repo and branch, so the new URL named a folder that only a full deploy clones: the next push failed at the repo lock with a bare "Webhook deploy failed". A changed deploy branch hit the samelocalfailure. rebuild.shnow holds the expected repo of each container (EXPECTED_ORIGIN) and the credentials of a fetch. Before the fetch it clones a missing checkout (into a temp folder, moved into place when complete), and it repoints a checkout whoseoriginnames another repo: firstgit ls-remoteof the new repo and branch, thenoriginis set, and the fetch andreset --hard FETCH_HEADmove the checkout to the new head, whatever its history. Log line:repo of <container> changed from <old> to <new>, checkout repointed. The repos are compared in the CLI's normal form (host/owner/repo, lower case, no user, password, port or.git), so the same repo in another form is no change.- The first build from a new or repointed checkout is a full build: the commit of the old repo decides no config-only or no-input-change tag, and a
localbuild fetches and resets instead ofgit pull, which refuses an unrelated history. A mark in.git/bay-full-build/keeps it so until a run has built or found the image of the head. - A repo that the box cannot clone, check or fetch ends with one
build.failedalert, "Repo check failed (N/MAX)" (or clone, or fetch). It names the container, the repo, the branch and the likely cause: the token cannot read it, the deploy key is not on it (GitHub takes a key on one repo only), the box has no deploy key yet, an https repo is private or missing, the branch is missing, or the host key is not pinned. Nothing is built, and the checkout and itsoriginstay as they were. The circuit breaker counts it like any failed build. Before, a failed fetch of aremotebuild fell to the ERR trap with no reason, and the HTTP 403 hint after it never ran. - A token in a repo URL is redacted (
***) in every log line, alert, state file and plan note. bay build resetwrote an invalid state file. The JSON went through the remote shell inside double quotes, so the shell removed the quotes ({version: 1, consecutive_failures: 0, ...}).bay build statusthen failed to parse it and printed "No build state found", until the next build rewrote the file. The state now travels as base64, so no shell can change it. The file has the same shape asrebuild.shwrites (last_failureisnull, not a block of empty strings), the owner and group of the state directory (the app user and the build group) and mode 0664, asrebuild.shdoes. Before, it was root-owned with mode 0644:rebuild.shcould still replace it (it needs write access to the directory, not to the file), but the build group could not write it. The command no longer creates a missing state directory, which would have been root-owned and would have lockedrebuild.shout.bay build statusnames a state file that is not valid JSON: "the state file of is not valid JSON; runbay build reset <service> --env <env>or wait for the next build to rewrite it". The other services still show. Before, one bad file made the whole listing say "No build state found".bay up(--tags deploy_stack) now also writes the GIT_ASKPASS helper of eachlocalbuild with a token. The helper path holds the checkout slug, so a new repo or branch needed a helper that only a full deploy wrote.
Changed
bay planandbay upadd a note when the build repo of a container changes:<container>: the build repo changes from <old> to <new>. The box builds from the new repo from the next push. Add the box's deploy key to the new repo and create its push webhook first.For aremotebuild the second sentence says: the build server builds from the new repo from the next push or trigger file, and the deployment box recreates the container when it gets the pull signal. With a token the note names its vault key. Thechanged: buildstep stays. Notes are not part of the plan id. Aregistrybuild gets no note: Bay does not clone its repo.- The plan after
bay toml move(andbay adopt) shows onebay-webhookrecreate step for each box of the box environment that runs a webhook receiver, not one step in all.bay updeploys the whole box environment, and each receiver holds the config (four such boxes give four steps). The docs (docs/plan.md,docs/bay-toml.md,docs/layout-scenarios.md) and the output and JSONnotesof the verb now say: expect onlybay-webhookrecreate steps, one per box with a webhook receiver. Any other step: stop. - A missing
localcheckout is now cloned by the build script itself, with the key or token the box has. The SSH deploy key of a newlocalbuild app still comes only frombay deploy <env>with no--tags. - Docs:
docs/build-pipeline.mdhas a new section "When the repo URL changes" (what the box does, the loud failure, the operator checklist for the deploy key, the webhook, the old hook and the old checkout folder, the circuit breaker, rollback, branch changes).docs/bay-toml.mdlinks it from therepokey. The observability contract has row 25 for the new exit. The section also says who builds and who recreates with the remote strategy, how to check the switch without waiting for a recreate (the journal line andgit remote get-url origin), why a repointed checkout may skip the image build (the image of the head is already in the registry), and that a same-URL history replacement needs no step on a remote build. A local build still fails there atgit pull: the section gives the manual step.
Upgrade notes
- The fix reaches a box with the next
bay up(orbay deploy), which rendersrebuild.shagain. No step is needed, and the upgrade recreates no container:rebuild.shis a plain file that no container hash or handler reads, and the receiver config and image map are unchanged. On a box with alocalbuild that uses a token,bay upwrites its GIT_ASKPASS helper file, with the content a full deploy already wrote. - A box that already lost a
localcheckout this way clones it on the next push. - When you change a repo URL: give the box read access to the new repo and create its push webhook before
bay up, then push or write a trigger file. Remove the old repo's hook and deploy key afterwards. The oldlocalcheckout folder stays; remove it by hand. See the checklist indocs/build-pipeline.md.