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

[Ingest Manager] Add contains handlebar helper for conditional blocks in yaml #72698

Merged
merged 6 commits into from
Jul 23, 2020

Conversation

andrewstucki
Copy link
Contributor

Summary

So, beats have some use cases in current filebeat modules that change configuration depending on certain tags being included. For example:

https://github.com/elastic/beats/blob/bca0adcd4353d2a547e73cb9523a456971d9dc27/x-pack/filebeat/module/crowdstrike/falcon/config/falcon.yml#L16

This handlebars helper would basically allow us to have the same sort of conditional block inclusion based off of whether certain things were members of an array, i.e. it's the handlebars equivalent of the inList go template helper.

Checklist

@andrewstucki andrewstucki requested review from ruflin, nchaulet, andrewkroh and a team July 21, 2020 17:23
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Jul 21, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small comment otherwise 👍
Do we need this in 7.9?

Co-authored-by: Nicolas Chaulet <n.chaulet@gmail.com>
@andrewstucki
Copy link
Contributor Author

@nchaulet I'm assuming it would probably make the ingest package conversion a bit easier if this was in sooner than later, but I'm assuming if this was in master we could pick it up for developing packages via nightly snapshot builds? @andrewkroh any thoughts?

@andrewstucki
Copy link
Contributor Author

@elasticmachine merge upstream

@nchaulet nchaulet added release_note:skip Skip the PR/issue when compiling release notes v7.10.0 v7.9.0 v8.0.0 labels Jul 23, 2020
@jen-huang
Copy link
Contributor

I would like to see this in 7.10 rather than 7.9, as it's not a bug fix but rather an enhancement. Only backporting to 7.10 (7.x) would let us test this during the development of the next release rather than risk something going awry in the 7.9 BCs. @ph @nchaulet WDYT?

@jen-huang jen-huang removed the v7.9.0 label Jul 23, 2020
@ph
Copy link
Contributor

ph commented Jul 23, 2020

@jen-huang @nchaulet agree on 7.10.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@andrewstucki andrewstucki merged commit 398e337 into elastic:master Jul 23, 2020
andrewstucki pushed a commit that referenced this pull request Jul 24, 2020
… in yaml (#72698) (#73131)

* Add contains handlebar helper for conditionally adding blocks in ingest manager yaml

* Split into two tests and sandbox handlebars runtime

* Make helper a little bit more robust and the any explicit

* Add this to function signature with explicit any type

* Update x-pack/plugins/ingest_manager/server/services/epm/agent/agent.ts

Co-authored-by: Nicolas Chaulet <n.chaulet@gmail.com>

Co-authored-by: Nicolas Chaulet <n.chaulet@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Nicolas Chaulet <n.chaulet@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@ruflin
Copy link
Member

ruflin commented Jul 27, 2020

Every addition to handlebar should also be documented in the future on the package side so someone building a package understands which helpers can be used and how they work. I expect us in the future to also do some handlebars validation on the registry side and then we must be able to implement the same handlers.

@andrewstucki Could you add an issue on the package-registry side for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants