pipeline

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: Apache-2.0 Imports: 35 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteBinary

func DeleteBinary(p gaia.Pipeline) error

DeleteBinary deletes the binary for the given pipeline.

func GetExecPath

func GetExecPath(p gaia.Pipeline) string

GetExecPath returns the path to the executable for the given pipeline.

func GitLSRemote

func GitLSRemote(repo *gaia.GitRepo) error

GitLSRemote get remote branches from a git repo without actually cloning the repo. This is great for looking if we have access to this repo.

func RenameBinary

func RenameBinary(p gaia.Pipeline, newName string) error

RenameBinary renames the binary file for the given pipeline.

func ValidatePipelineName added in v0.2.3

func ValidatePipelineName(pName string) error

ValidatePipelineName validates a given pipeline name and returns the correct error back.

Types

type ActivePipelines

type ActivePipelines struct {
	sync.RWMutex

	// All active pipelines
	Pipelines []gaia.Pipeline
}

ActivePipelines holds all active pipelines. ActivePipelines can be safely shared between goroutines.

var (
	// GlobalActivePipelines holds globally all current active pipelines.
	GlobalActivePipelines *ActivePipelines
)

func NewActivePipelines

func NewActivePipelines() *ActivePipelines

NewActivePipelines creates a new instance of ActivePipelines

func (*ActivePipelines) Append

func (ap *ActivePipelines) Append(p gaia.Pipeline)

Append appends a new pipeline to ActivePipelines.

func (*ActivePipelines) Contains

func (ap *ActivePipelines) Contains(n string) bool

Contains checks if the given pipeline name has been already appended to the given ActivePipelines instance.

func (*ActivePipelines) GetAll added in v0.2.4

func (ap *ActivePipelines) GetAll() []gaia.Pipeline

GetAll iterates over the pipelines in the concurrent slice.

func (*ActivePipelines) GetByName

func (ap *ActivePipelines) GetByName(n string) *gaia.Pipeline

GetByName looks up the pipeline by the given name.

func (*ActivePipelines) Remove

func (ap *ActivePipelines) Remove(index int) error

Remove removes a pipeline at the given index from ActivePipelines.

func (*ActivePipelines) RemoveDeletedPipelines

func (ap *ActivePipelines) RemoveDeletedPipelines(existingPipelineNames []string)

RemoveDeletedPipelines removes the pipelines whose names are NOT present in `existingPipelineNames` from the given ActivePipelines instance.

func (*ActivePipelines) Replace

func (ap *ActivePipelines) Replace(p gaia.Pipeline) bool

Replace takes the given pipeline and replaces it in the ActivePipelines slice. Return true when success otherwise false.

func (*ActivePipelines) ReplaceByName

func (ap *ActivePipelines) ReplaceByName(n string, p gaia.Pipeline) bool

ReplaceByName replaces the pipeline that has the given name with the given pipeline.

func (*ActivePipelines) Update

func (ap *ActivePipelines) Update(index int, p gaia.Pipeline) error

Update updates a pipeline at the given index with the given pipeline.

type BuildPipeline

type BuildPipeline interface {
	// PrepareEnvironment prepares the environment before we start the
	// build process.
	PrepareEnvironment(*gaia.CreatePipeline) error

	// ExecuteBuild executes the compiler and tracks the status of
	// the compiling process.
	ExecuteBuild(*gaia.CreatePipeline) error

	// CopyBinary copies the result from the compile process
	// to the plugins folder.
	CopyBinary(*gaia.CreatePipeline) error

	// SavePipeline the pipeline in its current format
	SavePipeline(*gaia.Pipeline) error
}

BuildPipeline is the interface for pipelines which are not yet compiled.

type BuildPipelineCpp

type BuildPipelineCpp struct {
	Type gaia.PipelineType
}

BuildPipelineCpp is the real implementation of BuildPipeline for C++

func (*BuildPipelineCpp) CopyBinary

func (b *BuildPipelineCpp) CopyBinary(p *gaia.CreatePipeline) error

CopyBinary copies the final compiled binary to the destination folder.

func (*BuildPipelineCpp) ExecuteBuild

func (b *BuildPipelineCpp) ExecuteBuild(p *gaia.CreatePipeline) error

ExecuteBuild executes the c++ build process

func (*BuildPipelineCpp) PrepareEnvironment

func (b *BuildPipelineCpp) PrepareEnvironment(p *gaia.CreatePipeline) error

PrepareEnvironment prepares the environment before we start the build process.

func (*BuildPipelineCpp) SavePipeline

func (b *BuildPipelineCpp) SavePipeline(p *gaia.Pipeline) error

SavePipeline saves the current pipeline configuration.

type BuildPipelineGolang

type BuildPipelineGolang struct {
	Type gaia.PipelineType
}

BuildPipelineGolang is the real implementation of BuildPipeline for golang

func (*BuildPipelineGolang) CopyBinary

func (b *BuildPipelineGolang) CopyBinary(p *gaia.CreatePipeline) error

CopyBinary copies the final compiled archive to the destination folder.

func (*BuildPipelineGolang) ExecuteBuild

func (b *BuildPipelineGolang) ExecuteBuild(p *gaia.CreatePipeline) error

ExecuteBuild executes the golang build process

func (*BuildPipelineGolang) PrepareEnvironment

func (b *BuildPipelineGolang) PrepareEnvironment(p *gaia.CreatePipeline) error

PrepareEnvironment prepares the environment before we start the build process.

func (*BuildPipelineGolang) SavePipeline

func (b *BuildPipelineGolang) SavePipeline(p *gaia.Pipeline) error

SavePipeline saves the current pipeline configuration.

type BuildPipelineJava

type BuildPipelineJava struct {
	Type gaia.PipelineType
}

BuildPipelineJava is the real implementation of BuildPipeline for java

func (*BuildPipelineJava) CopyBinary

func (b *BuildPipelineJava) CopyBinary(p *gaia.CreatePipeline) error

CopyBinary copies the final compiled archive to the destination folder.

func (*BuildPipelineJava) ExecuteBuild

func (b *BuildPipelineJava) ExecuteBuild(p *gaia.CreatePipeline) error

ExecuteBuild executes the java build process

func (*BuildPipelineJava) PrepareEnvironment

func (b *BuildPipelineJava) PrepareEnvironment(p *gaia.CreatePipeline) error

PrepareEnvironment prepares the environment before we start the build process.

func (*BuildPipelineJava) SavePipeline

func (b *BuildPipelineJava) SavePipeline(p *gaia.Pipeline) error

SavePipeline saves the current pipeline configuration.

type BuildPipelineNodeJS added in v0.2.4

type BuildPipelineNodeJS struct {
	Type gaia.PipelineType
}

BuildPipelineNodeJS is the real implementation of BuildPipeline for NodeJS

func (*BuildPipelineNodeJS) CopyBinary added in v0.2.4

func (b *BuildPipelineNodeJS) CopyBinary(p *gaia.CreatePipeline) error

CopyBinary copies the final compiled binary to the destination folder.

func (*BuildPipelineNodeJS) ExecuteBuild added in v0.2.4

func (b *BuildPipelineNodeJS) ExecuteBuild(p *gaia.CreatePipeline) error

ExecuteBuild executes the NodeJS build process

func (*BuildPipelineNodeJS) PrepareEnvironment added in v0.2.4

func (b *BuildPipelineNodeJS) PrepareEnvironment(p *gaia.CreatePipeline) error

PrepareEnvironment prepares the environment before we start the build process.

func (*BuildPipelineNodeJS) SavePipeline added in v0.2.4

func (b *BuildPipelineNodeJS) SavePipeline(p *gaia.Pipeline) error

SavePipeline saves the current pipeline configuration.

type BuildPipelinePython

type BuildPipelinePython struct {
	Type gaia.PipelineType
}

BuildPipelinePython is the real implementation of BuildPipeline for python

func (*BuildPipelinePython) CopyBinary

func (b *BuildPipelinePython) CopyBinary(p *gaia.CreatePipeline) error

CopyBinary copies the final compiled archive to the destination folder.

func (*BuildPipelinePython) ExecuteBuild

func (b *BuildPipelinePython) ExecuteBuild(p *gaia.CreatePipeline) error

ExecuteBuild executes the python build process

func (*BuildPipelinePython) PrepareEnvironment

func (b *BuildPipelinePython) PrepareEnvironment(p *gaia.CreatePipeline) error

PrepareEnvironment prepares the environment before we start the build process.

func (*BuildPipelinePython) SavePipeline

func (b *BuildPipelinePython) SavePipeline(p *gaia.Pipeline) error

