From d8acd8a29aca25055244b9e28a8ad520e82a41cd Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 1 Oct 2026 14:51:02 +0900 Subject: cmd/mbf/internal/ci: document dist endpoint There will eventually be more endpoints for other CI workloads. Signed-off-by: Ophestra --- cmd/mbf/internal/ci/ci.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/mbf/internal/ci/ci.go b/cmd/mbf/internal/ci/ci.go index c9d585d4..b19b6ca5 100644 --- a/cmd/mbf/internal/ci/ci.go +++ b/cmd/mbf/internal/ci/ci.go @@ -63,7 +63,7 @@ func inotifyAddWatch( // Follow reads from the file at pathname and writes its contents and any new // contents to w. follow returns if a read, write or inotify error occurs, or -// the context is canceled. +// the context is cancelled. func Follow(ctx context.Context, pathname string, w io.Writer) (err error) { var in *os.File if in, err = inotifyInit(); err != nil { @@ -442,13 +442,19 @@ func (p Path) fetch(ctx context.Context, id *pkg.ID, output string) error { return err } +const ( + // endpointDist accepts a Path.writeSource stream and produces a + // distribution for the submitted source. + endpointDist = "/dist" +) + // MakeDist creates a hakurei distribution using the CI service. func (p Path) MakeDist( ctx context.Context, w io.Writer, output, source, version string, ) error { - id, err := p.writeSource(ctx, w, "/dist", source, version) + id, err := p.writeSource(ctx, w, endpointDist, source, version) if err != nil { return err } @@ -465,7 +471,7 @@ func Serve(ctx context.Context, msg message.Msg, c *pkg.Cache) error { } var mux http.ServeMux - mux.HandleFunc("POST /dist", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("POST "+endpointDist, func(w http.ResponseWriter, r *http.Request) { s, err := readSource(w, r) if err != nil { msg.Verbose(err) -- cgit v1.3.1