-
Notifications
You must be signed in to change notification settings - Fork 123
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
Loop ranges should handle from = to, and generate one iteration. #941
Loop ranges should handle from = to, and generate one iteration. #941
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ScrapCodes 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 |
@@ -892,6 +892,11 @@ func computeIterations(run *v1alpha1.Run, tls *pipelineloopv1alpha1.PipelineLoop | |||
} | |||
} | |||
} | |||
if from == to && to == 0 && step != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the use case is when from == to, then the iteration is equals to 1. to
doesn't have to be 0.
Another edge case could be that to
- from
< step
if step
> 0 and to
- from
> step
if step
< 0, then the iteration is also 1.
tekton-catalog/pipeline-loops/pkg/reconciler/pipelinelooprun/pipelinelooprun_test.go
Outdated
Show resolved
Hide resolved
thanks @ScrapCodes , overall it looks good to me. just one small question for the unit test above. |
thanks @ScrapCodes |
…eflow#941) * Loop ranges should handle start = 0 and end = 0, should generate one iteration. * When from = to, then generate one iteration. emulating how enumerate works. * Fixed edge cases. * if from and to are unset, we should not pick defaults either.
Which issue is resolved by this Pull Request:
Resolves #935
Description of your changes:
Where start = 0 and end = 0, generate one iteration.
Environment tested:
python --version
):tkn version
):kubectl version
):/etc/os-release
):Checklist: