-
Notifications
You must be signed in to change notification settings - Fork 127
Create input packages #1424
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
Create input packages #1424
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| package archetype | ||
|
|
||
| const inputAgentConfigTemplate = `data_stream: | ||
| dataset: ` + "{{`{{data_stream.dataset}}`}}" + ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot we avoid these concatenations, they make these templates difficult to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be changed to:
| dataset: ` + "{{`{{data_stream.dataset}}`}}" + ` | |
| dataset: {{ "{{data_stream.dataset}}" }} |
It looks at least somehow better to read, no ? @jsoriano .
I could update the other templates to use this way of writing those strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just updated all the templates to use that syntax to write strings with {{}}
Moreover, all these templates and resources (logo and screenshot) have been moved to a _static folder and they are loaded now using embed
| return fmt.Errorf("can't render sample screenshot: %w", err) | ||
| } | ||
|
|
||
| if packageDescriptor.Manifest.Type == "input" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test case in package_test.go?
| package archetype | ||
|
|
||
| const packageManifestTemplate = `format_version: 2.8.0 | ||
| format_version: 2.10.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use the latest package-spec version published
| t.Run("input-pacakge", func(t *testing.T) { | ||
| pd := createPackageDescriptorForTest("input") | ||
|
|
||
| err := createAndCheckPackage(t, pd) | ||
| require.Error(t, err) | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added test for input package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
| var dataStreamElasticsearchIngestPipelineTemplate string | ||
|
|
||
| //go:embed _static/dataStream-manifest.yml.tmpl | ||
| var dataStreamManifestTemplate string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better 👍
We could have placed these definitions in the files where they are used, but it is fine like this too.
💚 Build Succeeded
History
cc @mrodm |
Fixes #1361
This PR adds to
elastic-package create packagethe required questions to the survey to be able to create input packages.Two new questions have been added:
policy_templatesmap in manifest.yml and agent config template would be updated accordinglyThis would create an input package with these files and folders:
Example of the survey shown: