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

Fix field names in generated json statement #1129

Conversation

renzodavid9
Copy link
Contributor

@renzodavid9 renzodavid9 commented Jun 3, 2024

Fixes: #1128

To keep backwards compatibility with previous struct versions (e.g, github.com/in-toto/in-toto-golang/in_toto) we have to use protojson.Marshal function to transform the struct to its json representation so the tags defined in the intoto.Statement are follow and applied to the resulting string.

Changes

When getting the payload object we check if it is an instance of proto.Message to use the proper Marshall function.

Submitter Checklist

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

  • Has Docs included if any changes are user facing
  • Has 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 updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

@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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 3, 2024
@tekton-robot
Copy link

Hi @renzodavid9. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@chitrangpatel
Copy link
Contributor

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 3, 2024
@renzodavid9 renzodavid9 marked this pull request as ready for review June 3, 2024 16:45
@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 3, 2024
@tekton-robot tekton-robot requested a review from wlynch June 3, 2024 16:45
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/signing.go 74.3% 74.3% 0.1

@chitrangpatel
Copy link
Contributor

/cherry-pick release-v0.21.x

@renzodavid9 renzodavid9 force-pushed the issue-1128-intoto-statement-field-names branch from 9aab673 to fa565c1 Compare June 3, 2024 22:13
@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 Jun 3, 2024
@renzodavid9 renzodavid9 force-pushed the issue-1128-intoto-statement-field-names branch from fa565c1 to b3e06ba Compare June 3, 2024 22:16
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/signing.go 74.3% 75.7% 1.4

@renzodavid9 renzodavid9 force-pushed the issue-1128-intoto-statement-field-names branch from b3e06ba to 32dbc30 Compare June 3, 2024 22:38
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/signing.go 74.3% 75.7% 1.4

To keep backwards compatibility with previous struct versions (e.g, github.com/in-toto/in-toto-golang/in_toto) we have to use protojson.Marshal function to transform the struct to its json representation so the tags defined in the intoto.Statement are follow and applied to the resulting string.
@renzodavid9 renzodavid9 force-pushed the issue-1128-intoto-statement-field-names branch from 32dbc30 to 9f18493 Compare June 3, 2024 23:08
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/chains/signing.go 74.3% 75.7% 1.4

@chitrangpatel
Copy link
Contributor

/approve

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 4, 2024
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chitrangpatel

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

@chitrangpatel
Copy link
Contributor

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 5, 2024
@tekton-robot tekton-robot merged commit 3bf8cac into tektoncd:main Jun 5, 2024
17 checks passed
@chitrangpatel
Copy link
Contributor

/kind bug

@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 8, 2024
chitrangpatel pushed a commit to chitrangpatel/chains that referenced this pull request Jun 8, 2024
To keep backwards compatibility with previous struct versions (e.g, github.com/in-toto/in-toto-golang/in_toto) we have to use protojson.Marshal function to transform the struct to its json representation so the tags defined in the intoto.Statement are follow and applied to the resulting string.

(cherry picked from commit 3bf8cac)
renzodavid9 added a commit to renzodavid9/chains that referenced this pull request Jun 9, 2024
To keep backwards compatibility with previous struct versions (e.g, github.com/in-toto/in-toto-golang/in_toto) we have to use protojson.Marshal function to transform the struct to its json representation so the tags defined in the intoto.Statement are follow and applied to the resulting string.

(cherry picked from commit 3bf8cac)
@renzodavid9 renzodavid9 mentioned this pull request Jun 9, 2024
6 tasks
tekton-robot pushed a commit that referenced this pull request Jun 10, 2024
* Fix field names in generated json statement (#1129)

To keep backwards compatibility with previous struct versions (e.g, github.com/in-toto/in-toto-golang/in_toto) we have to use protojson.Marshal function to transform the struct to its json representation so the tags defined in the intoto.Statement are follow and applied to the resulting string.

(cherry picked from commit 3bf8cac)

* Fix no repeated subjects for v2alpha4 pipelineruns (#1130)

Change the pipelinerun v2alpha4 method that calculates the subjects to use `artifact.AppendSubjects` instead of `append` to avoid duplicated subjects.

(cherry picked from commit badc734)

* Calculate subjects per formatter (#1132)

* Calculate subjects per formatter

* Tests for new retrieve full uris in grafeas

(cherry picked from commit 750a98e)
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/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

in-toto Statement not compatible with previous versions
3 participants