web

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

README

Web UI

Building frontend assets

Tailwind CSS

You need to have the tailwind CSS CLI installed.

To install it you can run:

npm install tailwindcss @tailwindcss/cli --save-dev

You need to have the esbuild CLI installed.

To build the assets, run the following commands in the web/app directory.

Install dependencies with

npm install

Generate the output.css file

npx tailwindcss -i ./assets/css/tailwind.css -o ./output.css

Generate the bundle.js file

esbuild index.js --bundle --outfile=bundle.js
OpenAPI spec (swagger)

The web server hosts the API's openAPI spec using redoc. To update the swagger.json specification run the following command:

docker run --rm -v $(pwd):/go/src/app -w /go/src/app golang:1.24 \
  sh -c "go install github.com/swaggo/swag/cmd/swag@latest && swag init -g main.go --output internal/web/app --parseDependency --parseInternal --parseDepth 1 --parseVendor && rm internal/web/app/swagger.yaml internal/web/app/docs.go"

Docker

See the README.md at the root of the project

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func App

func App(config AppConfig) error

func HandleBindBuildJob added in v0.7.2

func HandleBindBuildJob(c echo.Context) error

@Summary Bind a queued build job to a worker @Description Allows a worker to claim a queued job @Tags builds @Accept json @Produce json @Param worker_id query string true "Worker ID" @Success 200 {object} object{job_id=string,job=jobstorage.BuildJob} "Job ID and job details" @Failure 400 {object} map[string]string @Failure 404 {object} map[string]string @Failure 500 {object} map[string]string @Router /builds/bind [get]

func HandleGetArtifacts added in v0.7.2

func HandleGetArtifacts(c echo.Context) error

@Summary List build artifacts @Description Returns the list of artifacts for a job @Tags builds @Accept json @Produce json @Param job_id path string true "Job ID" @Success 200 {array} object{name=string,url=string} "List of artifacts with friendly names and URLs" @Failure 404 {object} map[string]string @Failure 500 {object} map[string]string @Router /builds/{job_id}/artifacts [get]

func HandleGetBuild added in v0.7.2

func HandleGetBuild(c echo.Context) error

@Summary Get build job details @Description Returns a job by ID @Tags builds @Accept json @Produce json @Param job_id path string true "Job ID" @Success 200 {object} jobstorage.BuildJob @Failure 404 {object} map[string]string @Failure 500 {object} map[string]string @Router /builds/{job_id} [get]

func HandleGetBuildLogs added in v0.7.2

func HandleGetBuildLogs(c echo.Context) error

@Summary Get build logs @Description Returns the build logs for a job via WebSocket connection @Tags builds @Accept json @Produce json @Param job_id path string true "Job ID" @Success 101 {string} string "Switching to WebSocket protocol" @Failure 404 {object} map[string]string @Failure 500 {object} map[string]string @Router /builds/{job_id}/logs [get]

func HandleQueueBuild added in v0.7.2

func HandleQueueBuild(c echo.Context) error

@Summary Queue a new build job @Description Creates a new build job and adds it to the queue @Tags builds @Accept json @Produce json @Param job body jobstorage.JobData true "Build job data" @Success 200 {object} BuildResponse @Failure 400 {object} map[string]string @Failure 500 {object} map[string]string @Router /builds [post]

func HandleUpdateJobStatus added in v0.7.2

func HandleUpdateJobStatus(c echo.Context) error

@Summary Update build job status @Description Allows a worker to update the status of their assigned job @Tags builds @Accept json @Produce json @Param job_id path string true "Job ID" @Param worker_id query string true "Worker ID" @Param status body web.StatusUpdateRequest true "Status update" @Success 200 {object} jobstorage.BuildJob @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 404 {object} map[string]string @Failure 500 {object} map[string]string @Router /builds/{job_id}/status [put]

func HandleUploadArtifact added in v0.7.2

func HandleUploadArtifact(c echo.Context) error

@Summary Upload build artifact @Description Handles uploading build artifacts from workers @Tags builds @Accept multipart/form-data @Produce json @Param job_id path string true "Job ID" @Param worker_id query string true "Worker ID" @Param filename path string true "Artifact filename" @Param file formData file true "Artifact file" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 404 {object} map[string]string @Failure 500 {object} map[string]string @Router /builds/{job_id}/artifacts/{filename} [post]

func HandleWriteBuildLogs added in v0.7.2

func HandleWriteBuildLogs(c echo.Context) error

@Summary Write build logs @Description Handles streaming logs for a job via WebSocket connection @Tags builds @Accept json @Produce json @Param job_id path string true "Job ID" @Param worker_id query string true "Worker ID" @Success 101 {string} string "Switching to WebSocket protocol" @Failure 400 {object} map[string]string @Failure 403 {object} map[string]string @Failure 404 {object} map[string]string @Failure 500 {object} map[string]string @Router /builds/{job_id}/logs/write [get]

Types

type AppConfig added in v0.7.2

type AppConfig struct {
	EnableLogger bool
	ListenAddr   string
	OutDir       string
	BuildsDir    string
}

type BuildResponse added in v0.7.2

type BuildResponse struct {
	UUID string `json:"uuid"`
}

type StatusUpdateRequest added in v0.7.2

type StatusUpdateRequest struct {
	Status jobstorage.JobStatus `json:"status" example:"running"`
}

StatusUpdateRequest represents a request to update the status of a job @Description Request body for updating job status @Example {"status": "running"}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL