Skip to content

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

Merged
andrewstucki merged 6 commits intoelastic:masterfrom
andrewstucki:contains-helper
Jul 23, 2020
Merged

[Ingest Manager] Add contains handlebar helper for conditional blocks in yaml#72698
andrewstucki merged 6 commits intoelastic:masterfrom
andrewstucki:contains-helper

Conversation

@andrewstucki
Copy link
Copy Markdown
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 a team, andrewkroh, nchaulet and ruflin 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
Copy Markdown
Contributor

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

@andrewstucki andrewstucki requested a review from nchaulet July 21, 2020 18:39
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

ph commented Jul 23, 2020

@jen-huang @nchaulet agree on 7.10.

@kibanamachine
Copy link
Copy Markdown
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
Copy Markdown
Contributor

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