Make pipeline runtime log with description (#970)

* introduce runtime descriptors to pipeline runtime

* nit return orig error at traceStep()

* more logging

* refactor

Co-authored-by: Zav Shotan <zshotan@bloomberg.net>
This commit is contained in:
6543
2022-06-15 18:11:20 +02:00
committed by GitHub
parent 9f7b72f9a9
commit 068063655b
4 changed files with 83 additions and 12 deletions

View File

@@ -81,17 +81,20 @@ func (r *Runner) Run(ctx context.Context) error {
timeout = time.Duration(minutes) * time.Minute
}
repoName := extractRepositoryName(work.Config) // hack
buildNumber := extractBuildNumber(work.Config) // hack
r.counter.Add(
work.ID,
timeout,
extractRepositoryName(work.Config), // hack
extractBuildNumber(work.Config), // hack
repoName,
buildNumber,
)
defer r.counter.Done(work.ID)
logger := log.With().
Str("repo", extractRepositoryName(work.Config)). // hack
Str("build", extractBuildNumber(work.Config)). // hack
Str("repo", repoName).
Str("build", buildNumber).
Str("id", work.ID).
Logger()
@@ -308,6 +311,11 @@ func (r *Runner) Run(ctx context.Context) error {
pipeline.WithLogger(defaultLogger),
pipeline.WithTracer(defaultTracer),
pipeline.WithEngine(*r.engine),
pipeline.WithDescription(map[string]string{
"ID": work.ID,
"Repo": repoName,
"Build": buildNumber,
}),
).Run()
state.Finished = time.Now().Unix()