Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tags.yml print a warning instead of failing #577

Merged
merged 6 commits into from
Sep 4, 2023

Conversation

marc-gr
Copy link
Contributor

@marc-gr marc-gr commented Aug 23, 2023

What does this PR do?

Changes validation error for Kibana version when using tags.yaml to a warning.

Why is it important?

If we want to add this file to all integrations, this would require to bump minimum kibana version for all of them.

Since having this file, even when not used, when targeting lower stack versions is not harmful, removing the error allows us to add tags.yml to all integrations. Users on stacks >= 8.10 would benefit from it automatically, and for the rest nothing would change.

Checklist

- [ ] I have added test packages to test/packages that prove my change is effective.

Related issues

@marc-gr marc-gr force-pushed the remove-tags-kibana-version-validation branch from e6904c7 to 4dae82a Compare August 23, 2023 10:30
@marc-gr marc-gr marked this pull request as ready for review August 23, 2023 10:31
@marc-gr marc-gr requested a review from a team as a code owner August 23, 2023 10:31
@marc-gr marc-gr requested a review from mrodm August 23, 2023 10:31
@marc-gr marc-gr force-pushed the remove-tags-kibana-version-validation branch from 4dae82a to a6bf34b Compare August 23, 2023 10:53
@jsoriano
Copy link
Member

Since having this file, even when not used, when targeting lower stack versions is not harmful

The problem can be, that users may want to add the saved object tags, but they would silently be ignored in older versions, and this may be unexpected. I think this was the main reason to add this check.

@marc-gr marc-gr added the discuss Issue needs discussion label Aug 23, 2023
@marc-gr
Copy link
Contributor Author

marc-gr commented Aug 23, 2023

Since having this file, even when not used, when targeting lower stack versions is not harmful

The problem can be, that users may want to add the saved object tags, but they would silently be ignored in older versions, and this may be unexpected. I think this was the main reason to add this check.

I think this was our initial assumption of how this would work based on elastic/integrations#7483. In any case it is for sure up for discussion cc @narph

@P1llus
Copy link
Member

P1llus commented Aug 23, 2023

Since having this file, even when not used, when targeting lower stack versions is not harmful

The problem can be, that users may want to add the saved object tags, but they would silently be ignored in older versions, and this may be unexpected. I think this was the main reason to add this check.

I think since the tags never existed in the old versions, and the creation of those tags is managed by fleet, they are free to create tags with the same names manually, but they should not really be deleted or taken over by fleet either way.

I was hoping to not have the version restriction, but let's see if there is any other opinions as well 👍

@mrodm
Copy link
Contributor

mrodm commented Aug 30, 2023

Since having this file, even when not used, when targeting lower stack versions is not harmful

The problem can be, that users may want to add the saved object tags, but they would silently be ignored in older versions, and this may be unexpected. I think this was the main reason to add this check.

I agree with @jsoriano . This validation was added to avoid users/developers adding those tag files (kibana/tags.yaml) targeting Kibana versions that do not support that. I think that it could be misleading for users/developers that expect to have those tags in those assets when installing the package (since those are defined in the package), but they are not going to be created by Fleet in those Kibana versions < 8.10. There will not be neither any error or warning, just ignored those tags.

@P1llus
Copy link
Member

P1llus commented Aug 31, 2023

@jsoriano @mrodm Unfortunately this one is a fairly significant blocker for us. We are planning on deploying this on every integration owned by SEI, but it would be fairly significant impact for us to bump the version on all our integrations, seeing that we cannot provide hotfixes anymore to older versions then.

These tags are also required for our UI in Serverless.
Is there nothing else that can be done? For example we could easily add a lint/check warning, checking for tags.yml and comparing it to current version in manifest.yml?
Or can we add a undocumented override that we can add somewhere, that is meant only for these niche cases? As this feature is fairly important to us, its hard to completely agree, while I do totally understand the reasoning around it.

@mrodm
Copy link
Contributor

mrodm commented Aug 31, 2023

seeing that we cannot provide hotfixes anymore to older versions then.

There is a way of doing hotfixes in-place for integrations repository, here are the docs:
https://github.com/elastic/integrations/blob/e32c0233a0bac0201ef6687b60c0624ca571d35c/docs/developer_workflow_bug_fix_older_package_version.md

An option it would be to change this to just a warning in package-spec, but this warning would be just shown while the package is built or checked using elastic-package. Just as a
note, this warning would not appear when the users install this integration.

If it is done so, probably description of this tags file should be also updated to include something similar to "They are just installed when Kibana >= 8.10". And it could be added the warning, as it was done in this validation rule to be able to test it:

func ValidateVisualizationsUsedByValue(fsys fspath.FS) ve.ValidationErrors {

Here it is the test to validate warnings:
if err := common.EnableWarningsAsErrors(); err != nil {

@jsoriano WDYT ?

@P1llus
Copy link
Member

P1llus commented Aug 31, 2023

Would be really appreciated if this could be possible! A bit unsure why the end users would be the main focus there, as there is no UI saying that these tags will be added right? Or documentation that mentions the tags are created?

@jsoriano
Copy link
Member

@jsoriano WDYT ?

Sounds good.

A bit unsure why the end users would be the main focus there, as there is no UI saying that these tags will be added right?

It would be users, package developers, support... these tags will be silently ignored on installation on older versions, what can be unexpected when the tags are actually defined in the packages. Probably not a big issue in any case to miss some tags, but unexpected.

@P1llus
Copy link
Member

P1llus commented Aug 31, 2023

@jsoriano WDYT ?

Sounds good.

A bit unsure why the end users would be the main focus there, as there is no UI saying that these tags will be added right?

It would be users, package developers, support... these tags will be silently ignored on installation on older versions, what can be unexpected when the tags are actually defined in the packages. Probably not a big issue in any case to miss some tags, but unexpected.

@jsoriano @marc-gr let's add a comment at the top of the tags.yml file explaining that these will be applied to 8.10+ users only, just to prevent users seeing our tag files and might get confused?

@mrodm
Copy link
Contributor

mrodm commented Aug 31, 2023

@jsoriano @marc-gr let's add a comment at the top of the tags.yml file explaining that these will be applied to 8.10+ users only, just to prevent users seeing our tag files and might get confused?

It would be nice to also change the errors by warnings following the example of the validation rule shown in #577 (comment)

func ValidateVisualizationsUsedByValue(fsys fspath.FS) ve.ValidationErrors {
warningsAsErrors := common.IsDefinedWarningsAsErrors()

message := fmt.Sprintf("Warning: references found in dashboard %s: %s", filePath, s)
if warningsAsErrors {
errs = append(errs, errors.New(message))
} else {
log.Printf(message)
}

That validation rule will just show a warning message when building time, but when testing package-spec (running make test in this directory) they would be raised an errors so they can be tested

@marc-gr
Copy link
Contributor Author

marc-gr commented Aug 31, 2023

I will update the PR to include that then 👍

@marc-gr marc-gr changed the title Remove kibana version validation for saved object tags Make tags.yml print a warning instead of failing Aug 31, 2023
@marc-gr marc-gr added enhancement New feature or request and removed discuss Issue needs discussion labels Aug 31, 2023
@elasticmachine
Copy link

💚 Build Succeeded

History

@marc-gr marc-gr requested a review from jsoriano August 31, 2023 13:20
Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

👍
Just as a note, packages will need to be updated to a spec version >= 2.11.0 (to be released) in order to be able to define kibana/tags.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants