-
Notifications
You must be signed in to change notification settings - Fork 127
Show error if assets are being exported using a Elastic stack SNAPSHOT version #986
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
Conversation
…ersions Export dashboards from Elastic stack SNAPSHOT verions is discouraged. Added new parameter "export dashboards --allow-snapshots" command, to allow exporting those dashboards or it will show an error. Version information is now retrieved from /api/status endpoint that also includes information about whether or not is a snapshot build (build_snapshot field).
🌐 Coverage report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 some nitpicking in the error messages.
internal/kibana/status.go
Outdated
| } | ||
|
|
||
| // Version method returns the version of Kibana (Elastic stack) | ||
| func (c *Client) Version() (string, bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version method from internal/kibana/injected_metadata.go deleted in favor of this one.
This new method uses the /api/status endpoint, and it has a dedicated field to indicate whether or not the version is a snapshot one (build_snapshot).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wdyt about returning an object with the version information instead of multiple values?
| func (c *Client) Version() (string, bool, error) { | |
| func (c *Client) Version() (VersionInfo, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! Added that new object.
Co-authored-by: Jaime Soriano Pastor <jaime.soriano@elastic.co>
internal/kibana/status.go
Outdated
| stackVersion := status.Version.Number | ||
| if status.Version.BuildSnapshot { | ||
| stackVersion = fmt.Sprintf("%s%s", stackVersion, SNAPSHOT_SUFFIX) | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API returns the version without -SNAPSHOT. https://github.com/elastic/kibana/blob/main/packages/core/status/core-status-server-internal/src/routes/status.ts#L120-L123
That's why it is needed to be added here.
Example of output (Elastic stack 7.17.0-SNAPSHOT):
$ curl -u elastic:changeme -H 'Content-Type: application/json' -H 'kbn-xsrf: true' -k -s https://localhost:5601/api/status | jq -r .version
{
"number": "7.17.0",
"build_hash": "0ab325e4b36168a264907fbc84f6913519671acf",
"build_number": 46537,
"build_snapshot": true
}
Closes elastic/package-spec#318
This PR shows an error when assets are exported from an Elastic stack SNAPSHOT version. Using those assets generated by a snapshot version may lead to use features that are not released at the end, or maybe they are in a different way.
In case developers need to use an SNAPSHOT version, a new parameter has been added
--allow-snapshotsto allow this export process.Output using SNAPSHOT Version:
elastic-package export dashboards:elastic-package export dashboards --allow-snapshot:Tested with 8.0.0, 8.4.0-SNAPSHOT and 7.17.6 and 7.17.0-SNAPSHOT versions.
In this PR, the
/api/statusendpoint is being tested to retrieve the version information. This includes a dedicated field about whether or not this is a snapshot build (build_snapshotfield).elastic-package stack up -v -d --version 8.0.0:elastic-package stack up -v -d --version 8.4.0-SNAPSHOT:In case of build_snapshot true , it must be added the suffix "-SNAPSHOT" to the version.number field.