Compare commits

..

No commits in common. "404669c5a73756e8521eeac9abf04c7f54d599b4" and "5ab60c637bb26d8efadd90c20a7aa58aa9df2649" have entirely different histories.

7 changed files with 22 additions and 21 deletions

View File

@ -23,7 +23,7 @@ RUN if [ -n "${CI_COMMIT_SHA}" ]; then \
"https://s3.rustybever.be/vieter/commits/${CI_COMMIT_SHA}/vieter-$(echo "${TARGETPLATFORM}" | sed 's:/:-:g')" && \
chmod +x vieter ; \
else \
LDFLAGS='-lz -lbz2 -llzma -lexpat -lzstd -llz4 -lsqlite3 -static' make prod && \
LDFLAGS='-lz -lbz2 -llzma -lexpat -lzstd -llz4 -static' make prod && \
mv pvieter vieter ; \
fi
@ -31,8 +31,10 @@ RUN if [ -n "${CI_COMMIT_SHA}" ]; then \
FROM busybox:1.35.0
ENV PATH=/bin \
VIETER_DATA_DIR=/data \
VIETER_PKG_DIR=/data/pkgs
VIETER_REPOS_DIR=/data/repos \
VIETER_PKG_DIR=/data/pkgs \
VIETER_DOWNLOAD_DIR=/data/downloads \
VIETER_REPOS_FILE=/data/repos.json
COPY --from=builder /app/dumb-init /app/vieter /bin/

View File

@ -6,9 +6,9 @@ import env
struct Config {
pub:
log_level string = 'WARN'
log_file string = 'vieter.log'
api_key string
address string
data_dir string
base_image string = 'archlinux:base-devel'
max_concurrent_builds int = 1
api_update_frequency int = 15

View File

@ -3,9 +3,6 @@ module cron
import log
import cron.daemon
import cron.expression
import os
const log_file_name = 'vieter.cron.log'
// cron starts a cron daemon & starts periodically scheduling builds.
pub fn cron(conf Config) ? {
@ -18,8 +15,7 @@ pub fn cron(conf Config) ? {
level: log_level
}
log_file := os.join_path_single(conf.data_dir, cron.log_file_name)
logger.set_full_logpath(log_file)
logger.set_full_logpath(conf.log_file)
logger.log_to_console_too()
ce := expression.parse_expression(conf.global_schedule) or {

View File

@ -4,11 +4,11 @@ import time
import sync.stdatomic
import build
const (
build_empty = 0
build_running = 1
build_done = 2
)
const build_empty = 0
const build_running = 1
const build_done = 2
// clean_finished_builds removes finished builds from the build slots & returns
// them.

View File

@ -10,12 +10,11 @@ import build
import docker
import db
const (
// How many seconds to wait before retrying to update API if failed
api_update_retry_timeout = 5
// How many seconds to wait before retrying to rebuild image if failed
rebuild_base_image_retry_timout = 30
)
// How many seconds to wait before retrying to update API if failed
const api_update_retry_timeout = 5
// How many seconds to wait before retrying to rebuild image if failed
const rebuild_base_image_retry_timout = 30
struct ScheduledBuild {
pub:

View File

@ -5,6 +5,8 @@ import net.http
import response { new_data_response, new_response }
import db
const repos_file = 'repos.json'
// get_repos returns the current list of repos.
['/api/repos'; get]
fn (mut app App) get_repos() web.Result {

View File

@ -20,7 +20,9 @@ pub:
conf Config [required; web_global]
pub mut:
repo repo.RepoGroupManager [required; web_global]
db db.VieterDb
// This is used to claim the file lock on the repos file
git_mutex shared util.Dummy
db db.VieterDb
}
// server starts the web server & starts listening for requests