Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: attach name of pipeline step to summary #4396

Merged
merged 5 commits into from Apr 6, 2021
Merged

Conversation

maiamcc
Copy link
Contributor

@maiamcc maiamcc commented Apr 1, 2021

@theothertomelliott asked what the steps a la--

Step 1 - 5s
Step 2 - 1s
Step 3 - 0.1s

in the web UI corresponded to.

these are steps in our update pipeline (e.g. "building dockerfile [gcr.io/xyz]", "Deploying to k8s"), which ARE given names at some point, but you need to scroll back up through the logs to associate the step and its name with the duration given below

this PR attaches the step name to its duration when we print the pipeline summary

I don't feel great about how the way we store pipelineStep and buildStep have diverged, but I figure this is fine for now

cc @hyu for "does this look ugly" consult

@maiamcc maiamcc requested review from hyu and landism April 1, 2021 21:54
@maiamcc
Copy link
Contributor Author

maiamcc commented Apr 1, 2021

Screen Shot 2021-04-01 at 5 46 22 PM

Copy link
Member

@landism landism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this change!

Name: stepName,
Index: ps.curPipelineIndex() + 1,
}
line := logger.Blue(l).Sprintf("STEP %d/%d", ps.curPipelineIndex(), ps.totalPipelineStepCount)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be simpler?

  1. remove the PipelineStep.Index field
  2. remove curPiplineIndex and replacing with len(ps.pipelineSteps) (or with + 1 or whatever)
  3. remove curPiplineStep, and the new step immediately, and use pipelineSteps[len(pipelineSteps)-1] in EndPipelineStep (which I think is the only place this gets used?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yyyup good call

Index: ps.curPipelineIndex() + 1,
}
line := logger.Blue(l).Sprintf("STEP %d/%d", ps.curPipelineIndex(), ps.totalPipelineStepCount)
l.Infof("%s — %s", line, stepName)
ps.curBuildStep = 1
ps.curPipelineStepStart = ps.c.Now()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wanna pull this field into the PipelineStep struct?

@@ -35,7 +46,7 @@ const buildStepOutputPrefix = " "

func NewPipelineState(ctx context.Context, totalStepCount int, c Clock) *PipelineState {
return &PipelineState{
curPipelineStep: 1,
curPipelineStep: PipelineStep{Index: 0},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC it's idiomatic go to omit initializations to 0-values like this (both the Index and the PipelineStep here are such initializations)

(this is irrelevant if you agree with my below comment to delete curPipelineStep)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha whoops yes. it used to be initialized to 1 and then i changed it but heh.

@@ -0,0 +1,3 @@
test("everything is okay", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine

@maiamcc maiamcc merged commit 4a31bbf into master Apr 6, 2021
@maiamcc maiamcc deleted the pipeline-step-names branch April 6, 2021 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants