build

package
v0.4.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2021 License: GPL-3.0, GPL-3.0-or-later Imports: 11 Imported by: 0

Documentation

Overview

There are n build workers, which are started at the start of mvoCI. They execute BuildWorker. When a new build object is spawned into the build queue / channel, it is fetched (from git repo), the buildscript is placed in the folder and executed with bash. Then the directory is zipped and later removed.

Two builds cannot be ongoing on the same repo at the same time.

Index

Constants

This section is empty.

Variables

View Source
var InChannel chan core.Build

channel / build queue for communication with the build workers

View Source
var Workers map[int]core.Thread

thread identifiers to the worker threads

Functions

func BuildHookedFromSecret3

func BuildHookedFromSecret3(db *gorm.DB, secret string, branch string, sha string) uint

build a repo given the secret provided by a version control service in its hook message

func BuildNow

func BuildNow(r core.Repository, db *gorm.DB) uint

build a repository now (the latest commit, default branch)

func BuildRelease

func BuildRelease(
	db *gorm.DB,
	r core.Repository, branch string,
	sha string,
	author string,
	url string,
	message string,
	event string,
	api string,
	apiUrl string) uint

Build a release of a given repository

func BuildSpecific2

func BuildSpecific2(db *gorm.DB, r core.Repository, branch string, sha string, author string, url string, message string, event string) uint

build a specific repo, branch and commit, already having found out the commit-message, commit-url and build-event (most likely hooked)

func BuildSpecific3

func BuildSpecific3(db *gorm.DB, r core.Repository, branch string, sha string, u core.User) uint

build a specific repo, branch and commit

func BuildWorker

func BuildWorker()

worker function: loop indefinitely and retrieve a new build from the build queue and build it.

func EnqueueBuild

func EnqueueBuild(b core.Build) error

enqueue the build into the build-queue (channel)

func FindBuildScript

func FindBuildScript(db *gorm.DB, r core.Repository, event string) (core.BuildScript, error)

helper function for finding the corrct build script given the event we just received (release or debug atm)

func ReBuild

func ReBuild(b core.Build, db *gorm.DB) uint

rebuild a given build

func SetupWorkerThreads

func SetupWorkerThreads(cfg *core.Config, db *gorm.DB)

sets up the worker threads in the given quantitiy

func WorkerGoBuild

func WorkerGoBuild(b *core.Build, log *mockerBuilder) (*mockerBuilder, bool)

Build the repo by executing every line of the build script

func WorkerGoCleanup

func WorkerGoCleanup(b *core.Build, log *mockerBuilder) (*mockerBuilder, bool)

removes the repo directory

func WorkerGoGet

func WorkerGoGet(b *core.Build) (*mockerBuilder, bool)

starts building a build, i.e. clone the repository, get the correct branch and commit, and calling every line of the build-script (WorkerGoBuild) if this all succeeds: set the status to "finished", "failed" otherwiese.

func WorkerGoZip

func WorkerGoZip(b *core.Build, log *mockerBuilder) (*mockerBuilder, bool)

Zips the repo directory with the builds

func WorkerPushRelease

func WorkerPushRelease(b *core.Build, log *mockerBuilder) (*mockerBuilder, bool)

atm for gitea we can push release builds to the code server using OAuth2 authentication (set-up beforehand by the user)

Types

type BuilderConfig

type BuilderConfig struct {
	// contains filtered or unexported fields
}

structure for storing a reference to the database and the global config

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL