-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet] Create templates and pipelines when updating package of a sin…
…gle package policy from type integration to input. (#150199) ## Summary Part of #149423 When upgrading a single package policy with conflicts, we use the update package API. When we update from an input package to an integration package, we need to create the per-policy assets. This PR detects if an update is changing from an integration package to an input package and creates the assets as part of the update. I've added an integration test for this scenario. --------- Co-authored-by: Nicolas Chaulet <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
876b3f5
commit 93ec3cd
Showing
20 changed files
with
314 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...leet_api_integration/apis/fixtures/test_packages/integration_to_input/1.0.0/changelog.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# newer versions go on top | ||
- version: "1.0.0" | ||
changes: | ||
- description: test | ||
type: enhancement | ||
link: http://some.url |
9 changes: 9 additions & 0 deletions
9
...ures/test_packages/integration_to_input/1.0.0/data_stream/log/agent/stream/stream.yml.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
paths: | ||
{{#each paths}} | ||
- {{this}} | ||
{{/each}} | ||
|
||
data_stream: | ||
dataset: {{data_stream.dataset}} | ||
|
||
{{custom}} |
Binary file renamed
BIN
+12 KB
...n_to_input/integration_to_input-0.9.0.zip → ...ut/1.0.0/data_stream/log/fields/agent.yml
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
.../fixtures/test_packages/integration_to_input/1.0.0/data_stream/log/fields/base-fields.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
- name: data_stream.type | ||
type: constant_keyword | ||
description: Data stream type. | ||
- name: data_stream.dataset | ||
type: constant_keyword | ||
description: Data stream dataset. | ||
- name: data_stream.namespace | ||
type: constant_keyword | ||
description: Data stream namespace. | ||
- name: '@timestamp' | ||
type: date | ||
description: Event timestamp. |
28 changes: 28 additions & 0 deletions
28
...ation/apis/fixtures/test_packages/integration_to_input/1.0.0/data_stream/log/manifest.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
title: Log Dataset | ||
type: logs | ||
streams: | ||
- input: logfile | ||
description: Collect your custom log files. | ||
title: Collect log files | ||
vars: | ||
- name: paths | ||
required: true | ||
title: Log file path | ||
description: Path to log files to be collected | ||
type: text | ||
multi: true | ||
- name: data_stream.dataset | ||
required: true | ||
default: generic | ||
title: Dataset name | ||
description: > | ||
Set the name for your dataset. Changing the dataset will send the data to a different index. You can't use `-` in the name of a dataset and only valid characters for [Elasticsearch index names](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html). | ||
type: text | ||
- name: custom | ||
title: Custom configurations | ||
description: > | ||
Here YAML configuration options can be used to be added to your configuration. Be careful using this as it might break your configuration file. | ||
type: yaml | ||
default: "" |
3 changes: 3 additions & 0 deletions
3
...tegration/apis/fixtures/test_packages/integration_to_input/1.0.0/docs/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Log Package | ||
|
||
The log package is used as a generic package based on which any log file can be tailed by adjusting the ingest pipeline. |
4 changes: 4 additions & 0 deletions
4
...integration/apis/fixtures/test_packages/integration_to_input/1.0.0/img/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions
24
...fleet_api_integration/apis/fixtures/test_packages/integration_to_input/1.0.0/manifest.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
format_version: 1.0.0 | ||
name: integration_to_input | ||
title: Custom Logs | ||
description: >- | ||
This package goes from an integration package to an input package | ||
type: integration | ||
version: 1.0.0 | ||
release: ga | ||
license: basic | ||
categories: | ||
- custom | ||
policy_templates: | ||
- name: logs | ||
title: Custom logs | ||
description: Collect your custom log files. | ||
inputs: | ||
- type: logfile | ||
title: Custom log file | ||
description: Collect your custom log files. | ||
icons: | ||
- src: "/img/icon.svg" | ||
type: "image/svg+xml" | ||
owner: | ||
github: elastic/elastic-agent-data-plane |
18 changes: 18 additions & 0 deletions
18
...egration/apis/fixtures/test_packages/integration_to_input/2.0.0/agent/input/input.yml.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
paths: | ||
{{#each paths}} | ||
- {{this}} | ||
{{/each}} | ||
|
||
{{#if tags}} | ||
tags: | ||
{{#each tags as |tag i|}} | ||
- {{tag}} | ||
{{/each}} | ||
{{/if}} | ||
|
||
{{#if pipeline}} | ||
pipeline: {{pipeline}} | ||
{{/if}} | ||
|
||
data_stream: | ||
dataset: {{data_stream.dataset}} |
11 changes: 11 additions & 0 deletions
11
...leet_api_integration/apis/fixtures/test_packages/integration_to_input/2.0.0/changelog.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# newer versions go on top | ||
- version: "2.0.0" | ||
changes: | ||
- description: Changed to input pkg | ||
type: enhancement | ||
link: http://some.url | ||
- version: "1.0.0" | ||
changes: | ||
- description: test | ||
type: enhancement | ||
link: http://some.url |
1 change: 1 addition & 0 deletions
1
...tegration/apis/fixtures/test_packages/integration_to_input/2.0.0/docs/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Custom Logs |
4 changes: 4 additions & 0 deletions
4
...t_api_integration/apis/fixtures/test_packages/integration_to_input/2.0.0/fields/input.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- name: input.name | ||
type: constant_keyword | ||
description: Sample field to be added. | ||
value: logs |
1 change: 1 addition & 0 deletions
1
...tion/apis/fixtures/test_packages/integration_to_input/2.0.0/img/sample-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file renamed
BIN
+30.3 KB
...n_to_input/integration_to_input-0.9.1.zip → ..._to_input/2.0.0/img/sample-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions
45
...fleet_api_integration/apis/fixtures/test_packages/integration_to_input/2.0.0/manifest.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
format_version: 1.0.0 | ||
name: integration_to_input | ||
title: Custom Logs | ||
description: >- | ||
This package goes from an integration package to an input package | ||
type: input | ||
version: 2.0.0 | ||
license: basic | ||
categories: | ||
- custom | ||
policy_templates: | ||
- name: logs | ||
type: logs | ||
title: Custom log file | ||
description: Collect your custom log files. | ||
input: logfile | ||
template_path: input.yml.hbs | ||
vars: | ||
- name: paths | ||
type: text | ||
title: Paths | ||
multi: true | ||
required: true | ||
show_user: true | ||
- name: tags | ||
type: text | ||
title: Tags | ||
multi: true | ||
required: true | ||
show_user: false | ||
- name: ignore_older | ||
type: text | ||
title: Ignore events older than | ||
required: false | ||
default: 72h | ||
icons: | ||
- src: "/img/sample-logo.svg" | ||
type: "image/svg+xml" | ||
screenshots: | ||
- src: "/img/sample-screenshot.png" | ||
title: "Sample screenshot" | ||
size: "600x600" | ||
type: "image/png" | ||
owner: | ||
github: elastic/integrations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.