SavePipeline saves the current pipeline configuration.

type BuildPipelineRuby added in v0.2.3

type BuildPipelineRuby struct {
	Type        gaia.PipelineType
	GemfileName string
}

BuildPipelineRuby is the real implementation of BuildPipeline for Ruby

func (*BuildPipelineRuby) CopyBinary added in v0.2.3

func (b *BuildPipelineRuby) CopyBinary(p *gaia.CreatePipeline) error

CopyBinary copies the final compiled binary to the destination folder.

func (*BuildPipelineRuby) ExecuteBuild added in v0.2.3

func (b *BuildPipelineRuby) ExecuteBuild(p *gaia.CreatePipeline) error

ExecuteBuild executes the ruby build process

func (*BuildPipelineRuby) PrepareEnvironment added in v0.2.3

func (b *BuildPipelineRuby) PrepareEnvironment(p *gaia.CreatePipeline) error

PrepareEnvironment prepares the environment before we start the build process.

func (*BuildPipelineRuby) SavePipeline added in v0.2.3

func (b *BuildPipelineRuby) SavePipeline(p *gaia.Pipeline) error

SavePipeline saves the current pipeline configuration.

type Dependencies added in v0.2.4

type Dependencies struct {
	Scheduler service.GaiaScheduler
}

Dependencies defines dependencies which this service needs to operate.

type GaiaPipelineService added in v0.2.6

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

GaiaPipelineService defines a pipeline service provider providing pipeline related functions.

func NewGaiaPipelineService added in v0.2.4

func NewGaiaPipelineService(deps Dependencies) *GaiaPipelineService

NewGaiaPipelineService creates a pipeline service with its required dependencies already wired up

func (*GaiaPipelineService) CheckActivePipelines added in v0.2.6

func (s *GaiaPipelineService) CheckActivePipelines()

CheckActivePipelines looks up all files in the pipeline folder. Every file will be handled as an active pipeline and therefore saved in the global active pipelines slice.

func (*GaiaPipelineService) CreatePipeline added in v0.2.6

func (s *GaiaPipelineService) CreatePipeline(p *gaia.CreatePipeline)

CreatePipeline is the main function which executes step by step the creation of a plugin. After each step, the status is written to store and can be retrieved via API.

func (*GaiaPipelineService) InitTicker added in v0.2.6

func (s *GaiaPipelineService) InitTicker()

InitTicker initiates the pipeline ticker. This periodic job will check for new pipelines.

func (*GaiaPipelineService) StartPoller added in v0.2.6

func (s *GaiaPipelineService) StartPoller() error

StartPoller starts the poller if it's not already running.

func (*GaiaPipelineService) StopPoller added in v0.2.6

func (s *GaiaPipelineService) StopPoller() error

StopPoller sends a done signal to the polling timer if it's running.

func (*GaiaPipelineService) UpdateAllCurrentPipelines added in v0.2.6

func (s *GaiaPipelineService) UpdateAllCurrentPipelines()

UpdateAllCurrentPipelines will update all current pipelines.

func (*GaiaPipelineService) UpdateRepository added in v0.2.6

func (s *GaiaPipelineService) UpdateRepository(pipe *gaia.Pipeline) error

UpdateRepository takes a git type repository and updates it by pulling in new code if it's available.

type GithubClient

type GithubClient struct {
	Repositories GithubRepoService
	*github.Client
}

GithubClient is a client that has the ability to replace the actual git client.

func NewGithubClient

func NewGithubClient(httpClient *gohttp.Client, repoMock GithubRepoService) GithubClient

NewGithubClient creates a wrapper around the github client. This is needed in order to decouple gaia from github client to be able to unit test createGithubWebhook and ultimately have the ability to replace github with anything else.

type GithubRepoService

type GithubRepoService interface {
	CreateHook(ctx context.Context, owner, repo string, hook *github.Hook) (*github.Hook, *github.Response, error)
}

GithubRepoService is an interface defining the Wrapper Interface needed to test the github client.

type Servicer added in v0.2.6

type Servicer interface {
	CreatePipeline(p *gaia.CreatePipeline)
	InitTicker()
	CheckActivePipelines()
	UpdateRepository(p *gaia.Pipeline) error
	UpdateAllCurrentPipelines()
	StartPoller() error
	StopPoller() error
}

Servicer defines a scheduler service.

Jump to

Keyboard shortcuts

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