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

Add slim-sprig template functions to bootstrap/generate #775

Merged

Conversation

hagaibarel
Copy link
Contributor

Fixes #774

@onsi
Copy link
Owner

onsi commented Mar 7, 2021

thanks @hagaibarel - this makes sense and looks simple enough. my only hesitation is that Sprig is pulling in a lot of additional dependencies. is there a similar library that is a little more lightweight? as you consider your usecase are you needing all of Sprig or simply a subset?

to say a bit more - i know ginkgo is in use in a number of production systems and pipelines where security is a major concern. growing ginkgo's dependency graph adds that much more to the security burden across those systems.

@hagaibarel
Copy link
Contributor Author

I can understand and respect that, dependency chains can be an issue.

I'm not familiar with other go template libraries as mature and stable as sprig, most other template functionalities are full blown template engines (see https://github.com/avelino/awesome-go#template-engines for some examples) which I think is an overkill here and doesn't solve the deps problem. There's gtf which has a very small footprint but doesn't seem maintained. Maybe slim-sprig might work?

@hagaibarel
Copy link
Contributor Author

@onsi any thoughts on this?

@blgm
Copy link
Collaborator

blgm commented Mar 16, 2021

I can't speak for @onsi, but I was wondering how hard it would be to make this a plugin? It could solve the dependency issue by making it optional, and it could allow folks to use alternative templating languages in the future without having to make a code change. Perhaps an optional flag for the ginkgo bootstrap command and a sprig command, like:

ginkgo bootstrap --templater /usr/bin/sprig

This idea might be completely impractical in this case (I don't see a sprig command), but I have seen approaches like this allow programs to be decoupled.

@onsi
Copy link
Owner

onsi commented Mar 16, 2021

thanks for the bump @hagaibarel - I agree, @blgm a more decoupled approach would be ideal. If that isn't feasible, slim-sprig definitely looks better from a dependencies POV and I'm ok pulling it in.

@hagaibarel hagaibarel changed the title Add sprig template functions to bootstrap/generate Add slim-sprig template functions to bootstrap/generate Mar 16, 2021
@hagaibarel
Copy link
Contributor Author

I think the idea of plugins is interesting and there are other parts of ginkgo that might benefit from such an approach (e.g. reporters). I don't think it's possible with how ginkgo is today, and I'm not sure how to approach such a design but I'm not familiar with the code base to that degree so if you have some ideas around it we can mull them over. I also think it's out of scope for this PR 😃

Anyways @onsi I've switched to slim-sprig, let me know if there's anything else needed

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 this pull request may close these issues.

Feature Request: Add functions for test templates
3 participants