-
Notifications
You must be signed in to change notification settings - Fork 556
[CI] Remove workaround test stack 9 packages in daily CI jobs #13491
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
Merged
mrodm
merged 7 commits into
elastic:main
from
mrodm:remove-workaround-test-stack-9-packages
Apr 11, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
af40c00
Remove workaround to test packages in 9.x stack
mrodm 9c719b8
Test with stack 9.1.0-SNAPSHOT
mrodm 3658a55
Move kibana version and stack supported functions to mage
mrodm 41edc7c
Test with 8.19.0-SNAPSHOT
mrodm 053d0d3
Test with 7.17.28
mrodm 4e0ecba
Remove changes for debugging
mrodm d20b017
Merge upstream/main into remove-workaround-test-stack-9-packages
mrodm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| // or more contributor license agreements. Licensed under the Elastic License; | ||
| // you may not use this file except in compliance with the Elastic License. | ||
|
|
||
| package citools | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "strings" | ||
|
|
||
| "github.com/Masterminds/semver/v3" | ||
| ) | ||
|
|
||
| func KibanaConstraintPackage(path string) (*semver.Constraints, error) { | ||
| manifest, err := readPackageManifest(path) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to read package manifest: %w", err) | ||
| } | ||
|
|
||
| kibanaVersion := manifest.Conditions.Kibana.Version | ||
| if kibanaVersion == "" { | ||
| return nil, nil | ||
| } | ||
|
|
||
| constraint, err := semver.NewConstraint(kibanaVersion) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to parse kibana constraint: %w", err) | ||
| } | ||
| return constraint, nil | ||
| } | ||
|
|
||
| func IsPackageSupportedInStackVersion(stackVersion string, path string) (bool, error) { | ||
| stackVersion = strings.TrimSuffix(stackVersion, "-SNAPSHOT") | ||
|
|
||
| stackSemVersion, err := semver.NewVersion(stackVersion) | ||
| if err != nil { | ||
| return false, fmt.Errorf("failed to parse stack version: %w", err) | ||
| } | ||
|
|
||
| packageConstraint, err := KibanaConstraintPackage(path) | ||
| if err != nil { | ||
| return false, err | ||
| } | ||
|
|
||
| if packageConstraint == nil { | ||
| return true, nil | ||
| } | ||
|
|
||
| return packageConstraint.Check(stackSemVersion), nil | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| // Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| // or more contributor license agreements. Licensed under the Elastic License; | ||
| // you may not use this file except in compliance with the Elastic License. | ||
|
|
||
| package citools | ||
|
|
||
| import ( | ||
| "os" | ||
| "path/filepath" | ||
| "testing" | ||
|
|
||
| "github.com/Masterminds/semver/v3" | ||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestKibanaConstraintPackage(t *testing.T) { | ||
| constraintTest, err := semver.NewConstraint("^8.0.0") | ||
| require.NoError(t, err) | ||
|
|
||
| cases := []struct { | ||
| title string | ||
| contents string | ||
| expected *semver.Constraints | ||
| }{ | ||
| { | ||
| title: "kibana constrasint defined", | ||
| contents: `name: "version" | ||
| conditions: | ||
| kibana: | ||
| version: "^8.0.0" | ||
| `, | ||
| expected: constraintTest, | ||
| }, | ||
| { | ||
| title: "kibana constraint defined with dotted field", | ||
| contents: `name: "version" | ||
| conditions: | ||
| kibana.version: "^8.0.0" | ||
| `, | ||
| expected: constraintTest, | ||
| }, | ||
| { | ||
| title: "kibana constraint not defined", | ||
| contents: `name: "version" | ||
| `, | ||
| expected: nil, | ||
| }, | ||
| } | ||
|
|
||
| for _, c := range cases { | ||
| t.Run(c.title, func(t *testing.T) { | ||
| directory := t.TempDir() | ||
| pkgManifestPath := filepath.Join(directory, "manifest.yml") | ||
| err := os.WriteFile(pkgManifestPath, []byte(c.contents), 0o644) | ||
| require.NoError(t, err) | ||
| constraint, err := KibanaConstraintPackage(pkgManifestPath) | ||
| require.NoError(t, err) | ||
| assert.Equal(t, c.expected, constraint) | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestIsPackageSupportedInStackVersion(t *testing.T) { | ||
| cases := []struct { | ||
| title string | ||
| contents string | ||
| stackVersion string | ||
| supported bool | ||
| }{ | ||
| { | ||
| title: "Test simple kibana constraint", | ||
| stackVersion: "8.18.0", | ||
| contents: `name: "stack" | ||
| conditions: | ||
| kibana: | ||
| version: "^8.0.0" | ||
| `, | ||
| supported: true, | ||
| }, | ||
| { | ||
| title: "Test or condition", | ||
| stackVersion: "8.18.0", | ||
| contents: `name: "stack" | ||
| conditions: | ||
| kibana: | ||
| version: "^8.0.0 || ^9.0.0" | ||
| `, | ||
| supported: true, | ||
| }, | ||
| { | ||
| title: "Test snapshot", | ||
| stackVersion: "8.18.0-SNAPSHOT", | ||
| contents: `name: "stack" | ||
| conditions: | ||
| kibana: | ||
| version: "^8.0.0 || ^9.0.0" | ||
| `, | ||
| supported: true, | ||
| }, | ||
| { | ||
| title: "Test greater or equal", | ||
| stackVersion: "8.18.0-SNAPSHOT", | ||
| contents: `name: "stack" | ||
| conditions: | ||
| kibana: | ||
| version: ">=8.0.0" | ||
| `, | ||
| supported: true, | ||
| }, | ||
| { | ||
| title: "Test not supported", | ||
| stackVersion: "8.18.0-SNAPSHOT", | ||
| contents: `name: "stack" | ||
| conditions: | ||
| kibana: | ||
| version: "^9.0.0" | ||
| `, | ||
| supported: false, | ||
| }, | ||
| { | ||
| title: "Test missing kibana version", | ||
| stackVersion: "8.18.0-SNAPSHOT", | ||
| contents: `name: "stack" | ||
| `, | ||
| supported: true, | ||
| }, | ||
| } | ||
|
|
||
| for _, c := range cases { | ||
| t.Run(c.title, func(t *testing.T) { | ||
| directory := t.TempDir() | ||
| pkgManifestPath := filepath.Join(directory, "manifest.yml") | ||
| err := os.WriteFile(pkgManifestPath, []byte(c.contents), 0o644) | ||
| require.NoError(t, err) | ||
| supported, err := IsPackageSupportedInStackVersion(c.stackVersion, pkgManifestPath) | ||
| require.NoError(t, err) | ||
| assert.Equal(t, c.supported, supported) | ||
| }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
As there are already 317 packages out of 330 packages (at the moment of creating this PR), it looks like this workaround could be removed.
The packages that would not be tested in the daily jobs for 9.1.0-SNAPSHOT are listed in the PR description.
WDYT @elastic/ecosystem ?
Uh oh!
There was an error while loading. Please reload this page.
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.
The problem of applying this PR now is there are some packages that had failed tests in 9.1.0-SNAPSHOT:
If we merge this PR, should we close those issues ?
juniper_junos and juniper_network are deprecated and they have some comments that they are not going to be fixed, so I think they could be closed.
So what should we do with the
enteprisesearchissues if this PR is merged?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.
Yes, maybe these packages are not intended to ever work in 9.x.
@elastic/stack-monitoring is the
enterprisesearchpackage intended to be supported in 9.x? Its constraints haven't been updated.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.
@jsoriano Due to the Enterprise Search deprecation, it won't be available in Stack 9, which is why the constraints haven't been updated, i.e. there won't be an Enterprise Search 9 server to monitor
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.
Ah, that's right, you already mentioned it in an internal comment. Thanks for the confirmation!
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.
Perfect, so then I think those related issues can be closed after merging this PR.
Thanks!