Documentation ¶
Index ¶
- func DeleteBinary(p belaur.Pipeline) error
- func GetExecPath(p belaur.Pipeline) string
- func GitLSRemote(repo *belaur.GitRepo) error
- func RenameBinary(p belaur.Pipeline, newName string) error
- func ValidatePipelineName(pName string) error
- type ActivePipelines
- func (ap *ActivePipelines) Append(p belaur.Pipeline)
- func (ap *ActivePipelines) Contains(n string) bool
- func (ap *ActivePipelines) GetAll() []belaur.Pipeline
- func (ap *ActivePipelines) GetByName(n string) *belaur.Pipeline
- func (ap *ActivePipelines) Remove(index int) error
- func (ap *ActivePipelines) RemoveDeletedPipelines(existingPipelineNames []string)
- func (ap *ActivePipelines) Replace(p belaur.Pipeline) bool
- func (ap *ActivePipelines) ReplaceByName(n string, p belaur.Pipeline) bool
- func (ap *ActivePipelines) Update(index int, p belaur.Pipeline) error
- type BelaurPipelineService
- func (s *BelaurPipelineService) CheckActivePipelines()
- func (s *BelaurPipelineService) CreatePipeline(p *belaur.CreatePipeline)
- func (s *BelaurPipelineService) InitTicker()
- func (s *BelaurPipelineService) StartPoller() error
- func (s *BelaurPipelineService) StopPoller() error
- func (s *BelaurPipelineService) UpdateAllCurrentPipelines()
- func (s *BelaurPipelineService) UpdateRepository(pipe *belaur.Pipeline) error
- type BuildPipeline
- type BuildPipelineCpp
- type BuildPipelineGolang
- type BuildPipelineJava
- type BuildPipelineNodeJS
- type BuildPipelinePython
- type BuildPipelineRuby
- type Dependencies
- type GithubClient
- type GithubRepoService
- type Servicer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteBinary ¶
DeleteBinary deletes the binary for the given pipeline.
func GetExecPath ¶
GetExecPath returns the path to the executable for the given pipeline.
func GitLSRemote ¶
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 ¶
RenameBinary renames the binary file for the given pipeline.
func ValidatePipelineName ¶
ValidatePipelineName validates a given pipeline name and returns the correct error back.
Types ¶
type ActivePipelines ¶
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 belaur.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 ¶
func (ap *ActivePipelines) GetAll() []belaur.Pipeline
GetAll iterates over the pipelines in the concurrent slice.
func (*ActivePipelines) GetByName ¶
func (ap *ActivePipelines) GetByName(n string) *belaur.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 belaur.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 belaur.Pipeline) bool
ReplaceByName replaces the pipeline that has the given name with the given pipeline.
type BelaurPipelineService ¶
type BelaurPipelineService struct {
// contains filtered or unexported fields
}
BelaurPipelineService defines a pipeline service provider providing pipeline related functions.
func NewBelaurPipelineService ¶
func NewBelaurPipelineService(deps Dependencies) *BelaurPipelineService
NewBelaurPipelineService creates a pipeline service with its required dependencies already wired up
func (*BelaurPipelineService) CheckActivePipelines ¶
func (s *BelaurPipelineService) 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 (*BelaurPipelineService) CreatePipeline ¶
func (s *BelaurPipelineService) CreatePipeline(p *belaur.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 (*BelaurPipelineService) InitTicker ¶
func (s *BelaurPipelineService) InitTicker()
InitTicker initiates the pipeline ticker. This periodic job will check for new pipelines.
func (*BelaurPipelineService) StartPoller ¶
func (s *BelaurPipelineService) StartPoller() error
StartPoller starts the poller if it's not already running.
func (*BelaurPipelineService) StopPoller ¶
func (s *BelaurPipelineService) StopPoller() error
StopPoller sends a done signal to the polling timer if it's running.
func (*BelaurPipelineService) UpdateAllCurrentPipelines ¶
func (s *BelaurPipelineService) UpdateAllCurrentPipelines()
UpdateAllCurrentPipelines will update all current pipelines.
func (*BelaurPipelineService) UpdateRepository ¶
func (s *BelaurPipelineService) UpdateRepository(pipe *belaur.Pipeline) error
UpdateRepository takes a git type repository and updates it by pulling in new code if it's available.
type BuildPipeline ¶
type BuildPipeline interface { // PrepareEnvironment prepares the environment before we start the // build process. PrepareEnvironment(*belaur.CreatePipeline) error // ExecuteBuild executes the compiler and tracks the status of // the compiling process. ExecuteBuild(*belaur.CreatePipeline) error // CopyBinary copies the result from the compile process // to the plugins folder. CopyBinary(*belaur.CreatePipeline) error // SavePipeline the pipeline in its current format SavePipeline(*belaur.Pipeline) error }
BuildPipeline is the interface for pipelines which are not yet compiled.
type BuildPipelineCpp ¶
type BuildPipelineCpp struct {
Type belaur.PipelineType
}
BuildPipelineCpp is the real implementation of BuildPipeline for C++
func (*BuildPipelineCpp) CopyBinary ¶
func (b *BuildPipelineCpp) CopyBinary(p *belaur.CreatePipeline) error
CopyBinary copies the final compiled binary to the destination folder.
func (*BuildPipelineCpp) ExecuteBuild ¶
func (b *BuildPipelineCpp) ExecuteBuild(p *belaur.CreatePipeline) error
ExecuteBuild executes the c++ build process
func (*BuildPipelineCpp) PrepareEnvironment ¶
func (b *BuildPipelineCpp) PrepareEnvironment(p *belaur.CreatePipeline) error
PrepareEnvironment prepares the environment before we start the build process.
func (*BuildPipelineCpp) SavePipeline ¶
func (b *BuildPipelineCpp) SavePipeline(p *belaur.Pipeline) error
SavePipeline saves the current pipeline configuration.
type BuildPipelineGolang ¶
type BuildPipelineGolang struct {
Type belaur.PipelineType
}
BuildPipelineGolang is the real implementation of BuildPipeline for golang
func (*BuildPipelineGolang) CopyBinary ¶
func (b *BuildPipelineGolang) CopyBinary(p *belaur.CreatePipeline) error
CopyBinary copies the final compiled archive to the destination folder.
func (*BuildPipelineGolang) ExecuteBuild ¶
func (b *BuildPipelineGolang) ExecuteBuild(p *belaur.CreatePipeline) error
ExecuteBuild executes the golang build process
func (*BuildPipelineGolang) PrepareEnvironment ¶
func (b *BuildPipelineGolang) PrepareEnvironment(p *belaur.CreatePipeline) error
PrepareEnvironment prepares the environment before we start the build process.
func (*BuildPipelineGolang) SavePipeline ¶
func (b *BuildPipelineGolang) SavePipeline(p *belaur.Pipeline) error
SavePipeline saves the current pipeline configuration.
type BuildPipelineJava ¶
type BuildPipelineJava struct {
Type belaur.PipelineType
}
BuildPipelineJava is the real implementation of BuildPipeline for java
func (*BuildPipelineJava) CopyBinary ¶
func (b *BuildPipelineJava) CopyBinary(p *belaur.CreatePipeline) error
CopyBinary copies the final compiled archive to the destination folder.
func (*BuildPipelineJava) ExecuteBuild ¶
func (b *BuildPipelineJava) ExecuteBuild(p *belaur.CreatePipeline) error
ExecuteBuild executes the java build process
func (*BuildPipelineJava) PrepareEnvironment ¶
func (b *BuildPipelineJava) PrepareEnvironment(p *belaur.CreatePipeline) error
PrepareEnvironment prepares the environment before we start the build process.
func (*BuildPipelineJava) SavePipeline ¶
func (b *BuildPipelineJava) SavePipeline(p *belaur.Pipeline) error
SavePipeline saves the current pipeline configuration.
type BuildPipelineNodeJS ¶
type BuildPipelineNodeJS struct {
Type belaur.PipelineType
}
BuildPipelineNodeJS is the real implementation of BuildPipeline for NodeJS
func (*BuildPipelineNodeJS) CopyBinary ¶
func (b *BuildPipelineNodeJS) CopyBinary(p *belaur.CreatePipeline) error
CopyBinary copies the final compiled binary to the destination folder.
func (*BuildPipelineNodeJS) ExecuteBuild ¶
func (b *BuildPipelineNodeJS) ExecuteBuild(p *belaur.CreatePipeline) error
ExecuteBuild executes the NodeJS build process
func (*BuildPipelineNodeJS) PrepareEnvironment ¶
func (b *BuildPipelineNodeJS) PrepareEnvironment(p *belaur.CreatePipeline) error
PrepareEnvironment prepares the environment before we start the build process.
func (*BuildPipelineNodeJS) SavePipeline ¶
func (b *BuildPipelineNodeJS) SavePipeline(p *belaur.Pipeline) error
SavePipeline saves the current pipeline configuration.
type BuildPipelinePython ¶
type BuildPipelinePython struct {
Type belaur.PipelineType
}
BuildPipelinePython is the real implementation of BuildPipeline for python
func (*BuildPipelinePython) CopyBinary ¶
func (b *BuildPipelinePython) CopyBinary(p *belaur.CreatePipeline) error
CopyBinary copies the final compiled archive to the destination folder.
func (*BuildPipelinePython) ExecuteBuild ¶
func (b *BuildPipelinePython) ExecuteBuild(p *belaur.CreatePipeline) error
ExecuteBuild executes the python build process
func (*BuildPipelinePython) PrepareEnvironment ¶
func (b *BuildPipelinePython) PrepareEnvironment(p *belaur.CreatePipeline) error
PrepareEnvironment prepares the environment before we start the build process.
func (*BuildPipelinePython) SavePipeline ¶
func (b *BuildPipelinePython) SavePipeline(p *belaur.Pipeline) error
SavePipeline saves the current pipeline configuration.
type BuildPipelineRuby ¶
type BuildPipelineRuby struct { Type belaur.PipelineType GemfileName string }
BuildPipelineRuby is the real implementation of BuildPipeline for Ruby
func (*BuildPipelineRuby) CopyBinary ¶
func (b *BuildPipelineRuby) CopyBinary(p *belaur.CreatePipeline) error
CopyBinary copies the final compiled binary to the destination folder.
func (*BuildPipelineRuby) ExecuteBuild ¶
func (b *BuildPipelineRuby) ExecuteBuild(p *belaur.CreatePipeline) error
ExecuteBuild executes the ruby build process
func (*BuildPipelineRuby) PrepareEnvironment ¶
func (b *BuildPipelineRuby) PrepareEnvironment(p *belaur.CreatePipeline) error
PrepareEnvironment prepares the environment before we start the build process.
func (*BuildPipelineRuby) SavePipeline ¶
func (b *BuildPipelineRuby) SavePipeline(p *belaur.Pipeline) error
SavePipeline saves the current pipeline configuration.
type Dependencies ¶
type Dependencies struct {
Scheduler service.BelaurScheduler
}
Dependencies defines dependencies which this service needs to operate.
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 Bhojpur Belaur from github client to be able to unit test createGithubWebhook and ultimately have the ability to replace github with anything else.