builder

package
v0.0.0-...-3bd1c47 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone(recipe *common.Recipe) (string, error)

Clone uses go-git library to single-branch clone the repository of the provided Recipe.

Returns the final path the the repo was checked out

func ConfigureTasks

func ConfigureTasks(amount int)

ConfigureTasks prepares the builder to be ready for picking up work

func Enqueue

func Enqueue(r common.Recipe)

Enqueue adds a recipe to the queue for running when a task is available

func IsBitBucketMerge

func IsBitBucketMerge(r common.Recipe, payload []byte) bool

IsBitBucketMerge checks whether the provided Recipe matches the BitBucket payload of the hook request.

func IsGithubMerge

func IsGithubMerge(r common.Recipe, payload []byte) bool

IsGithubMerge checks whether the provided Recipe matches the Github payload of the hook request.

func IsManualTrigger

func IsManualTrigger(r common.Recipe, payload []byte) bool

IsManualTrigger detects a dummy payload that forces build of the recipe.

func RunRecipe

func RunRecipe(recipe common.Recipe) bool

RunRecipe tries to find an available task to run the given recipe instance

func RunTask

func RunTask(index int)

RunTask is implementing the core building logic. A fixed number of RunTask goroutines are started initially based on the task_queue_size parameter of the config

Types

type BBActor

type BBActor struct {
	DisplayName string `json:"display_name"`
	UUID        string `json:"uuid"`
	AccountID   string `json:"account_id"`
	Nickname    string `json:"nickname"`
	Type        string `json:"type"`
}

BBActor contains more details about the person that triggered the push

type BBPushDetails

type BBPushDetails struct {
	Changes []struct {
		Forced    bool `json:"forced"` // Force Push
		Created   bool `json:"created"`
		Truncated bool `json:"truncated"` //  whether BB truncated the commits array in this payload.
		Closed    bool `json:"closed"`
		// An object containing information about the state
		// of the reference before the push. When a branch
		// is created, old is null.
		Old *BBReferenceState `json:"old"`
		// An object containing information about the state
		// of the reference after the push. When a branch is
		// deleted, new is null.
		New *BBReferenceState `json:"new"`
	} `json:"changes"`
}

BBPushDetails contains all the details and references of the push.

type BBPushEvent

type BBPushEvent struct {
	Push       BBPushDetails `json:"push"`
	Actor      BBActor       `json:"actor"`
	Repository BBRepository  `json:"repository"`
}

BBPushEvent represents a Push of changes either new branch or a merge etc

https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Push

type BBReferenceState

type BBReferenceState struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Target struct {
		Hash    string `json:"hash"`
		Type    string `json:"type"`
		Date    string `json:"date"`
		Message string `json:"message"`
		Author  struct {
			Type string `json:"type"`
			Raw  string `json:"raw"`
		} `json:"author"`
	} `json:"target"`
}

BBReferenceState contains state of the reference It is used in BBPushDetails to capture the state before (old) the push and after (new) it.

type BBRepository

type BBRepository struct {
	SCM       string  `json:"scm"`
	Website   *string `json:"website"`
	Name      string  `json:"name"`
	FullName  string  `json:"full_name"`
	Owner     BBActor `json:"owner"`
	Type      string  `json:"type"`
	IsPrivate bool    `json:"is_private"`
	UUID      string  `json:"uuid"`
}

BBRepository contains really basic info about the BitBucket repository. It is contained in most webhook payloads.

type GHPushEvent

type GHPushEvent struct {
	Ref          string       `json:"ref"`
	SHAHead      string       `json:"head"`
	SHABefore    string       `json:"before"`
	Size         int          `json:"size"`
	DistinctSize int          `json:"distinct_size"`
	Repository   GHRepository `json:"repository"`
	Pusher       GHPusher     `json:"pusher"`
	Sender       GHSender     `json:"sender"`
}

GHPushEvent represents a Push of changes either new branch or a merge etc https://developer.github.com/v3/activity/events/types/#pushevent

type GHPusher

type GHPusher struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

GHPusher contains the most basic info of the person that triggered the push

type GHRepository

type GHRepository struct {
	Name     string `json:"name"`
	FullName string `json:"full_name"`
	URL      string `json:"html_url"`
	Created  bool   `json:"created"`
	Deleted  bool   `json:"deleted"`
	Forced   bool   `json:"forced"`
	BaseRef  string `json:"base_ref"`
}

GHRepository contains really basic info about a GitHub repository. It is contained in most webhook payloads.

type GHSender

type GHSender struct {
	ID        int    `json:"id"`
	Login     string `json:"login"`
	AvatarURL string `json:"avatar_url"`
	URL       string `json:"html_url"`
	Type      string `json:"type"`
}

GHSender contains more details about the person that triggered the push

type ManualTrigger

type ManualTrigger struct {
	Who        string `json:"who"`
	ForceBuild bool   `json:"force_build"`
}

ManualTrigger this is the POST payload expected when a manual trigger happens from the admin panel.

Jump to

Keyboard shortcuts

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