From 6cad88cfa842a8ad0d7493d0ab90cacbff8dc914 Mon Sep 17 00:00:00 2001 From: Cristina Amico Date: Fri, 13 Dec 2024 10:49:29 +0100 Subject: [PATCH] Expand configuration_links to support internal/external links (#844) Added support to configuration_links to kibana manifest to include explicit formats for the internal ("kbn:/") and external ("http://" or "https://") urls. --- code/go/pkg/validator/validator_test.go | 2 ++ spec/changelog.yml | 3 +++ spec/integration/manifest.spec.yml | 3 ++- .../bad_configuration_links/manifest.yml | 10 +++++++++- test/packages/good_v3/manifest.yml | 13 ++++++++++--- .../kibana_configuration_links/changelog.yml | 5 +++++ .../kibana_configuration_links/manifest.yml | 18 ++++++++++++++---- 7 files changed, 45 insertions(+), 9 deletions(-) diff --git a/code/go/pkg/validator/validator_test.go b/code/go/pkg/validator/validator_test.go index ad100e1f..ffc3f40d 100644 --- a/code/go/pkg/validator/validator_test.go +++ b/code/go/pkg/validator/validator_test.go @@ -245,6 +245,8 @@ func TestValidateFile(t *testing.T) { []string{ "field policy_templates.0.configuration_links: Array must have at least 1 items", "field policy_templates.1.configuration_links.0: url is required", + "field policy_templates.1.configuration_links.1.url: Does not match pattern '^(http(s)?://|kbn:/)'", + "field policy_templates.1.configuration_links.2.url: Does not match pattern '^(http(s)?://|kbn:/)'", }, }, } diff --git a/spec/changelog.yml b/spec/changelog.yml index c646e179..9bf744a9 100644 --- a/spec/changelog.yml +++ b/spec/changelog.yml @@ -21,6 +21,9 @@ - description: Add support for configuration links to kibana manifest. type: enhancement link: https://github.com/elastic/package-spec/pull/834 + - description: Expand support to internal and external configuration_links defined in kibana manifest. + type: enhancement + link: https://github.com/elastic/package-spec/pull/844 - version: 3.3.0 changes: - description: Add support for content packages. diff --git a/spec/integration/manifest.spec.yml b/spec/integration/manifest.spec.yml index ded75c23..0f7586b3 100644 --- a/spec/integration/manifest.spec.yml +++ b/spec/integration/manifest.spec.yml @@ -217,8 +217,9 @@ spec: description: Link title type: string url: - description: Link url + description: Link url. Format is `http://...` or `https://...` for external links, `kbn:/app/...` for links internal to Kibana. type: string + pattern: '^(http(s)?://|kbn:/)' type: description: Type of link. `next_steps` for links to locations that can be relevant right after configuring the policy. `action` for actions that can be performed while the policy is in use. type: string diff --git a/test/packages/bad_configuration_links/manifest.yml b/test/packages/bad_configuration_links/manifest.yml index 484c23d9..4d0facb5 100644 --- a/test/packages/bad_configuration_links/manifest.yml +++ b/test/packages/bad_configuration_links/manifest.yml @@ -79,10 +79,18 @@ policy_templates: organization: security division: engineering team: cloud-security - # bad format: missing fields configuration_links: + # bad format: missing field url - title: Security overview type: next_step + # bad format: doesn't match format kbn:/.. + - title: View Agents + url: "app/fleet/agents" + type: next_step + # bad format: it should match either http/https format or kbn:/ format + - title: View Agents + url: "elastic.co" + type: next_step inputs: - type: apache/metrics title: Collect metrics in agentless diff --git a/test/packages/good_v3/manifest.yml b/test/packages/good_v3/manifest.yml index 14519231..63092235 100644 --- a/test/packages/good_v3/manifest.yml +++ b/test/packages/good_v3/manifest.yml @@ -40,10 +40,17 @@ policy_templates: division: observability team: obs-infraobs-integrations configuration_links: - - title: Security overview - url: "/security/overview" + - title: View Agents + url: "kbn:/app/fleet/agents" + type: next_step + content: "Check your agents in Fleet" + - title: Elastic website + url: "https://www.elastic.co/" + type: action + content: "See more" + - title: See agents + url: "http://localhost:5601/app/fleet/agents" type: next_step - content: "View security overview" inputs: - type: apache/metrics title: Collect metrics from Apache instances diff --git a/test/packages/kibana_configuration_links/changelog.yml b/test/packages/kibana_configuration_links/changelog.yml index b87e1020..91ac5a3f 100644 --- a/test/packages/kibana_configuration_links/changelog.yml +++ b/test/packages/kibana_configuration_links/changelog.yml @@ -1,3 +1,8 @@ +- version: 1.0.2 + changes: + - description: Expand kibana configuration links + type: enhancement + link: https://github.com/elastic/package-spec/pull/844 - version: 1.0.1 changes: - description: Add kibana configuration links diff --git a/test/packages/kibana_configuration_links/manifest.yml b/test/packages/kibana_configuration_links/manifest.yml index 11703ad7..19c3d688 100644 --- a/test/packages/kibana_configuration_links/manifest.yml +++ b/test/packages/kibana_configuration_links/manifest.yml @@ -2,7 +2,7 @@ format_version: 3.3.1 name: kibana_configuration_links title: Kibana Configuration Links description: Kibana configuration links examples -version: 1.0.1 +version: 1.0.2 type: integration source: license: "Apache-2.0" @@ -40,10 +40,20 @@ policy_templates: division: observability team: obs-infraobs-integrations configuration_links: - - title: Security overview - url: "/security/overview" + - title: View Agents + url: "kbn:/app/fleet/agents" + type: next_step + content: "Check your agents in Fleet" + - title: Browse integrations + url: "kbn:/app/integrations/browse" + type: action + - title: Elastic website + url: "https://www.elastic.co/" + type: action + content: "See more" + - title: See agents + url: "http://localhost:5601/app/fleet/agents" type: next_step - content: "View security overview" inputs: - type: apache/metrics title: Collect metrics from Apache instances