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

Ensure that decodeB64 returns a String rather than Bytes. #609

Merged
merged 1 commit into from
Jun 15, 2020

Conversation

bigkevmcd
Copy link
Member

Changes

This changes the return value of the decodeB64 overload to ensure that it returns a string.

Fixes #608

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

Changes the output of decodeB64 to return a string, rather than bytes.

@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 15, 2020
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/interceptors/cel/cel.go 91.4% 87.9% -3.4

This changes the return value of the decodeB64 overload to ensure that it returns a string.
@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 15, 2020
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/interceptors/cel/cel.go 91.4% 87.9% -3.4

@dibyom
Copy link
Member

dibyom commented Jun 15, 2020

/kind bug
/approve

@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 15, 2020
@tekton-robot
Copy link

[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 Jun 15, 2020
@dibyom
Copy link
Member

dibyom commented Jun 15, 2020

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 15, 2020
@tekton-robot tekton-robot merged commit b4e8a09 into tektoncd:master Jun 15, 2020
@bigkevmcd
Copy link
Member Author

I should probably have explained why it was originally types.Bytes and not types.String, as it probably looks like a stupid bug :-)

When it's a string, it gets quoted when it's being inserted as an overlay value, what that means, is that previously, if you were decoding a base64 encoded JSON blob, the value that was inserted as, was a string, and not an object, so you couldn't use the fields.

Essentially, if you had something like {"value": "test"} encoded as base64, and you decoded it into an overlay as a types.String it would have looked like "overlay": "{\"value\": \"test\"}"} and then, if you tried to get body.overlay.value in a binding, you couldn't.

But, with the addition of parseJSON, this isn't so much of a problem, as you can decode the base64 and then parse the JSON.

body.value.decodeb64().parseJSON()

@bigkevmcd bigkevmcd deleted the decodeb64-to-string branch July 1, 2020 19:18
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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v0.5.0: CEL decodeb64: unexpected type 'bytes'
3 participants