Builder now gets list of repos from server
ci/woodpecker/push/deploy unknown status Details
ci/woodpecker/push/docker unknown status Details
ci/woodpecker/push/lint Pipeline failed Details
ci/woodpecker/push/build Pipeline was successful Details

pull/95/head
Jef Roosens 2022-02-21 22:58:05 +01:00
parent fe98112f79
commit 6194a3f408
Signed by: Jef Roosens
GPG Key ID: 955C0660072F691F
3 changed files with 8 additions and 5 deletions

View File

@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Better environment variable support * Better environment variable support
* Each env var can now be provided from a file by appending it with `_FILE` * Each env var can now be provided from a file by appending it with `_FILE`
& passing the path to the file as value & passing the path to the file as value
* API for managing Git repositories to build
## Fixed ## Fixed

View File

@ -8,16 +8,19 @@ import os
import json import json
import server import server
import env import env
import net.http
const container_build_dir = '/build' const container_build_dir = '/build'
fn build() ? { fn build() ? {
conf := env.load<env.BuildConfig>() ? conf := env.load<env.BuildConfig>() ?
// Read in the repos from a json file // We get the repos list from the Vieter instance
filename := os.join_path_single(conf.repo_dir, 'repos.json') mut req := http.new_request(http.Method.get, '${conf.address}/api/repos', '') ?
txt := os.read_file(filename) ? req.add_custom_header('X-Api-Key', conf.api_key) ?
repos := json.decode([]server.GitRepo, txt) ?
res := req.do() ?
repos := json.decode([]server.GitRepo, res.text) ?
mut commands := [ mut commands := [
// Update repos & install required packages // Update repos & install required packages

View File

@ -23,7 +23,6 @@ pub:
pub struct BuildConfig { pub struct BuildConfig {
pub: pub:
api_key string api_key string
repo_dir string
address string address string
} }