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.

Add event, schedule and manual workflow triggers

eb07ff5696e0d83201215966e3ea1e6a24467581 · Keenan Nemetz · 8d ago · parent 1cde8b9e

Add event, schedule and manual workflow triggers

Workflows can now react to change requests, issues, comments, cron
schedules and manual runs, and a push trigger can filter by the paths it
changed. Branch and tag patterns gain ! exclusion.

Event runs are pinned with a JSON payload and the runner exposes it as
VOLE_EVENT, VOLE_EVENT_ACTION and VOLE_EVENT_PATH. Change-request runs
check out the base tip and carry the head and changed files, so an event
never executes an unapproved contributor commit.

Workflow dispatch resolves typed inputs and is available from the
workflows page and `vole workflow dispatch`. Deduplication now includes
an occurrence so the same commit can run for a later event or schedule
slot while a push remains idempotent.

Part of: #138

server/ssh/dispatch.go +57

@@ -0,0 +1,57 @@
1 package ssh
2
3 import (
4 "fmt"
5 "strings"
6
7 xssh "golang.org/x/crypto/ssh"
8 )
9
10 // serveWorkflowDispatch queues one manual run.
11 //
12 // vole-workflow-dispatch <repository> <workflow-path> <ref|-> [name=value]...
13 //
14 // The ref "-" means the repository's default branch. The dispatcher on the
15 // instance resolves the workflow, validates the inputs and re-checks the caller's
16 // permission, so this function is only the wire.
17 func (s *Server) serveWorkflowDispatch(ch xssh.Channel, argv []string, user string) int {
18 if len(argv) < 4 {
19 fmt.Fprint(ch, "vole: usage: vole-workflow-dispatch <repository> <workflow> <ref|-> [name=value]...\n")
20 return 129
21 }
22 name, ok := repoName(argv[1])
23 if !ok {
24 fmt.Fprint(ch, "vole: invalid repository name\n")
25 return 129
26 }
27 workflow := strings.TrimSpace(argv[2])
28 if workflow == "" {
29 fmt.Fprint(ch, "vole: a workflow path is required\n")
30 return 129
31 }
32 ref := strings.TrimSpace(argv[3])
33 if ref == "-" {
34 ref = ""
35 }
36 inputs := map[string]string{}
37 for _, pair := range argv[4:] {
38 key, value, ok := strings.Cut(pair, "=")
39 key = strings.TrimSpace(key)
40 if !ok || key == "" {
41 fmt.Fprintf(ch, "vole: input %q is not name=value\n", pair)
42 return 129
43 }
44 inputs[key] = value
45 }
46 if s.cfg.DispatchWorkflow == nil {
47 fmt.Fprint(ch, "vole: manual workflow runs are not configured on this server\n")
48 return 1
49 }
50 n, err := s.cfg.DispatchWorkflow(name, workflow, ref, inputs, user)
51 if err != nil {
52 fmt.Fprintf(ch, "vole: %v\n", err)
53 return 1
54 }
55 fmt.Fprintf(ch, "queued %d run(s)\n", n)
56 return 0
57 }