forked from vieter-v/vieter
Compare commits
No commits in common. "404669c5a73756e8521eeac9abf04c7f54d599b4" and "5ab60c637bb26d8efadd90c20a7aa58aa9df2649" have entirely different histories.
404669c5a7
...
5ab60c637b
|
|
@ -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')" && \
|
"https://s3.rustybever.be/vieter/commits/${CI_COMMIT_SHA}/vieter-$(echo "${TARGETPLATFORM}" | sed 's:/:-:g')" && \
|
||||||
chmod +x vieter ; \
|
chmod +x vieter ; \
|
||||||
else \
|
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 ; \
|
mv pvieter vieter ; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -31,8 +31,10 @@ RUN if [ -n "${CI_COMMIT_SHA}" ]; then \
|
||||||
FROM busybox:1.35.0
|
FROM busybox:1.35.0
|
||||||
|
|
||||||
ENV PATH=/bin \
|
ENV PATH=/bin \
|
||||||
VIETER_DATA_DIR=/data \
|
VIETER_REPOS_DIR=/data/repos \
|
||||||
VIETER_PKG_DIR=/data/pkgs
|
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/
|
COPY --from=builder /app/dumb-init /app/vieter /bin/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@ import env
|
||||||
struct Config {
|
struct Config {
|
||||||
pub:
|
pub:
|
||||||
log_level string = 'WARN'
|
log_level string = 'WARN'
|
||||||
|
log_file string = 'vieter.log'
|
||||||
api_key string
|
api_key string
|
||||||
address string
|
address string
|
||||||
data_dir string
|
|
||||||
base_image string = 'archlinux:base-devel'
|
base_image string = 'archlinux:base-devel'
|
||||||
max_concurrent_builds int = 1
|
max_concurrent_builds int = 1
|
||||||
api_update_frequency int = 15
|
api_update_frequency int = 15
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,6 @@ module cron
|
||||||
import log
|
import log
|
||||||
import cron.daemon
|
import cron.daemon
|
||||||
import cron.expression
|
import cron.expression
|
||||||
import os
|
|
||||||
|
|
||||||
const log_file_name = 'vieter.cron.log'
|
|
||||||
|
|
||||||
// cron starts a cron daemon & starts periodically scheduling builds.
|
// cron starts a cron daemon & starts periodically scheduling builds.
|
||||||
pub fn cron(conf Config) ? {
|
pub fn cron(conf Config) ? {
|
||||||
|
|
@ -18,8 +15,7 @@ pub fn cron(conf Config) ? {
|
||||||
level: log_level
|
level: log_level
|
||||||
}
|
}
|
||||||
|
|
||||||
log_file := os.join_path_single(conf.data_dir, cron.log_file_name)
|
logger.set_full_logpath(conf.log_file)
|
||||||
logger.set_full_logpath(log_file)
|
|
||||||
logger.log_to_console_too()
|
logger.log_to_console_too()
|
||||||
|
|
||||||
ce := expression.parse_expression(conf.global_schedule) or {
|
ce := expression.parse_expression(conf.global_schedule) or {
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ import time
|
||||||
import sync.stdatomic
|
import sync.stdatomic
|
||||||
import build
|
import build
|
||||||
|
|
||||||
const (
|
const build_empty = 0
|
||||||
build_empty = 0
|
|
||||||
build_running = 1
|
const build_running = 1
|
||||||
build_done = 2
|
|
||||||
)
|
const build_done = 2
|
||||||
|
|
||||||
// clean_finished_builds removes finished builds from the build slots & returns
|
// clean_finished_builds removes finished builds from the build slots & returns
|
||||||
// them.
|
// them.
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,11 @@ import build
|
||||||
import docker
|
import docker
|
||||||
import db
|
import db
|
||||||
|
|
||||||
const (
|
// How many seconds to wait before retrying to update API if failed
|
||||||
// How many seconds to wait before retrying to update API if failed
|
const api_update_retry_timeout = 5
|
||||||
api_update_retry_timeout = 5
|
|
||||||
// How many seconds to wait before retrying to rebuild image if failed
|
// How many seconds to wait before retrying to rebuild image if failed
|
||||||
rebuild_base_image_retry_timout = 30
|
const rebuild_base_image_retry_timout = 30
|
||||||
)
|
|
||||||
|
|
||||||
struct ScheduledBuild {
|
struct ScheduledBuild {
|
||||||
pub:
|
pub:
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import net.http
|
||||||
import response { new_data_response, new_response }
|
import response { new_data_response, new_response }
|
||||||
import db
|
import db
|
||||||
|
|
||||||
|
const repos_file = 'repos.json'
|
||||||
|
|
||||||
// get_repos returns the current list of repos.
|
// get_repos returns the current list of repos.
|
||||||
['/api/repos'; get]
|
['/api/repos'; get]
|
||||||
fn (mut app App) get_repos() web.Result {
|
fn (mut app App) get_repos() web.Result {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ pub:
|
||||||
conf Config [required; web_global]
|
conf Config [required; web_global]
|
||||||
pub mut:
|
pub mut:
|
||||||
repo repo.RepoGroupManager [required; web_global]
|
repo repo.RepoGroupManager [required; web_global]
|
||||||
|
// This is used to claim the file lock on the repos file
|
||||||
|
git_mutex shared util.Dummy
|
||||||
db db.VieterDb
|
db db.VieterDb
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue