Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Trim StepStates for implicit steps #340

Merged
merged 4 commits into from Sep 14, 2018

Conversation

imjasonh
Copy link
Member

@imjasonh imjasonh commented Sep 7, 2018

Fixes #338

Proposed Changes

  • If a build specifies no source, skip only the first StepState
  • If the build specifies source, skip the first two StepStates
  • Add tests, and move diffmatchpatch helper to pkg/buildtest

Release Note

.Status.StepStates omits states for implicit steps, so the number of StepStates == number of user-specified build steps

/assign @shashwathi

@knative-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ImJasonH

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

// is the source-fetching container.
skip++
}
if skip > len(op.statuses) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like there is no test coverage for this condition skip> len(op.statuses).

@mattmoor
Copy link
Member

mattmoor commented Sep 8, 2018

I wonder if we are losing potentially valuable signal when credential initialization fails? Creds has proven to be a source of friction with the Build CRD, and so I just want to make sure we're not making things worse.

@imjasonh
Copy link
Member Author

I wonder if we are losing potentially valuable signal when credential initialization fails? Creds has proven to be a source of friction with the Build CRD, and so I just want to make sure we're not making things worse.

That's a reasonable concern. I think the solution there is to put some more work into surfacing creds-init and source-fetching statuses into the build status itself, probably via termination messages.

These implicit steps should be a transparent implementation detail to the user, and they shouldn't need to know how many implicit steps we add at the beginning (and possibly end) of their specified steps, to be able to tell which of their steps may have failed.

@shashwathi
Copy link
Contributor

That's a reasonable concern. I think the solution there is to put some more work into surfacing creds-init and source-fetching statuses into the build status itself, probably via termination messages.

I like this idea. We can loop through the Init containers and only surface the errors if there are any. Ignore implicit steps if they are not providing value to the user.

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

/lgtm
/hold

At least one nit, and unsure if you saw the other comments on here.

pkg/buildtest/diff.go Show resolved Hide resolved
@knative-metrics-robot
Copy link

The following is the coverage report on pkg/.
Say /test pull-knative-build-go-coverage to run the coverage report again

File Old Coverage New Coverage Delta
pkg/builder/cluster/builder.go 78.4% 81.9% 3.5

Copy link
Member Author

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

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

Re: surfacing creds-init and other implicit step failures, we should write those failure messages to statuses and hoist them out into the build's status, rather than having them slip into step states.

I'll work on that in a future PR.

@mattmoor
Copy link
Member

/lgtm
/hold cancel

@knative-prow-robot knative-prow-robot merged commit 3ea11c3 into knative:master Sep 14, 2018
vdemeester pushed a commit to vdemeester/knative-build that referenced this pull request Apr 3, 2019
* checkpoint

* Fixed failures, works now

* Add test, move diff to buildtest

* Update diff.go
vdemeester pushed a commit to vdemeester/knative-build that referenced this pull request Apr 3, 2019
* checkpoint

* Fixed failures, works now

* Add test, move diff to buildtest

* Update diff.go
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants