Repository navigation
Update sync-packages workflow to support nested package directories - #18549
Conversation
…ctories Replace the ls-based flat package loop with find to discover manifests at up to two levels of nesting under packages/. Use yq .name from the manifest instead of the directory name as the package identifier. Keep LC_ALL=C on sort for consistent locale-independent ordering. Generated with the assistance of Claude Sonnet 4.6
Add Go and mage setup steps to bump-elastic-stack-version.yml so that mage listPackages can be used for package discovery in the updatecli pipeline, replacing the find-based approach and ensuring consistent behaviour with the rest of the CI tooling. Generated with the assistance of Claude Sonnet 4.6
Prevent mage listPackages failures from silently producing an empty package list that would wipe all options from the issue template dropdowns. Generated with the assistance of Claude Sonnet 4.6
Replace `set -euo pipefail` with `set -eu` and extract `mage listPackages` into a separate variable assignment so its exit code is caught by `set -e`, avoiding the "Illegal option -o pipefail" error in sh environments. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| pkgs=$(echo "$package_paths" | while IFS= read -r package_path; do | ||
| title=$(yq .title "${package_path}/manifest.yml") | ||
| echo "- $title [$package_path]" | ||
| done | LC_ALL=C sort -s -f | yq -o json .) |
There was a problem hiding this comment.
Instead of writing the package folder name (e.g 1password), I propose to use the full package path (e.g. packages/1password) instead here.
As there could be packages in nested directories, that could help to locate the corresponding package. Moreover, it could happen that the same package folder name is repeated in a different nested directory even if the package names (from manifest.yml file).
WDYT @andrewkroh @teresaromero @kpollich ?
Example:
- Current approach in main:
- type: dropdown
id: integration_name
attributes:
label: Integration Name
description: Which integration package are you having issues with?
options:
- 1Password [1password]
- Abnormal AI [abnormal_security]
- abuse.ch [ti_abusech]
- Active Directory Entity Analytics [entityanalytics_ad]
- ActiveMQ OpenTelemetry Assets [activemq_otel]- Change proposed in this PR:
- type: dropdown
id: integration_name
attributes:
label: Integration Name
description: Which integration package are you having issues with?
options:
- 1Password [packages/1password]
- Abnormal AI [packages/abnormal_security]
- abuse.ch [packages/ti_abusech]
- Active Directory Entity Analytics [packages/entityanalytics_ad]
- ActiveMQ OpenTelemetry Assets [packages/activemq_otel]There was a problem hiding this comment.
cc @lucabelluccini for awareness in case it is changed that list in the templates
There was a problem hiding this comment.
I think including the full path is relatively harmless and only adds clarity in cases where integration names might collide w/ composable packages. +1 from me on switching to packages/* for the options here.
There was a problem hiding this comment.
That seems good if it helps remove ambiguity, given the new option to put packages in more places.
There was a problem hiding this comment.
+1 to clarity. However, reading the parent issue i find this example
so for example the nginx_input_otel package can be stored under packages/nginx, as input_otel, along with other packages related to nginx.
in this case, the name on the manifest will be telling us the folder structure, is this coincidence of the example or could it lead to other combination? i mean this because, if the naming convention is like that, the name at the manifest will be unique? cc @jsoriano
There was a problem hiding this comment.
if the naming convention is like that, the name at the manifest will be unique?
Package names in the manifest are ensured to be unique via the changes introduced in this PR (dev/packagenames tool).
#18187
in this case, the name on the manifest will be telling us the folder structure, is this coincidence of the example or could it lead to other combination?
Currently, there is no restriction about the folder names it could be created for new packages. That's why it was introduced this new validation, specially when they could be created in nested directories.
For instance, it could be created the nested packages as (even it could be redundant to repeat nginx) or other different folder names:
- packages/nginx/nginx
- packages/nginx/nginx_input_otel
@teresaromero would this answer your doubts? Not sure if I'm missing anything
| - name: Set up Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: .go-version | ||
|
|
||
| - name: Install mage | ||
| run: go install github.com/magefile/mage | ||
|
|
There was a problem hiding this comment.
Required to execute mage listPackages in the updatecli workflow.
There was a problem hiding this comment.
Should we pin a version of mage here?
There was a problem hiding this comment.
I think this is not needed, since this step is running after the checkout action. I think in that case, this action is running in the root of the working directory and therefore the go install command would install the mage version specified in the go.mod file.
I did a test in this PR by forcing to use another mage version (v1.17.1) instead of the latest one (v1.17.2) here: bc1f22b
And the workflow/step installed the v1.17.1 (workflow link):
Run go install github.com/magefile/mage
go install github.com/magefile/mage
shell: /usr/bin/bash -e {0}
env:
GOTOOLCHAIN: local
go: downloading github.com/magefile/mage v1.17.1
There was a problem hiding this comment.
Ah you are right, it is already in the go.mod 👍
💚 Build Succeeded
cc @mrodm |
This reverts commit bc1f22b.
| - name: Set up Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: .go-version | ||
|
|
||
| - name: Install mage | ||
| run: go install github.com/magefile/mage | ||
|
|
There was a problem hiding this comment.
Ah you are right, it is already in the go.mod 👍
…lastic#18549) Update the GitHub Workflow to update the issue templates (sync-packages-to-bug-issue-template via updatecli) to support packages that are located in nested directories. --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Proposed commit message
Update the GitHub Workflow to update the issue templates (
sync-packages-to-bug-issue-templatevia updatecli) to support packages that are located in nested directories.WHAT: Update the
sync-packages-to-bug-issue-templateupdatecli script and thebump-elastic-stack-versionworkflow to support packages living in multiple (nested) directories.ls packages/loop withmage listPackages, which returns the full path to each package regardless of which directory it lives in.titlefrom eachmanifest.ymlusing the path returned bymage listPackages, and display the full package path (e.g.packages/foo/bar) in the issue template options list instead of just the top-level folder name.bump-elastic-stack-versionworkflow so thatmage listPackagesis available at runtime.WHY: The existing script assumed all packages live directly under
packages/, breaking for integrations that use nested directories. Delegating package discovery tomage listPackagesmakes the workflow resilient to any directory layout.Checklist
changelog.ymlfile.Author's Checklist
bump-elastic-stack-versionworkflow correctly installs Go and Mage before the Updatecli step runs.How to test this PR locally
mageis installed andmage listPackagesreturns the expected list of package paths (including any nested ones)..github/workflows/updatecli/updatecli.d/sync-packages-to-bug-issue-template.ymllocally to a script, and try to run it..github/ISSUE_TEMPLATE/integration_bug.ymlandintegration_feature_request.ymlto confirmthe options list contains - <title> [<package_path>] entries for all packages, including nested ones.
Related issues