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-0075] Support Object Results substitution #5083

Merged
merged 1 commit into from
Jul 8, 2022

Conversation

Yongxuanzhang
Copy link
Member

@Yongxuanzhang Yongxuanzhang commented Jul 5, 2022

Changes

This is part of work in TEP-0075.
This commit provides the support to apply object results replacements.
Previous this commit we support emitting object results so users can
write object results to task level, but we cannot pass object results from
one task to another within one pipeline. This commit adds the support for this.

Note that this commit does not support object and array results for Matrix

/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 object results substitution as an alpha feature.

A task can specify a type to produce array result, such as:
results:
  - name: object-results
     type: object
     description: The object results
     properties:
        foo: {
          type: string
        }
        hello: {
          type: string
        }

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

echo -n "{\"foo\":\"bar\",\"hello\":\"world\"}" | tee $(results.object-results.path)

and we can refer to the object results in param like:
  params:
    - name: whole-object
      value: "$(tasks.task1.results.object-results[*])"
    - name: object-element
      value: "$(tasks.task1.results.object-results.hello)"

This feature is part of the TEP-0075. 

@tekton-robot
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@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. kind/feature Categorizes issue or PR as related to a new feature. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jul 5, 2022
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jul 5, 2022
@Yongxuanzhang Yongxuanzhang marked this pull request as ready for review July 5, 2022 23:46
@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 Jul 5, 2022
@tekton-robot tekton-robot requested review from abayer and pritidesai July 5, 2022 23:46
@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 99.2% 99.2% 0.0
pkg/reconciler/pipelinerun/resources/resultrefresolution.go 94.6% 95.1% 0.5
pkg/reconciler/taskrun/validate_resources.go 96.1% 95.5% -0.6

@Yongxuanzhang
Copy link
Member Author

/assign @ywluogg

@ywluogg
Copy link
Contributor

ywluogg commented Jul 6, 2022

#4723

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 7, 2022
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 7, 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 99.2% 99.2% 0.0
pkg/reconciler/pipelinerun/resources/resultrefresolution.go 94.9% 96.3% 1.4

pipelineTask.Params = replaceParamValues(pipelineTask.Params, stringReplacements, arrayReplacements, nil)
pipelineTask.Matrix = replaceParamValues(pipelineTask.Matrix, stringReplacements, arrayReplacements, nil)
pipelineTask.Params = replaceParamValues(pipelineTask.Params, stringReplacements, arrayReplacements, objectReplacements)
pipelineTask.Matrix = replaceParamValues(pipelineTask.Matrix, stringReplacements, arrayReplacements, objectReplacements)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we don't want matrix to support nested values right now. This would essentially mean matrix can be [[array, object], [etc.]], is it?

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 thanks! I will remove it from Matrix, and I also don't add tests for Matrix, better leave it,

Copy link
Member Author

Choose a reason for hiding this comment

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

done!

@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 99.2% 99.2% 0.0
pkg/reconciler/pipelinerun/resources/resultrefresolution.go 94.9% 95.4% 0.5

@ywluogg
Copy link
Contributor

ywluogg commented Jul 7, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 7, 2022
@Yongxuanzhang
Copy link
Member Author

/retest

for _, resolvedPipelineRunTask := range targets {
if resolvedPipelineRunTask.PipelineTask != nil {
pipelineTask := resolvedPipelineRunTask.PipelineTask.DeepCopy()
pipelineTask.Params = replaceParamValues(pipelineTask.Params, stringReplacements, arrayReplacements, nil)
pipelineTask.Matrix = replaceParamValues(pipelineTask.Matrix, stringReplacements, arrayReplacements, nil)
Copy link
Member

Choose a reason for hiding this comment

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

why are we removing this?

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 discussed with @ywluogg in the thread above (unresolved it now), she suggests we don't support array and object for Matrix now. The array is added in previous PR by mistake. It is out of scope of TEP 75

Copy link
Member

Choose a reason for hiding this comment

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

got it, thanks!

This is part of work in TEP-0075.
This commit provides the support to apply object results replacements.
Previous this commit we support emitting object results so users can
write object results to task level, but we cannot pass object results from
one task to another within one pipeline. This commit adds the support for this.
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 7, 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 99.2% 99.2% 0.0
pkg/reconciler/pipelinerun/resources/resultrefresolution.go 94.9% 96.3% 1.4

@ywluogg
Copy link
Contributor

ywluogg commented Jul 7, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 7, 2022
@dibyom
Copy link
Member

dibyom commented Jul 7, 2022

/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

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 tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 7, 2022
@Yongxuanzhang
Copy link
Member Author

/retest

1 similar comment
@Yongxuanzhang
Copy link
Member Author

/retest

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