portal: first lightUnverified
eb5d54d added
LICENSE +1 -0 | new file mode 100644 | ||
| @@ -0,0 +1 @@ | ||
| 1 | +The MIT License. | |
| new file mode 100644 | |||
| @@ -0,0 +1 @@ | |||
| 1 | +The MIT License. | ||
added
README.md +8 -0 | new file mode 100644 | ||
| @@ -0,0 +1,8 @@ | ||
| 1 | +# portal | |
| 2 | + | |
| 3 | +portal is the demo service we push around to show what rickub does: | |
| 4 | +hosted git, review with intent, CI with embedded test reports, and | |
| 5 | +releases your users can download. | |
| 6 | + | |
| 7 | +- `cmd/ciguest` — the guest watcher daemon | |
| 8 | +- `internal/` — the watch loop and its friends | |
| new file mode 100644 | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | +# portal | ||
| 2 | + | ||
| 3 | +portal is the demo service we push around to show what rickub does: | ||
| 4 | +hosted git, review with intent, CI with embedded test reports, and | ||
| 5 | +releases your users can download. | ||
| 6 | + | ||
| 7 | +- `cmd/ciguest` — the guest watcher daemon | ||
| 8 | +- `internal/` — the watch loop and its friends | ||
added
cmd/ciguest/main.go +15 -0 | new file mode 100644 | ||
| @@ -0,0 +1,15 @@ | ||
| 1 | +package main | |
| 2 | + | |
| 3 | +import ( | |
| 4 | + "context" | |
| 5 | + | |
| 6 | + "dev.rickub.com/rick/portal/internal/ci" | |
| 7 | +) | |
| 8 | + | |
| 9 | +func main() { | |
| 10 | + ctx := context.Background() | |
| 11 | + runner := ci.New(ctx) | |
| 12 | + if err := runner.Watch(); err != nil { | |
| 13 | + ci.Fatal(err) | |
| 14 | + } | |
| 15 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | +package main | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + | ||
| 6 | + "dev.rickub.com/rick/portal/internal/ci" | ||
| 7 | +) | ||
| 8 | + | ||
| 9 | +func main() { | ||
| 10 | + ctx := context.Background() | ||
| 11 | + runner := ci.New(ctx) | ||
| 12 | + if err := runner.Watch(); err != nil { | ||
| 13 | + ci.Fatal(err) | ||
| 14 | + } | ||
| 15 | +} | ||
added
docs/architecture.md +4 -0 | new file mode 100644 | ||
| @@ -0,0 +1,4 @@ | ||
| 1 | +# architecture | |
| 2 | + | |
| 3 | +portal watches a control plane and reconciles local state. | |
| 4 | +the watcher is the only component allowed to touch the disk. | |
| new file mode 100644 | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | +# architecture | ||
| 2 | + | ||
| 3 | +portal watches a control plane and reconciles local state. | ||
| 4 | +the watcher is the only component allowed to touch the disk. | ||
added
go.mod +4 -0 | new file mode 100644 | ||
| @@ -0,0 +1,4 @@ | ||
| 1 | +module dev.rickub.com/rick/portal | |
| 2 | + | |
| 3 | +go 1.26 | |
| 4 | + | |
| new file mode 100644 | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | +module dev.rickub.com/rick/portal | ||
| 2 | + | ||
| 3 | +go 1.26 | ||
| 4 | + | ||
added
internal/watcher/watch.go +12 -0 | new file mode 100644 | ||
| @@ -0,0 +1,12 @@ | ||
| 1 | +package watcher | |
| 2 | + | |
| 3 | +// Watch drives the guest loop: poll, apply, report. | |
| 4 | +func Watch(interval string) error { | |
| 5 | + tick := parseInterval(interval) | |
| 6 | + for range tick { | |
| 7 | + if err := apply(); err != nil { | |
| 8 | + return err | |
| 9 | + } | |
| 10 | + } | |
| 11 | + return nil | |
| 12 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | +package watcher | ||
| 2 | + | ||
| 3 | +// Watch drives the guest loop: poll, apply, report. | ||
| 4 | +func Watch(interval string) error { | ||
| 5 | + tick := parseInterval(interval) | ||
| 6 | + for range tick { | ||
| 7 | + if err := apply(); err != nil { | ||
| 8 | + return err | ||
| 9 | + } | ||
| 10 | + } | ||
| 11 | + return nil | ||
| 12 | +} | ||