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

[Fleet] Add the @custom pipeline only to the main datastream ingest pipeline #144150

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ describe('Install pipeline tests', () => {
await res.install(esClient, logger);

expect(esClient.ingest.putPipeline).toBeCalled();

// It should add the @custom pipeline for the main pipeline
const pipelinesWithCustomProcessor = esClient.ingest.putPipeline.mock.calls.filter((call) =>
// @ts-ignore-error
call[0]?.body.includes('@custom')
);

expect(pipelinesWithCustomProcessor).toHaveLength(1);
});

it('should work with datastream with ingest pipelines define in the package', async () => {
Expand Down Expand Up @@ -73,6 +81,14 @@ describe('Install pipeline tests', () => {
await res.install(esClient, logger);

expect(esClient.ingest.putPipeline).toBeCalledTimes(2);

// It should add the @custom pipeline only for the main pipeline
const pipelinesWithCustomProcessor = esClient.ingest.putPipeline.mock.calls.filter((call) =>
// @ts-ignore-error
call[0]?.body.includes('@custom')
);

expect(pipelinesWithCustomProcessor).toHaveLength(1);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ export async function installAllPipelines({
let datastreamPipelineCreated = false;
pipelinePaths.forEach((path) => {
const { name, extension } = getNameAndExtension(path);
if (name === dataStream?.ingest_pipeline) {
const isMainPipeline = name === dataStream?.ingest_pipeline;
if (isMainPipeline) {
datastreamPipelineCreated = true;
}
const nameForInstallation = getPipelineNameForInstallation({
Expand All @@ -168,9 +169,8 @@ export async function installAllPipelines({
const content = getAsset(path).toString('utf-8');
pipelinesInfos.push({
nameForInstallation,
customIngestPipelineNameForInstallation: dataStream
? getCustomPipelineNameForDatastream(dataStream)
: undefined,
customIngestPipelineNameForInstallation:
dataStream && isMainPipeline ? getCustomPipelineNameForDatastream(dataStream) : undefined,
content,
extension,
});
Expand Down