Exemple #1
0
// ListenTo will add eventhandlers to e.
func (h *MetricsEventHandler) ListenTo(e *core.NormalizedEmitter) {
	e.AddListener(core.BuildStepStarted, h.BuildStepStarted)
	e.AddListener(core.BuildStepFinished, h.BuildStepFinished)
	e.AddListener(core.BuildStepsAdded, h.BuildStepsAdded)

	e.AddListener(core.BuildStarted, h.BuildStarted)
	e.AddListener(core.BuildFinished, h.BuildFinished)
}
Exemple #2
0
// ListenTo will add eventhandlers to e.
func (h *ReportHandler) ListenTo(e *core.NormalizedEmitter) {
	e.AddListener(core.BuildFinished, h.PipelineFinished)
	e.AddListener(core.BuildStepFinished, h.StepFinished)
	e.AddListener(core.BuildStepsAdded, h.StepsAdded)
	e.AddListener(core.BuildStepStarted, h.StepStarted)
	e.AddListener(core.FullPipelineFinished, h.FullPipelineFinished)
	e.AddListener(core.Logs, h.Logs)
}
Exemple #3
0
// EmitStatus emits the json message on r
func EmitStatus(e *core.NormalizedEmitter, r io.Reader, options *core.PipelineOptions) {
	s := NewJSONMessageProcessor()
	dec := json.NewDecoder(r)
	for {
		var m jsonmessage.JSONMessage
		if err := dec.Decode(&m); err == io.EOF {
			// Once the EOF is reached the function will stop
			break
		} else if err != nil {
			util.RootLogger().Panic(err)
		}

		line := s.ProcessJSONMessage(&m)
		e.Emit(core.Logs, &core.LogsArgs{
			Logs:   line,
			Stream: "docker",
		})
	}
}
Exemple #4
0
// ListenTo will add eventhandlers to e.
func (h *LiteralLogHandler) ListenTo(e *core.NormalizedEmitter) {
	e.AddListener(core.Logs, h.Logs)
}