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

Sprig Functions don't work on dataKey or contextKey #588

Closed
ericmeadows opened this issue Apr 11, 2020 · 5 comments · Fixed by #589
Closed

Sprig Functions don't work on dataKey or contextKey #588

ericmeadows opened this issue Apr 11, 2020 · 5 comments · Fixed by #589

Comments

@ericmeadows
Copy link

ericmeadows commented Apr 11, 2020

Is your feature request related to a problem? Please describe.
Input Type: GitHub webhook
Content-type: application/json

I am trying to extract substrings from inputs to make searching via labels easier; for example I am trying to get the branch name, standardize it, and use it as a metadata label. The same can be said for extracting the Git Commit short hash.

Describe the solution you'd like
dataKey can use Spring functions.
e.g.

          parameters:
            - src:
                dependencyName: test-dep
                dataKey: body.head_commit.id | substr 0 7
              dest: metadata.labels.commit-id

Describe alternatives you've considered
There aren't any other options.

Additional context
Add any other context or screenshots about the feature request here.

@ericmeadows
Copy link
Author

For example:

          parameters:
            - src:
                dependencyName: test-dep
                dataTemplate: "{{ body.head_commit.id | substr 0 7 }}"
              dest: metadata.labels.commit-id

Does not work, nor removing the leading and trailing spaces from the Sprig template.

@ericmeadows
Copy link
Author

This also fails with:

dataTemplate: "{{ .Input.body.head_commit.id | substr 0 7 }}"

@VaibhavPage VaibhavPage linked a pull request Apr 12, 2020 that will close this issue
@VaibhavPage
Copy link
Contributor

Sprig templates are now available in v0.14.0

@VaibhavPage
Copy link
Contributor

@VaibhavPage
Copy link
Contributor

Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants