Beispiel #1
0
// StartBuild emits a BuildStarted and returns for a Finisher for the end.
func (p *Runner) StartBuild(options *core.PipelineOptions) *util.Finisher {
	p.emitter.Emit(core.BuildStarted, &core.BuildStartedArgs{Options: options})
	return util.NewFinisher(func(result interface{}) {
		r, ok := result.(*core.BuildFinishedArgs)
		if !ok {
			return
		}
		r.Options = options
		p.emitter.Emit(core.BuildFinished, r)
	})
}
Beispiel #2
0
// StartFullPipeline emits a FullPipelineFinished when the Finisher is called.
func (p *Runner) StartFullPipeline(options *core.PipelineOptions) *util.Finisher {
	return util.NewFinisher(func(result interface{}) {
		r, ok := result.(*core.FullPipelineFinishedArgs)
		if !ok {
			return
		}

		r.Options = options
		p.emitter.Emit(core.FullPipelineFinished, r)
	})
}
Beispiel #3
0
// StartStep emits BuildStepStarted and returns a Finisher for the end event.
func (p *Runner) StartStep(ctx *RunnerShared, step core.Step, order int) *util.Finisher {
	p.emitter.Emit(core.BuildStepStarted, &core.BuildStepStartedArgs{
		Box:   ctx.box,
		Step:  step,
		Order: order,
	})
	return util.NewFinisher(func(result interface{}) {
		r := result.(*StepResult)
		artifactURL := ""
		if r.Artifact != nil {
			artifactURL = r.Artifact.URL()
		}
		p.emitter.Emit(core.BuildStepFinished, &core.BuildStepFinishedArgs{
			Box:                 ctx.box,
			Successful:          r.Success,
			Message:             r.Message,
			ArtifactURL:         artifactURL,
			PackageURL:          r.PackageURL,
			WerckerYamlContents: r.WerckerYamlContents,
		})
	})
}