elastic / elastic/elastic-package
`elastic-package create` supports composable package wizard
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 72
- Forks
- 141
- Avg merge
- 19h 42m
- Merged PRs (30d)
- 55
Description
Summary
The composable build/merge path shipped in #3459 / #3474 / #3480 (umbrella #3277) but elastic-package create ... doesn't know composable exists. Two scaffolders need to learn the new shape:
elastic-package create packagealways emits the legacy policy-template input shape (type: logfile) and never arequires:block. There's no flag to opt into composable.elastic-package create data-streamrejectsotelcol(andlogfile) outright, and even when fed an allowed--inputsvalue it dumps ~25 input vars +agent/stream/<input>.yml.hbs+elasticsearch/ingest_pipeline/default.ymlinto the stream — all of which come from the input package at build time for composable streams.
These two land together because the data-stream scaffolder needs to read the parent manifest's requires.input[] to validate --package, so the package-side change is a prerequisite.
Repro
cd /tmp && mkdir -p composable_repro/packages && cd composable_repro/packages
# Symptom A1: no composable shape from `create package`
elastic-package create package --name foo_composable --type integration
grep -A2 'inputs:' foo_composable/manifest.yml
# observe: type: logfile, no requires: block
cd foo_composable
# Symptom B1: otelcol rejected
elastic-package create data-stream --type logs --inputs otelcol
# error: invalid input type "otelcol"; allowed values: [aws-cloudwatch ...]
# Symptom B2: even allowed inputs dump stream cruft
elastic-package create data-stream --type logs --inputs filestream --name foo
ls foo/ # observe agent/stream/, elasticsearch/ingest_pipeline/, populated vars block
Proposed shape
elastic-package create package --composable
New boolean flag, default false. When set:
- Wizard prompts
Required input packages? (y/N). If yes, loop prompting for<package_name>@<version>pairs. manifest.ymlis rendered with:- A
requires.input:block listing each captured pair. policy_templates[].inputs[].package: <name>(matched 1:1 with the declaredrequires.input[]entries) instead of the legacytype: <input_type>.
- A
requires.contentis not prompted (out of scope).- Without
--composable, current scaffolder output is byte-for-byte unchanged.
elastic-package create data-stream --package <input_pkg_name>
New flag, mutually exclusive with --inputs. When set:
- Skip the
--inputsrequirement (no allowlist check). - Validate that
<input_pkg_name>is in the parentmanifest.yml'srequires.input[]. Read../manifest.ymlrelative to the new data-stream's parent dir. Error with a clear message if missing. - Emit a minimal
streams[0]:package: <input_pkg_name>plustitle:anddescription:. Skip:agent/stream/*.yml.hbsemissionelasticsearch/ingest_pipeline/*.ymlemission- All copied vars from the input type (composable build merges them at build time).
- Author adds stream-specific vars (e.g.
include:path overrides) manually post-scaffold.
Source pointers
elastic-package create package:
- Template:
internal/packages/archetype/_static/package-manifest.yml.tmpl:33-43(policy_templates / integration branch). - Wizard/CLI:
cmd/create_package.go. Version default0.0.1at:102and:214is fine. - Either branch in-place on a new
.Manifest.Composableboolean, or ship a parallelpackage-manifest-composable.yml.tmpland pick by flag ininternal/packages/archetype/package.go.
elastic-package create data-stream:
- Allowlist:
internal/packages/packages.go:51(AllowedLogsInputTypes) —otelcol/logfileabsent. - Validation site:
cmd/create_data_stream.go:188-189. - Wizard multi-select:
cmd/create_data_stream.go:107. - Var injection (the cruft):
internal/packages/archetype/data_stream_inputs.go:48(populateInputs). - Templates to skip when
--packageis set:internal/packages/archetype/_static/dataStream-agent-stream.yml.tmpl,internal/packages/archetype/_static/dataStream-elasticsearch-ingest-pipeline.yml.tmpl.
Acceptance criteria
-
elastic-package create package --composable --name foo --type integrationproduces amanifest.ymlwith at least onepolicy_templates[].inputs[].package: <name>(no legacytype:) and arequires.input:block whose entries match the policy_template inputs. - Without
--composable,elastic-package create packageoutput is byte-for-byte unchanged. -
elastic-package create data-stream --type logs --package filelog_otel --name accesssucceeds when the parent'srequires.inputlistsfilelog_otel; fails with a clear error otherwise. - The scaffolded composable data stream contains only
manifest.yml(withstreams[0].package:) — noagent/stream/, noelasticsearch/ingest_pipeline/, no copied vars. -
--packageand--inputsare mutually exclusive; passing both errors at validation. - Existing
--inputspaths are byte-for-byte unchanged. -
elastic-package build -von a package scaffolded with--composable+ composable data streams succeeds with no manual edits (assuming declared input packages exist in the EPR).
Related
- #3000 (
otelcolinput-type selection — adjacent scope; decide if it merges into this flow). - #3277 (composable build/merge umbrella).
- #3459, #3474, #3480 (composable build PRs already shipped).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with cmd/create_package.go and cmd/create_data_stream.go, then inspect the manifest and data-stream templates under internal/packages/archetype/_static plus data_stream_inputs.go. Trace the existing --inputs validation and rendering flow before adding the composable branches. Done means the listed acceptance cases pass, including unchanged legacy output, requires.input validation, mutually exclusive flags, minimal composable streams, and a successful verbose build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100