Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Phase 7 slice 7: the build deploys the site

88e980b0e88b24a20605ceeb9e42fd0dacee7842 · Keenan Nemetz · 17d ago · parent 213f4d6d

Phase 7 slice 7: the build deploys the site

pages: {path: site} on a job publishes that directory as the site branch, using
the same snapshot code `vole pages deploy` uses — a site published by a workflow
and one published by a person have to be the same commit shape, or the version
that drifts is the one nobody runs by hand.

- workflow: pages.path validated at push — one relative directory, no glob (a
  site is one tree), and only one job per workflow may declare it, since two
  publishers race and the winner is whichever runner finished last
- the directory is pinned into the queued run beside the steps and the artifact
  patterns; the branch comes from the server (pages_ref), which a workflow
  cannot know
- runner: after the artifacts, checks that the run's SHA is still the tip of its
  branch and refuses otherwise. Deploy is a snapshot, so a stale build finishing
  late would silently revert the site; the failure names both commits
- the site commit says where it came from: "site: main from run <id> (<sha>)"

Fixed on the way, caught by the end-to-end test: the shared push helper treated a
URL as a missing *named* remote, so a runner's deploy committed locally and
reported success while the site 404'd. A URL is now a remote in its own right.

Measured through the binary: two pushes queued two runs; the older one was
refused ("this run built f1f415ec but main is at 6beaa530 now; the site was not
deployed") and published nothing; the newer one deployed and the site host served
the new tree, with `git log pages` showing
"site: main from run 01M5MSC3... (6beaa530)".

internal/sshserver/runner.go +16

@@ -63,6 +63,15 @@ type runnerJob struct {
63 63 // Artifacts are the declared patterns the runner expands and uploads after the
64 64 // steps succeed.
65 65 Artifacts []string `json:"artifacts,omitempty"`
66 // Pages is the site deploy this run performs, if any. The branch comes from
67 // instance configuration, which is why it is in the payload rather than in the
68 // workflow.
69 Pages *runnerPages `json:"pages,omitempty"`
70 }
71
72 type runnerPages struct {
73 Path string `json:"path"`
74 Ref string `json:"ref"`
66 75 }
67 76
68 77 type runnerReply struct {
@@ -114,6 +123,13 @@ func (s *Server) serveRunner(ch ssh.Channel, user, accountID string) {
114 123 ID: run.ID, Repo: run.Repo, SHA: run.SHA, Branch: run.Branch,
115 124 Workflow: run.Workflow, Job: run.Job, Artifacts: run.Artifacts,
116 125 }
126 if run.PagesPath != "" {
127 ref := cfg.PagesRef
128 if ref == "" {
129 ref = "pages"
130 }
131 job.Pages = &runnerPages{Path: run.PagesPath, Ref: ref}
132 }
117 133 for _, st := range run.Steps {
118 134 job.Steps = append(job.Steps, runnerStep{Name: st.Name, Run: st.Run, Timeout: st.Timeout})
119 135 }