-
Notifications
You must be signed in to change notification settings - Fork 127
Set pipeline name automatically in transform definitions #2973
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
Open
mrodm
wants to merge
13
commits into
elastic:main
Choose a base branch
from
mrodm:render-transform-manifest
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
07f3e15
Set transform manifest as template
mrodm 5961b7e
Add a copy of ti_anomaly with a dummy ingest pipeline for transform
mrodm 951defe
Skip check if there is no destination pipeline
mrodm 6cf6d08
Check for empty pipelines
mrodm 9093315
Add test
mrodm ff9aa3f
Pin stack version for ti_anomali_template
mrodm bf90e2b
Update stack version used for ti_anomali and ti_anomali_logsdb
mrodm 351171c
Update index and alias names in tranform
mrodm 789693b
Apply suggestions from code review
mrodm d8f0447
Set to lowercase first letter in template function
mrodm ff0daa5
Use text/template
mrodm a44d6cc
Re-phrase error message
mrodm 4f2756e
Validate if ingest pipeline exists on data stream
mrodm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,40 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package builder | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/elastic/elastic-package/internal/packages" | ||
) | ||
|
||
// resolveTransformDefinitions processes all transform definition files in the given destination directory. | ||
// It reads each file, applies templating to set the final ingest pipeline name, and writes the processed | ||
// content back to the same file. | ||
func resolveTransformDefinitions(destinationDir string) error { | ||
files, err := filepath.Glob(filepath.Join(destinationDir, "elasticsearch", "transform", "*", "transform.yml")) | ||
if err != nil { | ||
return fmt.Errorf("failed matching files with transform definitions: %w", err) | ||
} | ||
|
||
for _, file := range files { | ||
stat, err := os.Stat(file) | ||
if err != nil { | ||
return fmt.Errorf("stat failed for transform definition file %q: %w", file, err) | ||
} | ||
contents, _, err := packages.ReadTransformDefinitionFile(file, destinationDir) | ||
if err != nil { | ||
return fmt.Errorf("failed reading transform definition file %q: %w", file, err) | ||
} | ||
|
||
err = os.WriteFile(file, contents, stat.Mode()) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
} |
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.