forked from vieter-v/vieter
refactor: renamed codebase to "targets"
This commit is contained in:
parent
faec08f846
commit
102a7f8899
19 changed files with 205 additions and 191 deletions
|
|
@ -6,7 +6,7 @@ import time
|
|||
import os
|
||||
import strings
|
||||
import util
|
||||
import models { GitRepo }
|
||||
import models { Target }
|
||||
|
||||
const (
|
||||
container_build_dir = '/build'
|
||||
|
|
@ -91,9 +91,9 @@ pub:
|
|||
}
|
||||
|
||||
// build_repo builds, packages & publishes a given Arch package based on the
|
||||
// provided GitRepo. The base image ID should be of an image previously created
|
||||
// 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_repo(address string, api_key string, base_image_id string, repo &GitRepo) ?BuildResult {
|
||||
pub fn build_repo(address string, api_key string, base_image_id string, repo &Target) ?BuildResult {
|
||||
mut dd := docker.new_conn()?
|
||||
|
||||
defer {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
module build
|
||||
|
||||
import models { GitRepo }
|
||||
import models { Target }
|
||||
|
||||
// escape_shell_string escapes any characters that could be interpreted
|
||||
// incorrectly by a shell. The resulting value should be safe to use inside an
|
||||
|
|
@ -22,8 +22,8 @@ pub fn echo_commands(cmds []string) []string {
|
|||
return out
|
||||
}
|
||||
|
||||
// create_build_script generates a shell script that builds a given GitRepo.
|
||||
fn create_build_script(address string, repo &GitRepo, build_arch string) string {
|
||||
// create_build_script generates a shell script that builds a given Target.
|
||||
fn create_build_script(address string, repo &Target, build_arch string) string {
|
||||
repo_url := '$address/$repo.repo'
|
||||
|
||||
commands := echo_commands([
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
module build
|
||||
|
||||
import models { GitRepo }
|
||||
import models { Target }
|
||||
|
||||
fn test_create_build_script() {
|
||||
repo := GitRepo{
|
||||
target := Target{
|
||||
id: 1
|
||||
url: 'https://examplerepo.com'
|
||||
branch: 'main'
|
||||
repo: 'vieter'
|
||||
}
|
||||
build_script := create_build_script('https://example.com', repo, 'x86_64')
|
||||
build_script := create_build_script('https://example.com', target, 'x86_64')
|
||||
expected := $embed_file('build_script.sh')
|
||||
|
||||
assert build_script == expected.to_string().trim_space()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue