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

Escaping Quotes in TriggerBinding values #257

Closed
dibyom opened this issue Dec 9, 2019 · 3 comments
Closed

Escaping Quotes in TriggerBinding values #257

dibyom opened this issue Dec 9, 2019 · 3 comments
Labels
kind/question Issues or PRs that are questions around the project or a particular feature lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@dibyom
Copy link
Member

dibyom commented Dec 9, 2019

What?

Today, if the Binding expression is a JSON string, we escape the double-quotes i.e. if the output is {"a": "b"}, we use {\"a\":\"b\"}.

Why do we do this?

From @ncskier :
I think it's because we're passing that JSON object as a type String in the ResourceTemplate JSON: https://github.com/tektoncd/triggers/blob/master/pkg/sink/sink.go#L195. So, we have to escape those quotes, otherwise they'll result in a JSON syntax error (however, there might be a better way to do this sweat_smile)

From: #241 (comment)

Ideas:

  1. Keep doing this and document this as a behavior

  2. Decide what to do depending on where the binding is being used i.e. if it is being appended to a string, escape it otherwise not i.e.

"foobar-$(body)" - escape
$(body) - don't escape
  1. Use something fancier like JSON patch instead of string concat. For extra points, provide different merge strategies!
@dibyom dibyom added the kind/question Issues or PRs that are questions around the project or a particular feature label Dec 9, 2019
@tekton-robot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.

/lifecycle rotten

Send feedback to tektoncd/plumbing.

@tekton-robot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

/close

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Aug 15, 2020
@tekton-robot
Copy link

@tekton-robot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

/close

Send feedback to tektoncd/plumbing.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Issues or PRs that are questions around the project or a particular feature lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

2 participants