-
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
feat: New variable iterationNumberParam to track current item. #898
feat: New variable iterationNumberParam to track current item. #898
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 |
@Tomcli please correct me if I am wrong. I think the main purpose of this is to add Edit: |
if tls.IterationNumberParam != "" { | ||
out = append(out, v1beta1.Param{ | ||
Name: tls.IterationNumberParam, | ||
Value: v1beta1.ArrayOrString{Type: v1beta1.ParamTypeString, StringVal: currentIterationItem}, |
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.
this makes iterationNumberParam
is equivalent to iterateParam
. its value should be the iteration
@Udiknedormin @wzhanw quick question, when Feng and Gang implemented the pipelineLoop controller last year, the iteration is counted from 1 to n as counter. However, the python programming enumerate() format is counted from 0 to n-1 as indices. So do you want the new |
Hi, please correct me - IterateParam may be nil, incase of numeric iteration loop. In that case, |
@Tomcli I will check with Feng and Gang. I think we can use the |
@ScrapCodes except using 0 or 1 as the initial index number, we should directly use |
@Tomcli @yhwang @wzhanw @ScrapCodes we need to have 2 independent parameters:
Examples:
Please let me know if any further explanation is needed. This is an important issue with high priority. Could you know ETA for it? BTW, wouldn't name |
name: pipelineloop | ||
spec: | ||
# IterationNumberParam points to the param that stores the current loop item. Similar to IterateNumeric | ||
# for numeric loop range. |
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.
IterationNumberParam
points rather to collection or range index.
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'd add the note that it's index in-order and that it starts from 1.
Indeed! |
spec: | ||
# IterationNumberParam points to the param that stores the current loop item. Similar to IterateNumeric | ||
# for numeric loop range. | ||
iterationNumberParam: current-message |
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.
current-message
is a very misleading name here. It's usage, echo "$(params.message) $(params.current-message)"
, doesn't make it any better.
Maybe message-index
would do better? And echo "$(params.message-index)) $(params.message)"
, so that it's shown as:
1) I am the first one
2) I am the second one
3) I am the third one
@ScrapCodes I have realised after discussion with @Udiknedormin that 1-based numbering is more consistent with PipelineLoop status details. Therefore, I think we can stay with |
Thank you for taking a look @rafalbigaj, @Udiknedormin, @yhwang, @Tomcli and @wzhanw. |
@rafalbigaj
This changes the existing behavior. I guess you are aware of it and want to use the new |
@yhwang to be honest I don't really understand why we have 2 params: In all cases we need access to the iteration item (element) and number (index). |
@rafalbigaj agree with you. but for now, I suggest that we keep If you want to keep |
@yhwang I'm OK with that. Thanks! |
FYI: @wzhanw @Udiknedormin |
e2e test passed for this PR, @yhwang please comment in this PR if you need any spec/behavioral changes for the SDK. |
@Tomcli the current implementation works well with my SDK change. But for this PR and based on Rafal's comment, we need to update the value of |
I personal would recommend to change the |
/lgtm |
Which issue is resolved by this Pull Request:
Resolves #889
Description of your changes:
Added new variable
iterationNumberParam
to track current item.Environment tested:
python --version
):tkn version
):kubectl version
):/etc/os-release
):Checklist: