diff --git a/code/go/internal/validator/folder_spec.go b/code/go/internal/validator/folder_spec.go index 0689a43bc..eab8b0f8a 100644 --- a/code/go/internal/validator/folder_spec.go +++ b/code/go/internal/validator/folder_spec.go @@ -90,10 +90,10 @@ func (s *folderSpec) validate(pkg *Package, path string) ve.ValidationErrors { switch s.Release { case "", "ga": // do nothing case "beta": - if pkg.Version.Prerelease() == "" { + if pkg.Version.Major() > 0 && pkg.Version.Prerelease() == "" { errs = append(errs, errors.Errorf("spec for [%s] defines beta features which can't be enabled for packages with a stable semantic version", pkg.Path(path))) } else { - log.Printf("Warning: package with non-stable semantic version and active beta features (enabled in [%s]) can't be released as stable version.q", pkg.Path(path)) + log.Printf("Warning: package with non-stable semantic version and active beta features (enabled in [%s]) can't be released as stable version.", pkg.Path(path)) } default: errs = append(errs, errors.Errorf("unsupport release level, supported values: beta, ga")) diff --git a/code/go/pkg/validator/validator_test.go b/code/go/pkg/validator/validator_test.go index b089e5aeb..18fe0a426 100644 --- a/code/go/pkg/validator/validator_test.go +++ b/code/go/pkg/validator/validator_test.go @@ -27,6 +27,9 @@ func TestValidateFile(t *testing.T) { "deploy_terraform": {}, "time_series": {}, "missing_data_stream": {}, + "custom_logs": {}, + "httpjson_input": {}, + "sql_input": {}, "bad_additional_content": { "bad-bad", []string{ diff --git a/spec.go b/spec.go index 262773f1e..a5312ed78 100644 --- a/spec.go +++ b/spec.go @@ -9,7 +9,7 @@ import ( "io/fs" ) -//go:embed versions/1 versions/1/integration/_dev versions/1/integration/data_stream/_dev +//go:embed versions/1 versions/1/integration/_dev versions/1/integration/data_stream/_dev versions/1/input var content embed.FS // FS returns an io/fs.FS for accessing the "package-spec/version" contents. diff --git a/test/packages/custom_logs/agent/stream/input.yml.hbs b/test/packages/custom_logs/agent/input/input.yml.hbs similarity index 100% rename from test/packages/custom_logs/agent/stream/input.yml.hbs rename to test/packages/custom_logs/agent/input/input.yml.hbs diff --git a/test/packages/custom_logs/changelog.yml b/test/packages/custom_logs/changelog.yml index c22973a7e..20fdaba3b 100644 --- a/test/packages/custom_logs/changelog.yml +++ b/test/packages/custom_logs/changelog.yml @@ -1,5 +1,5 @@ # newer versions go on top -- version: "0.0.1" +- version: "1.2.0-beta" changes: - description: Initial draft of the package type: enhancement diff --git a/test/packages/custom_logs/manifest.yml b/test/packages/custom_logs/manifest.yml index 4de652066..65aa3de09 100644 --- a/test/packages/custom_logs/manifest.yml +++ b/test/packages/custom_logs/manifest.yml @@ -4,8 +4,7 @@ title: Custom Logs description: >- Read lines from active log files with Elastic Agent. type: input -version: 1.2.3 -release: ga +version: 1.2.0-beta license: basic categories: - custom diff --git a/test/packages/httpjson_input/agent/stream/input.yml.hbs b/test/packages/httpjson_input/agent/input/input.yml.hbs similarity index 100% rename from test/packages/httpjson_input/agent/stream/input.yml.hbs rename to test/packages/httpjson_input/agent/input/input.yml.hbs diff --git a/test/packages/httpjson_input/changelog.yml b/test/packages/httpjson_input/changelog.yml index c22973a7e..37b3d9d3f 100644 --- a/test/packages/httpjson_input/changelog.yml +++ b/test/packages/httpjson_input/changelog.yml @@ -1,5 +1,5 @@ # newer versions go on top -- version: "0.0.1" +- version: "0.2.0" changes: - description: Initial draft of the package type: enhancement diff --git a/test/packages/httpjson_input/manifest.yml b/test/packages/httpjson_input/manifest.yml index bd80a47b3..e964a3e69 100644 --- a/test/packages/httpjson_input/manifest.yml +++ b/test/packages/httpjson_input/manifest.yml @@ -4,8 +4,7 @@ title: HTTPJSON Input description: >- Ingest data from custom RESTful API's that do not currently have an existing integration. type: input -version: 1.2.0 -release: ga +version: 0.2.0 categories: - custom conditions: diff --git a/test/packages/sql_input/agent/stream/input.yml.hbs b/test/packages/sql_input/agent/input/input.yml.hbs similarity index 100% rename from test/packages/sql_input/agent/stream/input.yml.hbs rename to test/packages/sql_input/agent/input/input.yml.hbs diff --git a/test/packages/sql_input/changelog.yml b/test/packages/sql_input/changelog.yml index c22973a7e..37b3d9d3f 100644 --- a/test/packages/sql_input/changelog.yml +++ b/test/packages/sql_input/changelog.yml @@ -1,5 +1,5 @@ # newer versions go on top -- version: "0.0.1" +- version: "0.2.0" changes: - description: Initial draft of the package type: enhancement diff --git a/test/packages/sql_input/manifest.yml b/test/packages/sql_input/manifest.yml index b45a208f1..0d548eb43 100644 --- a/test/packages/sql_input/manifest.yml +++ b/test/packages/sql_input/manifest.yml @@ -4,8 +4,7 @@ title: SQL Input description: >- Execute custom queries against an SQL database and store the results in Elasticsearch. type: input -version: 1.0.1 -release: ga +version: 0.2.0 license: basic categories: - custom diff --git a/versions/1/changelog.yml b/versions/1/changelog.yml index 2e694b01b..e3ccf9590 100644 --- a/versions/1/changelog.yml +++ b/versions/1/changelog.yml @@ -10,6 +10,9 @@ - description: Define beta features in spec type: enhancement link: https://github.com/elastic/package-spec/pull/341 + - description: Write "input" package spec (beta) + type: enhancement + link: https://github.com/elastic/package-spec/pull/328 - version: 1.9.0 changes: - description: Prepare for next version diff --git a/versions/1/input/manifest.spec.yml b/versions/1/input/manifest.spec.yml new file mode 100644 index 000000000..347c00993 --- /dev/null +++ b/versions/1/input/manifest.spec.yml @@ -0,0 +1,131 @@ +## +## Describes the specification for the input package's main manifest.yml file +## +spec: + # Everything under here follows JSON schema (https://json-schema.org/), written as YAML for readability + type: object + additionalProperties: false + properties: + format_version: + description: The version of the package specification format used by this package. + $ref: "../integration/manifest.spec.yml#/definitions/version" + name: + description: The name of the package. + type: string + pattern: '^[a-z0-9_]+$' + examples: + - apache + title: + description: The title of the package. + type: string + examples: + - Apache + description: + description: A longer description of the package. + type: string + examples: + - Apache Integration + version: + description: The version of the package. + $ref: "../integration/manifest.spec.yml#/definitions/version" + license: + description: The license under which the package is being released. + type: string + enum: + - basic + default: basic + examples: + - basic + type: + description: The type of package. + type: string + enum: + - input + examples: + - input + categories: + $ref: "../integration/manifest.spec.yml#/definitions/categories" + conditions: + description: Conditions under which this package can be installed. + type: object + additionalProperties: false + properties: + kibana: + description: Kibana conditions + type: object + additionalProperties: false + properties: + version: + type: string + description: Kibana versions compatible with this package. + examples: + - ">=7.9.0" + policy_templates: + description: List of policy templates offered by this package. + type: array + items: + type: object + additionalProperties: false + properties: + name: + description: Name of policy template. + type: string + examples: + - apache + type: + description: Type of data stream + type: string + enum: + - metrics + - logs + - synthetics + - traces + examples: + - metrics + title: + description: Title of policy template. + type: string + examples: + - Apache logs and metrics + description: + description: Longer description of policy template. + type: string + examples: + - Collect logs and metrics from Apache instances + icons: + $ref: "../integration/manifest.spec.yml#/definitions/icons" + screenshots: + $ref: "../integration/manifest.spec.yml#/definitions/screenshots" + vars: + $ref: "../integration/data_stream/manifest.spec.yml#/definitions/vars" + input: + type: string + examples: + - aws/metrics + - s3 + - file + template_path: + description: "Path to Elasticsearch index template for stream." + type: string + required: + - name + - title + - description + - type + - input + icons: + $ref: "../integration/manifest.spec.yml#/definitions/icons" + screenshots: + $ref: "../integration/manifest.spec.yml#/definitions/screenshots" + vars: + $ref: "../integration/data_stream/manifest.spec.yml#/definitions/vars" + owner: + $ref: "../integration/manifest.spec.yml#/definitions/owner" + required: + - format_version + - name + - title + - description + - version + - type + - owner diff --git a/versions/1/input/spec.yml b/versions/1/input/spec.yml new file mode 100644 index 000000000..6af0acf78 --- /dev/null +++ b/versions/1/input/spec.yml @@ -0,0 +1,43 @@ +## +## Entrypoint of "input packages" specification. +## The specification is considered "beta" at the moment, so it may change until we release it as GA. +## +## Describes the folders and files that make up a package. +## +spec: + additionalContents: true + totalContentsLimit: 65535 + totalSizeLimit: 50MB + sizeLimit: 30MB + configurationSizeLimit: 5MB + relativePathSizeLimit: 3MB + release: beta + contents: + - description: The main package manifest file + type: file + contentMediaType: "application/x-yaml" + sizeLimit: 5MB + name: "manifest.yml" + required: true + $ref: "./manifest.spec.yml" + - description: The package's CHANGELOG file + type: file + contentMediaType: "application/x-yaml" + name: "changelog.yml" + required: true + $ref: "../integration/changelog.spec.yml" + - description: Folder containing agent-related definitions + type: folder + name: agent + required: true + $ref: "../integration/agent/spec.yml" + - description: Folder containing documentation for the package + type: folder + name: docs + required: true + $ref: "../integration/docs/spec.yml" + - description: Folder containing field definitions + type: folder + name: fields + required: true + $ref: "../integration/data_stream/fields/spec.yml" \ No newline at end of file diff --git a/versions/1/integration/data_stream/agent/spec.yml b/versions/1/integration/data_stream/agent/spec.yml new file mode 100644 index 000000000..c7fd10741 --- /dev/null +++ b/versions/1/integration/data_stream/agent/spec.yml @@ -0,0 +1,14 @@ +spec: + additionalContents: false + contents: + - description: Folder containing input definitions + type: folder + name: stream + required: true + additionalContents: false + contents: + - description: Folder containing agent stream definitions + type: file + sizeLimit: 2MB + pattern: '^.+.yml.hbs$' + required: true diff --git a/versions/1/integration/data_stream/spec.yml b/versions/1/integration/data_stream/spec.yml index 53fd7b390..3d8078397 100644 --- a/versions/1/integration/data_stream/spec.yml +++ b/versions/1/integration/data_stream/spec.yml @@ -25,12 +25,7 @@ spec: name: agent required: false additionalContents: false - contents: - - description: Folder containing agent stream definitions - type: folder - name: stream - required: true - additionalContents: false + $ref: "./agent/spec.yml" - description: Folder containing Elasticsearch assets type: folder name: elasticsearch diff --git a/versions/1/integration/manifest.spec.yml b/versions/1/integration/manifest.spec.yml index 2ae136136..29b20e212 100644 --- a/versions/1/integration/manifest.spec.yml +++ b/versions/1/integration/manifest.spec.yml @@ -1,5 +1,5 @@ ## -## Describes the specification for the package's main manifest.yml file +## Describes the specification for the integration package's main manifest.yml file ## spec: # Everything under here follows JSON schema (https://json-schema.org/), written as YAML for readability @@ -107,6 +107,16 @@ spec: - "1.0.0-beta1" - "1.0.0-SNAPSHOT" - "1.0.0-next" + owner: + type: object + additionalProperties: false + properties: + github: + description: GitHub repository name of package maintainer. + type: string + pattern: '^(([a-zA-Z0-9-]+)|([a-zA-Z0-9-]+\/[a-zA-Z0-9-]+))$' + required: + - github properties: format_version: description: The version of the package specification format used by this package. @@ -268,15 +278,7 @@ spec: vars: $ref: "./data_stream/manifest.spec.yml#/definitions/vars" owner: - type: object - additionalProperties: false - properties: - github: - description: GitHub repository name of package maintainer. - type: string - pattern: '^(([a-zA-Z0-9-]+)|([a-zA-Z0-9-]+\/[a-zA-Z0-9-]+))$' - required: - - github + $ref: "#/definitions/owner" elasticsearch: description: Elasticsearch requirements type: object diff --git a/versions/1/integration/spec.yml b/versions/1/integration/spec.yml index 013dc72ac..584eb4bee 100644 --- a/versions/1/integration/spec.yml +++ b/versions/1/integration/spec.yml @@ -1,5 +1,5 @@ ## -## Entrypoint of package specification. +## Entrypoint of "integration packages" specification. ## ## Describes the folders and files that make up a package. ##