-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet][EPM] Add TS type for package-spec. Clarify EPR relationship w…
…ith spec (#84946) ## Summary * Create a [TS type for `package-spec`](https://github.com/elastic/kibana/blob/09cce235de55f898043e969a234464e62473cba9/x-pack/plugins/fleet/common/types/models/package_spec.ts) to differentiate Registry shape from spec shape * Clarify EPR types relationship with package spec. i.e. what required properties it makes optional, what properties it adds, which property types it changes, etc. https://github.com/elastic/kibana/blob/5f2c4a5547fc9a70b2696ca34c7caff64f3ed674/x-pack/plugins/fleet/common/types/models/epm.ts#L71-L80 * Updated `manifest.yml` in `apache_invalid_manifest_missing_field_0.1.4.zip`. Previously it was missing the `type` property, but that's optional [according to package-spec](https://github.com/elastic/package-spec/blob/3b4d8207554dde6ab9646567dd39b747a2ce167c/versions/1/manifest.spec.yml#L241-L248). Removed the required `format_version` and re-zipped. <details><summary>screenshots show errors if catches in a mock PackageInfo object</summary> using `requirement`; not `conditions` <img width="1084" alt="Screen Shot 2020-12-02 at 12 07 15 PM" src="https://user-images.githubusercontent.com/57655/101083986-4b915f80-357b-11eb-84c6-14605e1ea3d8.png"> using `versions`; not `version` <img width="1395" alt="Screen Shot 2020-12-02 at 12 08 13 PM" src="https://user-images.githubusercontent.com/57655/101083988-4c29f600-357b-11eb-9ff2-2b73e313c130.png"> including `elasticsearch` when spec says it' not valid yet <img width="1589" alt="Screen Shot 2020-12-02 at 12 08 36 PM" src="https://user-images.githubusercontent.com/57655/101083990-4c29f600-357b-11eb-8250-8926f7189af8.png"> </details> <details><summary>screenshots showing editor autocomplete for registry response values like <code>categories</code></summary> <img width="422" alt="Screen Shot 2020-12-02 at 12 25 11 PM" src="https://user-images.githubusercontent.com/57655/101083994-4cc28c80-357b-11eb-9013-ae208f7c311a.png"> <img width="345" alt="Screen Shot 2020-12-02 at 12 25 01 PM" src="https://user-images.githubusercontent.com/57655/101083991-4c29f600-357b-11eb-9468-bbb9d27513b1.png"> </details> <details><summary>screenshot showing type check preventing adding properties which aren't explicitly listed as "additions"</summary> <img width="1295" alt="Screen Shot 2020-12-03 at 11 38 43 AM" src="https://user-images.githubusercontent.com/57655/101083997-4cc28c80-357b-11eb-83b9-206b85521f11.png"> </details> ### Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
- Loading branch information
John Schulz
authored
Dec 7, 2020
1 parent
e476baf
commit ef7367d
Showing
15 changed files
with
189 additions
and
96 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,71 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { RegistryPolicyTemplate } from './epm'; | ||
|
||
// Based on https://github.com/elastic/package-spec/blob/master/versions/1/manifest.spec.yml#L8 | ||
export interface PackageSpecManifest { | ||
format_version: string; | ||
name: string; | ||
title: string; | ||
description: string; | ||
version: string; | ||
license?: 'basic'; | ||
type?: 'integration'; | ||
release: 'experimental' | 'beta' | 'ga'; | ||
categories?: Array<PackageSpecCategory | undefined>; | ||
conditions?: PackageSpecConditions; | ||
icons?: PackageSpecIcon[]; | ||
screenshots?: PackageSpecScreenshot[]; | ||
policy_templates?: RegistryPolicyTemplate[]; | ||
owner: { github: string }; | ||
} | ||
|
||
export type PackageSpecCategory = | ||
| 'aws' | ||
| 'azure' | ||
| 'cloud' | ||
| 'config_management' | ||
| 'containers' | ||
| 'crm' | ||
| 'custom' | ||
| 'datastore' | ||
| 'elastic_stack' | ||
| 'google_cloud' | ||
| 'kubernetes' | ||
| 'languages' | ||
| 'message_queue' | ||
| 'monitoring' | ||
| 'network' | ||
| 'notification' | ||
| 'os_system' | ||
| 'productivity' | ||
| 'security' | ||
| 'support' | ||
| 'ticketing' | ||
| 'version_control' | ||
| 'web'; | ||
|
||
export type PackageSpecConditions = Record< | ||
'kibana', | ||
{ | ||
version: string; | ||
} | ||
>; | ||
|
||
export interface PackageSpecIcon { | ||
src: string; | ||
title?: string; | ||
size?: string; | ||
type?: string; | ||
} | ||
|
||
export interface PackageSpecScreenshot { | ||
src: string; | ||
title: string; | ||
size?: string; | ||
type?: string; | ||
} |
This file contains 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 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 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 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.