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

Generate steps name when none has been provided #611

Conversation

chmouel
Copy link
Member

@chmouel chmouel commented Jan 15, 2020

Let's generate the step name if the user has not provided one, like what is done
pipeline (which would shows up in tr)

Before:

image

After:

image

Closes #[593]

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Regenerate the manpages and docs with make docs and make man if needed.
  • Run the code checkers with make check
  • Commit messages follow commit message best practices

See the contribution guide
for more details.

Release Notes

release-note

@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 15, 2020
@chmouel chmouel force-pushed the issue-593-tkn-assumes-steps-that-has-name branch from 0a58595 to 86a614b Compare January 15, 2020 19:04
@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/formatted/k8s.go 6.2% 5.0% -1.2

@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/formatted/k8s.go 6.2% 5.0% -1.2

@chmouel chmouel force-pushed the issue-593-tkn-assumes-steps-that-has-name branch from 86a614b to 9fef44b Compare January 15, 2020 19:24
@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/formatted/k8s.go 6.2% 5.0% -1.2

pkg/formatted/k8s.go Outdated Show resolved Hide resolved
pkg/formatted/k8s.go Outdated Show resolved Hide resolved
pkg/cmd/task/describe.go Outdated Show resolved Hide resolved
pkg/cmd/task/describe.go Outdated Show resolved Hide resolved
Copy link
Member

@sthaha sthaha left a comment

Choose a reason for hiding this comment

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

lgtm
it may be better to start counting from 1 instead of 0

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

As far as I remember, the index in the name of the step is the index of it in the array and it starts at 0 because of go 👼 (so an unamed step at the 3rd step, would be named step-unamed-2)

@chmouel chmouel changed the title generate steps name when none has been provided Generate steps name when none has been provided Jan 16, 2020
@chmouel chmouel force-pushed the issue-593-tkn-assumes-steps-that-has-name branch from 9fef44b to 7170505 Compare January 16, 2020 10:07
@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/formatted/k8s.go 6.2% 4.8% -1.5

@chmouel chmouel force-pushed the issue-593-tkn-assumes-steps-that-has-name branch from 7170505 to 1e35846 Compare January 16, 2020 10:21
// AutoStepName when our stepName is empty return a genrated name as generated
// on pipeLine
func AutoStepName(stepName string) string {
if stepName != "" {
Copy link
Member Author

Choose a reason for hiding this comment

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

I do this because I could not find a way to do this nicely in builtin gotemplate....

Copy link
Member

Choose a reason for hiding this comment

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

Just making sure .. so we want to print something like ..

- A named step
- unnamed-2
- another-named-step
- unnamed-4
  • right?

Copy link
Member

Choose a reason for hiding this comment

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

Just saw that the test confirms it and it makes sense!

@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/formatted/k8s.go 6.2% 4.8% -1.5

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 16, 2020
Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

/hold
We should have a test with an unamed step in the middle of two named step 👼

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 16, 2020
@chmouel chmouel force-pushed the issue-593-tkn-assumes-steps-that-has-name branch from 1e35846 to 51ff027 Compare January 16, 2020 20:13
@chmouel
Copy link
Member Author

chmouel commented Jan 16, 2020

Sure! done...

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 16, 2020
@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/formatted/k8s.go 6.2% 4.8% -1.5

@chmouel chmouel force-pushed the issue-593-tkn-assumes-steps-that-has-name branch from 51ff027 to f56567e Compare January 16, 2020 20:33
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 16, 2020
@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/formatted/k8s.go 6.2% 28.6% 22.3

pkg/cmd/task/describe_test.go Outdated Show resolved Hide resolved
pkg/cmd/task/describe_test.go Outdated Show resolved Hide resolved
@chmouel chmouel force-pushed the issue-593-tkn-assumes-steps-that-has-name branch 2 times, most recently from 676d2ae to 95a01e3 Compare January 17, 2020 09:16
@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/formatted/k8s.go 6.2% 31.8% 25.6

@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/formatted/k8s.go 6.2% 31.8% 25.6

@chmouel chmouel force-pushed the issue-593-tkn-assumes-steps-that-has-name branch from 95a01e3 to 4f2da22 Compare January 17, 2020 09:58
@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 17, 2020
@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/formatted/k8s.go 6.2% 31.8% 25.6

return stepName
}
unnamedStep := fmt.Sprintf("unnamed-%d", stepCounter)
atomic.AddUint64(&stepCounter, 1)
Copy link
Member

Choose a reason for hiding this comment

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

nit:

unnamedStep := fmt.Sprintf("unnamed-%d", stepCounter)
atomic.AddUint64(&stepCounter, 1)
if stepName != "" {
	return stepName
}
return unnamedStep

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danielhelfand, vdemeester

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:
  • OWNERS [danielhelfand,vdemeester]

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

@chmouel chmouel force-pushed the issue-593-tkn-assumes-steps-that-has-name branch from 4f2da22 to eb2805f Compare January 19, 2020 21:32
@tekton-robot
Copy link
Contributor

The following is the coverage report on pkg/.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/formatted/k8s.go 6.2% 28.6% 22.3

Copy link
Member

@sthaha sthaha left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 20, 2020
@tekton-robot tekton-robot merged commit e432960 into tektoncd:master Jan 20, 2020
@chmouel chmouel deleted the issue-593-tkn-assumes-steps-that-has-name branch January 20, 2020 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants