-
Notifications
You must be signed in to change notification settings - Fork 570
[CI] Support package discovery in nested directories - WIP #18495
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
base: main
Are you sure you want to change the base?
Changes from 7 commits
acdab09
265c135
58f0fe5
d9100b9
91f9db5
a4af05b
741448f
218f948
3d92f36
bb2e60f
e2454f2
99bfc48
9f03436
71e903e
293da9f
5651580
b794a1b
ac65fe1
d7c0536
1f1ebbf
6708fcd
2fea205
ca7362b
6835aef
237d836
1e50707
06a49b5
dc25416
b9fcd33
0e64850
96ff9bf
6d1992c
d85c69c
da33598
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -829,7 +829,7 @@ teardown_test_package() { | |
| } | ||
|
|
||
| list_all_directories() { | ||
| find . -maxdepth 1 -mindepth 1 -type d | xargs -I {} basename {} | sort | ||
| mage listPackages | grep -E '^packages/(elastic_package_registry|nginx)$' | ||
| } | ||
|
Comment on lines
865
to
867
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High
+# list all directories that are packages from the root of the repository
list_all_directories() {
- mage -d "${WORKSPACE}" listPackages | grep -E '^packages/(elastic_package_registry|nginx|rapid7_insightvm|sql_input|nginx/nginx|nginx/nginx_otel)$'
+ find . -maxdepth 1 -mindepth 1 -type d | xargs -I {} basename {} | sort
}🤖 Copy this AI Prompt to have your agent fix this:
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All this filtering of packages is related to run different testing in CI pipelines. It will be removed that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for confirming. Would you like me to remove the |
||
|
|
||
| check_package() { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| // 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 citools | ||
|
|
||
| import ( | ||
| "errors" | ||
| "fmt" | ||
| "io/fs" | ||
| "os" | ||
| "path/filepath" | ||
| "slices" | ||
| ) | ||
|
|
||
| const manifestFileName = "manifest.yml" | ||
|
|
||
| // ListPackages returns the sorted paths of all packages found under dir. | ||
| func ListPackages(dir string) ([]string, error) { | ||
| var paths []string | ||
| err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error { | ||
| if err != nil { | ||
| return err | ||
| } | ||
| if !d.IsDir() { | ||
| return nil | ||
| } | ||
| manifestPath := filepath.Join(path, manifestFileName) | ||
| _, statErr := os.Stat(manifestPath) | ||
| if errors.Is(statErr, os.ErrNotExist) { | ||
| return nil | ||
| } else if statErr != nil { | ||
| return fmt.Errorf("error statting manifest %s: %w", manifestPath, statErr) | ||
| } | ||
| manifest, err := ReadPackageManifest(manifestPath) | ||
| if err != nil { | ||
| return fmt.Errorf("error reading manifest %s: %w", manifestPath, err) | ||
| } | ||
| if !manifest.IsValid() { | ||
| return nil | ||
| } | ||
| paths = append(paths, path) | ||
| // No need to look deeper once a package is found. | ||
| return filepath.SkipDir | ||
| }) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("error listing packages in %s: %w", dir, err) | ||
| } | ||
| slices.Sort(paths) | ||
| return paths, nil | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| /testdata/nested_packages/package_top @elastic/integrations-developer-experience | ||
| /testdata/nested_packages/category @elastic/integrations-developer-experience |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| /testdata/nested_packages/package_top @elastic/integrations-developer-experience | ||
| /testdata/nested_packages/category/package_nested_1 @elastic/integrations-developer-experience |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| /testdata/nested_packages/package_top @elastic/integrations-developer-experience | ||
| /testdata/nested_packages/category/package_nested_1 @elastic/integrations-developer-experience | ||
| /testdata/nested_packages/category/package_nested_1/data_stream/stream_1 @pkoutsovasilis | ||
| /testdata/nested_packages/category/package_nested_2 @elastic/integrations-developer-experience |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| /testdata/nested_packages/package_top @elastic/integrations-developer-experience | ||
| /testdata/nested_packages/category/package_nested_1 @elastic/integrations-developer-experience | ||
| /testdata/nested_packages/category/package_nested_1/data_stream/stream_1 @pkoutsovasilis | ||
| /testdata/nested_packages/category/package_nested_1/data_stream/stream_2 @pkoutsovasilis | ||
| /testdata/nested_packages/category/package_nested_2 @elastic/integrations-developer-experience |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| /testdata/nested_packages/package_top @elastic/integrations-developer-experience | ||
| /testdata/nested_packages/category/package_nested_1 @elastic/integrations-developer-experience | ||
| /testdata/nested_packages/category/package_nested_2 @elastic/integrations-developer-experience |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,6 @@ | ||
| format_version: 1.0.0 | ||
| name: devexp | ||
| type: integration | ||
| version: 1.0.0 | ||
| owner: | ||
| github: elastic/integrations-developer-experience |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| format_version: 1.0.0 | ||
| name: package_nested_1 | ||
| type: integration | ||
| version: 1.0.0 | ||
| owner: | ||
| github: elastic/integrations-developer-experience |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| format_version: 1.0.0 | ||
| name: package_nested_2 | ||
| type: integration | ||
| version: 1.0.0 | ||
| owner: | ||
| github: elastic/integrations-developer-experience |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| format_version: 1.0.0 | ||
| name: package_top | ||
| type: integration | ||
| version: 1.0.0 | ||
| owner: | ||
| github: elastic/integrations-developer-experience |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,6 @@ | ||
| format_version: 1.0.0 | ||
| name: package_1 | ||
| type: integration | ||
| version: 1.0.0 | ||
| owner: | ||
| github: elastic/integrations-developer-experience |
This file was deleted.
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.
🔴 Critical
scripts/common.sh:831list_all_directories()now hardcodes a grep filter that returns only two package names (elastic_package_registryandnginx). Since callerstrigger_integrations_in_parallel.shandtest_integrations_with_serverless.shiterate over this output to drive CI pipelines, all other packages are silently excluded from testing and publishing. If this restriction is intentional, consider documenting why only these two packages should run; otherwise, the filter should be removed to restore full package coverage.list_all_directories() { - mage listPackages | grep -E '^packages/(elastic_package_registry|nginx)$' + mage listPackages }🤖 Copy this AI Prompt to have your agent fix this:
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.
This will be removed before merging the PR. This grep is there to test just a subset of packages instead of the ~400 packages.