models

package
v0.0.0-...-8a25d1e Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package models implements database persistence framework to API primitives.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Build

type Build struct {
	ID            int64      `yaml:"id" db:"id"`
	RepoFullName  string     `yaml:"repo_full_name" db:"repo_full_name"`
	CommitHash    string     `yaml:"commit_hash" db:"commit_hash"`
	CommitMessage string     `yaml:"commit_message" db:"commit_message"`
	StartedAt     *time.Time `yaml:"started_at" db:"started_at"`
	Success       bool       `yaml:"success" db:"success"`
	Log           string     `yaml:"log" db:"log"`
	CompletedAt   *time.Time `yaml:"completed_at" db:"completed_at"`
	*Recipe
}

Build defines the necessary data to run a build successfully.

func (*Build) Status

func (b *Build) Status() Status

Status returns the current status of the build.

type BuildRepository

type BuildRepository interface {
	Bootstrap() error
	Register(build *Build) (*Build, error)
	MarkInProgress(build *Build) error
	MarkComplete(build *Build) error
	GetLastBuild(repoFullName string) (*Build, error)
	ListByRepoFullName(repoFullName string) ([]*Build, error)
	SweepExpired(timeout time.Duration) (int64, error)
}

BuildRepository manipulate a collection of Build requests.

type Configuration

type Configuration map[string]Recipe

Configuration defines the internal parameters for the application.

func LoadConfiguration

func LoadConfiguration(r io.Reader) (Configuration, error)

LoadConfiguration loads a given fd with YAML content into Configuration.

type Recipe

type Recipe struct {
	Concurrency  int64          `yaml:"concurrency" db:"concurrency"`
	Clone        string         `yaml:"clone" db:"clone"`
	SlackWebhook string         `yaml:"slack_webhook" db:"slack_webhook"`
	GithubSecret string         `yaml:"github_secret" db:"github_secret"`
	Environment  string         `yaml:"environment" db:"environment"`
	Commands     string         `yaml:"commands" db:"commands"`
	Timeout      *time.Duration `yaml:"timeout" db:"timeout"`
}

Recipe defines the environment necessary to make a build.

type Status

type Status int

Status define the current build status of a Build

const (
	Unknown Status = iota
	Success
	Failed
	InProgress
)

Possible build status

Jump to

Keyboard shortcuts

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