Skip to content

Remove fleet managed tags#1206

Merged
mrodm merged 9 commits intoelastic:mainfrom
mrodm:remove_fleet_managed_tags
Apr 5, 2023
Merged

Remove fleet managed tags#1206
mrodm merged 9 commits intoelastic:mainfrom
mrodm:remove_fleet_managed_tags

Conversation

@mrodm
Copy link
Copy Markdown
Contributor

@mrodm mrodm commented Apr 4, 2023

Closes #1060

This PR adds a new transformation into the elastic-package export dashboards. This transformation is in charge of:

  • removing tag references managed by fleet in any Kibana asset/resource (visualization, maps, dashboard, search, ...)
  • removing tag objects managed by fleet

In this PR it is assumed that the tags created by fleet have these patterns:

  • fleet-pkg-<packageName>-default
  • fleet-managed-default
  • <packageName>-fleet-pkg-<packageName>-default
  • <packageName>-fleet-managed-default

The last two ones are references/IDs created in case they were already duplicated, adding as a prefix the package name as part of the standardize transformation.

Tests performed

  • Export dashboard with managed tags
  • Export dashboard with already duplicated tags defined
    • NOTE: in this case, the corresponding kibana/tags/*.json are not deleted from local filesystem
  • Export dashboard without any tag
  • Export dashboard with other tags

How to test this PR locally

Tested with these packages:

In a package folder run these commands:

cd /path/to/package

elastic-package build -v

# if needed set a specific version (.e.g --version 8.7.0-SNAPSHOT)
elastic-package stack up -v -d

elastic-package install -v

elastic-package export dashboards -id <dashboard_id>
# elastic-package export dashboards -id apache-Logs-Apache-Dashboard
# elastic-package export dashboards -id elastic_package_registry-313c2700-099b-11ed-91b6-3b1f9c2b2771

# check changes in kibana resources
git diff kibana/

# check also untracked files in kibana/tags/ folder
git status

Caveats

  • If tags were previously committed to the repository, they are not deleted.
    • Those tags could be used in other dashboards, so they are not deleted to avoid breaking them.
  • Developers should remove those tag files in (kibana/tags/*.json) manually if possible.

@mrodm mrodm self-assigned this Apr 4, 2023
@mrodm
Copy link
Copy Markdown
Contributor Author

mrodm commented Apr 4, 2023

/test

@mrodm mrodm force-pushed the remove_fleet_managed_tags branch from ff2525c to 109cd1d Compare April 5, 2023 09:28
@mrodm mrodm marked this pull request as ready for review April 5, 2023 10:06
@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @mrodm

@mrodm mrodm requested a review from a team April 5, 2023 12:04
Copy link
Copy Markdown
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

export dashboard should strip tags created by Fleet

3 participants