From 03f2240ff63e2f115e348626941d8f7919bd3e0f Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Tue, 13 Dec 2022 17:51:42 +0100 Subject: [PATCH] chore: please the linter --- src/build/build.v | 3 ++- src/build/queue.v | 1 + src/build/shell_test.v | 2 -- src/client/jobs.v | 1 + src/server/api_builds.v | 4 +--- src/server/server.v | 2 ++ 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/build/build.v b/src/build/build.v index 2d51156..84d288c 100644 --- a/src/build/build.v +++ b/src/build/build.v @@ -103,6 +103,7 @@ pub: logs string } +// build_target builds the given target. Internally it calls `build_config`. pub fn build_target(address string, api_key string, base_image_id string, target &Target) !BuildResult { config := BuildConfig{ target_id: target.id @@ -116,7 +117,7 @@ pub fn build_target(address string, api_key string, base_image_id string, target return build_config(address, api_key, config) } -// build_target builds, packages & publishes a given Arch package based on the +// build_config builds, packages & publishes a given Arch package based on the // provided target. The base image ID should be of an image previously created // by create_build_image. It returns the logs of the container. pub fn build_config(address string, api_key string, config BuildConfig) !BuildResult { diff --git a/src/build/queue.v b/src/build/queue.v index a78e56a..2a28e62 100644 --- a/src/build/queue.v +++ b/src/build/queue.v @@ -41,6 +41,7 @@ mut: invalidated map[int]time.Time } +// new_job_queue initializes a new job queue pub fn new_job_queue(default_schedule CronExpression, default_base_image string) BuildJobQueue { return BuildJobQueue{ default_schedule: default_schedule diff --git a/src/build/shell_test.v b/src/build/shell_test.v index d228faf..8bb22d9 100644 --- a/src/build/shell_test.v +++ b/src/build/shell_test.v @@ -1,7 +1,5 @@ module build -import models - fn test_create_build_script_git_branch() { config := BuildConfig{ target_id: 1 diff --git a/src/client/jobs.v b/src/client/jobs.v index 30f2531..7fee94f 100644 --- a/src/client/jobs.v +++ b/src/client/jobs.v @@ -2,6 +2,7 @@ module client import build { BuildConfig } +// poll_jobs requests a list of new build jobs from the server. pub fn (c &Client) poll_jobs(arch string, max int) ![]BuildConfig { data := c.send_request<[]BuildConfig>(.get, '/api/v1/jobs/poll', { 'arch': arch diff --git a/src/server/api_builds.v b/src/server/api_builds.v index ec3c8ec..922b252 100644 --- a/src/server/api_builds.v +++ b/src/server/api_builds.v @@ -2,10 +2,8 @@ module server import web import web.response { new_data_response, new_response } -// import os -// import util -// import models { BuildLog, BuildLogFilter } +// v1_poll_job_queue allows agents to poll for new build jobs. ['/api/v1/jobs/poll'; auth; get] fn (mut app App) v1_poll_job_queue() web.Result { arch := app.query['arch'] or { diff --git a/src/server/server.v b/src/server/server.v index e2c19c2..1e86906 100644 --- a/src/server/server.v +++ b/src/server/server.v @@ -27,6 +27,8 @@ pub mut: db db.VieterDb } +// init_job_queue populates a fresh job queue with all the targets currently +// stored in the database. fn (mut app App) init_job_queue() ! { // Initialize build queues mut targets := app.db.get_targets(limit: 25)