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

[TEP-0076]Pipeline results support array #4965

Merged
merged 1 commit into from
Jul 4, 2022

Conversation

Yongxuanzhang
Copy link
Member

@Yongxuanzhang Yongxuanzhang commented Jun 10, 2022

Changes

This is part of work in TEP-0076.
This commit update the PipelineResult and PipelineRunResult to uspport
array results, meanwhile support the whole array and array indexing
reference from PipelineResult to TaskResult. Before this commit the
pipeline level result only support string.

/kind feature

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Docs included if any changes are user facing
  • Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Release notes block below has been filled in
    (if there are no user facing changes, use release note "NONE")

Release Notes

Support array results and indexing array for pipeline level as an alpha feature.

A pipeline can specify a type to create array result, such as:

    results:
      - name: echo-indexing-array-results
        type: string
        description: array element
        value: $(tasks.task1.results.array-results[1])
      - name: echo-array-results
        type: array
        description: whole array
        value: $(tasks.task2.results.array-results[*])

And the task script can populate result in an array form with:

echo -n "[\"hello\",\"world\"]" | tee $(results.array-results.path)

The pipeline results can refer to task results to collect them.
This feature is part of the TEP-0076. 

@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 10, 2022
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 100.0% 99.2% -0.8

@Yongxuanzhang Yongxuanzhang force-pushed the pipeline-array-results branch 2 times, most recently from 9f49461 to 892c284 Compare June 10, 2022 15:36
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 100.0% 99.2% -0.8

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 100.0% 99.2% -0.8

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 100.0% 99.2% -0.8

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 100.0% 99.2% -0.8

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 100.0% 99.2% -0.8

@Yongxuanzhang
Copy link
Member Author

/test pull-tekton-pipeline-go-coverage

@Yongxuanzhang Yongxuanzhang marked this pull request as ready for review June 10, 2022 19:59
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 10, 2022
@Yongxuanzhang
Copy link
Member Author

/retest

1 similar comment
@Yongxuanzhang
Copy link
Member Author

/retest

@ywluogg
Copy link
Contributor

ywluogg commented Jun 13, 2022

/assign @ywluogg

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 14, 2022
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 14, 2022
Copy link
Contributor

@ywluogg ywluogg left a comment

Choose a reason for hiding this comment

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

NIce job! Everything looks good except some typos

pkg/apis/pipeline/v1beta1/pipeline_types.go Outdated Show resolved Hide resolved
pkg/reconciler/pipelinerun/resources/apply.go Outdated Show resolved Hide resolved
pkg/reconciler/pipelinerun/resources/apply.go Outdated Show resolved Hide resolved
pkg/apis/pipeline/v1beta1/pipeline_types.go Show resolved Hide resolved
pkg/apis/pipeline/v1beta1/pipeline_types.go Show resolved Hide resolved
var arrayIndexingRegex = regexp.MustCompile(arrayIndexing)

// ArrayIndexingRegex is used to match `[int]` and `[*]`
var ArrayIndexingRegex = regexp.MustCompile(arrayIndexing)
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if we need to export this regex or if there is a parsing function it would make more sense to export

Copy link
Member Author

Choose a reason for hiding this comment

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

oh that's a good point! Let me check if I can have a separate function for this

Copy link
Member

Choose a reason for hiding this comment

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

could you please avoid exporting the regexes here?

Copy link
Member Author

Choose a reason for hiding this comment

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

it is not exported now

pkg/reconciler/pipelinerun/resources/apply.go Outdated Show resolved Hide resolved
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/apply.go 100.0% 99.2% -0.8

@ywluogg
Copy link
Contributor

ywluogg commented Jun 30, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 30, 2022
@ywluogg
Copy link
Contributor

ywluogg commented Jun 30, 2022

#4723

@Yongxuanzhang
Copy link
Member Author

/retest

intIdx, _ := strconv.Atoi(stringIdx)
stringReplacements[variable] = resultValue.ArrayVal[intIdx]
} else {
variable = strings.TrimSuffix(strings.TrimSuffix(strings.TrimPrefix(variable, "$("), ")"), "[*]")
Copy link
Member

Choose a reason for hiding this comment

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

can this be moved into a helper function somewhere? it would be good to have all our string parsing logic in one place.

Copy link
Member Author

Choose a reason for hiding this comment

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

sure!

pkg/apis/pipeline/v1beta1/resultref.go Outdated Show resolved Hide resolved
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jun 30, 2022
@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 30, 2022
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/param_types.go 97.9% 97.9% 0.0
pkg/reconciler/pipelinerun/resources/apply.go 100.0% 99.2% -0.8

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 30, 2022
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 4, 2022
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lbernick, ywluogg

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

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/param_types.go 97.9% 97.9% 0.0
pkg/reconciler/pipelinerun/resources/apply.go 100.0% 99.2% -0.8

@ywluogg
Copy link
Contributor

ywluogg commented Jul 4, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 4, 2022
This is part of work in TEP-0076.
This commit update the PipelineResult and PipelineRunResult to uspport
array results, meanwhile support the whole array and array indexing
reference from PipelineResult to TaskResult. Before this commit the
pipeline level result only support string.
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 4, 2022
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1beta1/param_types.go 97.9% 97.9% 0.0
pkg/reconciler/pipelinerun/resources/apply.go 100.0% 99.2% -0.8

@Yongxuanzhang
Copy link
Member Author

/retest

@ywluogg
Copy link
Contributor

ywluogg commented Jul 4, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 4, 2022
@tekton-robot tekton-robot merged commit 0d1d87a into tektoncd:main Jul 4, 2022
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. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants