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.
refactor
c5902451905acdaa478f8476844ccd4a510d9ca9 · Keenan Nemetz · 16d ago · parent ec2aba4b
internal/workflow/workflow.go → ci/workflow.go +14−14
| @@ -1,4 +1,4 @@ | |||
| 1 | // Package workflow validates Vole's CI workflow files. | ||
| 1 | // Package ci validates Vole's CI workflow files and defines the CI schema. | ||
| 2 | 2 | // | |
| 3 | 3 | // .vole/workflows/<name>.yaml | |
| 4 | 4 | // | |
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | // is validated when it is pushed, so a broken workflow fails the push that | |
| 7 | 7 | // introduced it instead of silently never running — which is the failure mode | |
| 8 | 8 | // that wastes the most of a person's afternoon. | |
| 9 | package workflow | ||
| 9 | package ci | ||
| 10 | 10 | ||
| 11 | 11 | import ( | |
| 12 | 12 | "fmt" | |
| @@ -18,7 +18,7 @@ import ( | |||
| 18 | 18 | "strings" | |
| 19 | 19 | "time" | |
| 20 | 20 | ||
| 21 | "github.com/rodent-software/vole/internal/gitx" | ||
| 21 | "github.com/rodent-software/vole/core/git" | ||
| 22 | 22 | "gopkg.in/yaml.v3" | |
| 23 | 23 | ) | |
| 24 | 24 | ||
| @@ -112,7 +112,7 @@ type Workflow struct { | |||
| 112 | 112 | BlobSHA string | |
| 113 | 113 | Version int | |
| 114 | 114 | Branches []string | |
| 115 | // Tags are the tag patterns that trigger this workflow. A tag run is how a | ||
| 115 | // Tags are the tag patterns that trigger this ci. A tag run is how a | ||
| 116 | 116 | // release build happens: the tag names what is being released. | |
| 117 | 117 | Tags []string | |
| 118 | 118 | Jobs []Job | |
| @@ -236,7 +236,7 @@ func Parse(file string, content string) (*Workflow, []string) { | |||
| 236 | 236 | case rw.On.Push.Branches != nil: | |
| 237 | 237 | wf.Branches = *rw.On.Push.Branches | |
| 238 | 238 | case rw.On.Push.Tags == nil: | |
| 239 | // Nothing was said, so this workflow is an ordinary push workflow. Saying | ||
| 239 | // Nothing was said, so this workflow is an ordinary push ci. Saying | ||
| 240 | 240 | // "tags:" is saying what it triggers on, so it does not also mean branches. | |
| 241 | 241 | wf.Branches = []string{"*"} | |
| 242 | 242 | } | |
| @@ -440,15 +440,15 @@ func Check(files map[string]string) ([]*Workflow, []string) { | |||
| 440 | 440 | } | |
| 441 | 441 | ||
| 442 | 442 | // tidyYAMLError drops the Go type name yaml.v3 leaks into its messages, which | |
| 443 | // means nothing to someone editing a workflow. | ||
| 443 | // means nothing to someone editing a ci. | ||
| 444 | 444 | func tidyYAMLError(err error) string { | |
| 445 | 445 | msg := err.Error() | |
| 446 | 446 | msg = strings.ReplaceAll(msg, "yaml: unmarshal errors:\n ", "") | |
| 447 | 447 | for _, suffix := range []string{ | |
| 448 | " not found in type workflow.rawJob", | ||
| 449 | " not found in type workflow.rawStep", | ||
| 450 | " not found in type workflow.rawWorkflow", | ||
| 451 | " not found in type workflow.raw", | ||
| 448 | " not found in type ci.rawJob", | ||
| 449 | " not found in type ci.rawStep", | ||
| 450 | " not found in type ci.rawWorkflow", | ||
| 451 | " not found in type ci.raw", | ||
| 452 | 452 | } { | |
| 453 | 453 | msg = strings.ReplaceAll(msg, suffix, " is not a known key here") | |
| 454 | 454 | } | |
| @@ -469,8 +469,8 @@ func firstLine(s string) string { | |||
| 469 | 469 | ||
| 470 | 470 | // At loads and validates the workflows in a git tree, with the blob id of each | |
| 471 | 471 | // file so a run can be pinned to the version it was queued from. | |
| 472 | func At(g *gitx.Repo, commit string) ([]*Workflow, []string) { | ||
| 473 | if commit == "" || commit == gitx.ZeroSHA { | ||
| 472 | func At(g *git.Repo, commit string) ([]*Workflow, []string) { | ||
| 473 | if commit == "" || commit == git.ZeroSHA { | ||
| 474 | 474 | return nil, nil | |
| 475 | 475 | } | |
| 476 | 476 | blobs, err := g.LsTreeR(commit) | |
| @@ -499,8 +499,8 @@ func At(g *gitx.Repo, commit string) ([]*Workflow, []string) { | |||
| 499 | 499 | ||
| 500 | 500 | // ValidateTree checks the workflows in a git tree. Called from pre-receive, so a | |
| 501 | 501 | // bad workflow fails the push that introduced it. | |
| 502 | func ValidateTree(g *gitx.Repo, commit string) []string { | ||
| 503 | if commit == "" || commit == gitx.ZeroSHA { | ||
| 502 | func ValidateTree(g *git.Repo, commit string) []string { | ||
| 503 | if commit == "" || commit == git.ZeroSHA { | ||
| 504 | 504 | return nil | |
| 505 | 505 | } | |
| 506 | 506 | blobs, err := g.LsTreeR(commit) | |