Skip to content

Commit

Permalink
Expand configuration_links to support internal/external links (#844)
Browse files Browse the repository at this point in the history
Added support to configuration_links to kibana manifest to
include explicit formats for the internal ("kbn:/") and external
("http://" or "https://") urls.
  • Loading branch information
criamico authored Dec 13, 2024
1 parent 5325b7e commit 6cad88c
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 9 deletions.
2 changes: 2 additions & 0 deletions code/go/pkg/validator/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:/)'",
},
},
}
Expand Down
3 changes: 3 additions & 0 deletions spec/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion spec/integration/manifest.spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion test/packages/bad_configuration_links/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions test/packages/good_v3/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions test/packages/kibana_configuration_links/changelog.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 14 additions & 4 deletions test/packages/kibana_configuration_links/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6cad88c

Please sign in to comment.