Skip to content

Fix IT tests after version bumps #15827

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
merged 4 commits into from
Jan 23, 2024

Conversation

dliappis
Copy link
Contributor

@dliappis dliappis commented Jan 22, 2024

Release notes

[rn:skip]

What does this PR do?

This commit fixes IT failures that frequently occur after version bumps due to missing unified release snapshot builds for the new version.

This commit uses project specific DRA snapshot URLs for ES and Filebeat
in all cases apart from release builds.

Why is it important/What is the impact to the user?

This is a very important to fix as several pipelines (PR, exhaustive, JDK matrix, aarch64) run IT tests as a prerequisite and produce unnecessary failures shortly
after version bumps, possibly blinding us from genuine issues.

How to test this PR locally

See CI from backporting this PR to 8.12:

and compare to https://buildkite.com/elastic/logstash-exhaustive-tests-pipeline/builds/126#018d31b4-8da9-4dbf-b43e-217f2a4f7518/46-469 showing current failures on the 8.12 branch

Related issues

@dliappis dliappis added the ci label Jan 22, 2024
@dliappis dliappis self-assigned this Jan 22, 2024
@dliappis dliappis force-pushed the fix-it-tests-after-version-bumps branch from 5eedf52 to 23aeb32 Compare January 22, 2024 17:11
This commit fixes IT failures that frequently occur after
version bumps due to missing unified release snapshot builds for
the new version.

This commit uses project specific DRA snapshot URLs for ES and Filebeat
in all cases apart from release builds.

Closes elastic#2825
@dliappis dliappis force-pushed the fix-it-tests-after-version-bumps branch from 23aeb32 to fff8ec5 Compare January 22, 2024 17:52
@dliappis dliappis requested a review from andsel January 22, 2024 19:10
Copy link
Contributor

@andsel andsel left a comment

Choose a reason for hiding this comment

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

Left a couple of suggestions.
Given that the code in 2 tasks downloadFilebeat and downloadEs are becoming more and more complex, and essentially identical, I was wonder if we can share the same code in some way, static function or something else.
The most complex is to create custom task and add those to the tooling, but that could be a follow up PR or issue to create to clean up the things a little bit.

build.gradle Outdated
@@ -180,6 +181,11 @@ tasks.register("configureArtifactInfo") {
def dlVersions = new JsonSlurper().parseText(apiResponse)
String qualifiedVersion = dlVersions['versions'].grep(isReleaseBuild ? ~/^${version}$/ : ~/^${version}-SNAPSHOT/)[0]
if (qualifiedVersion == null) {
if (isReleaseBuild == false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (isReleaseBuild == false) {
if (!isReleaseBuild) {

isReleaseBuild is a boolean so no need to use == false to force any Groovy magic. I think that at this point we can also change the definition of isReleaseBuild to make the type more explicit:

boolean isReleaseBuild = System.getenv('RELEASE') == "1" || versionQualifier

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix (both comments) in b9edfe4

build.gradle Outdated
Comment on lines 450 to 451
}
else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}
else {
} else {

Just a note on indentation. Applies also to all other newly added ifs

Copy link
Contributor Author

@dliappis dliappis Jan 23, 2024

Choose a reason for hiding this comment

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

Fixed in ab38677

String packageShaUrl = packageArtifactUrls["projects"]["${project}"]["packages"]["${downloadedPackageName}.tar.gz"]["sha_url"]

return [packageUrl, packageShaUrl]

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

String packageUrl = packageArtifactUrls["projects"]["${project}"]["packages"]["${downloadedPackageName}.tar.gz"]["url"]
String packageShaUrl = packageArtifactUrls["projects"]["${project}"]["packages"]["${downloadedPackageName}.tar.gz"]["sha_url"]

return [packageUrl, packageShaUrl]
Copy link
Contributor

Choose a reason for hiding this comment

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

I would go with a more self explanatory data structure. The clients of this method has to know what to find in first and second positions. I would with something more structured, so that the data can be accessed like:

res.packageUrl
res.packageShaUrl

instead of

res[0]
res[1]

in order of complexity you can choose:

return ["packageUrl": packageUrl, "packageShaUrl":packageShaUrl]
return new Expando(packageUrl: packageUrl, packageShaUrl: packageShaUrl)
  • plain old POJO, declaring a class with the 2 fields (they can be public final because are read only, without pedant getters)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! I used the groovy-maps in 56d5b42

@dliappis dliappis requested a review from andsel January 23, 2024 12:06
@dliappis
Copy link
Contributor Author

@andsel

Left a couple of suggestions.

Thank you, they were very helpful! I've addressed them no, I'd appreciate if you'd take another look when possible.

Given that the code in 2 tasks downloadFilebeat and downloadEs are becoming more and more complex, and essentially identical, I was wonder if we can share the same code in some way, static function or something else.
The most complex is to create custom task and add those to the tooling, but that could be a follow up PR or issue to create to clean up the things a little bit.

Agreed and got the same feeling. I wanted to stop the bleeding of failures with this one as soon as possible hence didn't proceed to larger refactorings in the interest of time. I will start by filing an issue for the follow up work.

Copy link

Quality Gate passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No Coverage information No data about Coverage
No Duplication information No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @dliappis

Copy link
Contributor

@andsel andsel left a comment

Choose a reason for hiding this comment

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

LGTM

@dliappis dliappis merged commit d74fea4 into elastic:main Jan 23, 2024
@dliappis
Copy link
Contributor Author

@logstashmachine backport 8.12

@dliappis
Copy link
Contributor Author

@logstashmachine backport 7.17

github-actions bot pushed a commit that referenced this pull request Jan 23, 2024
This commit fixes IT failures that frequently occur after
version bumps due to missing unified release snapshot builds for
the new version.

This commit uses project specific DRA snapshot URLs for ES and Filebeat
in all cases apart from release builds.

Closes #2825

(cherry picked from commit d74fea4)
dliappis added a commit to dliappis/logstash that referenced this pull request Jan 23, 2024
This commit fixes IT failures that frequently occur after
version bumps due to missing unified release snapshot builds for
the new version.

This commit uses project specific DRA snapshot URLs for ES and Filebeat
in all cases apart from release builds.

(cherry picked from commit d74fea4)

Co-authored-by: Dimitrios Liappis <[email protected]>
dliappis added a commit that referenced this pull request Jan 23, 2024
This commit fixes IT failures that frequently occur after
version bumps due to missing unified release snapshot builds for
the new version.

This commit uses project specific DRA snapshot URLs for ES and Filebeat
in all cases apart from release builds.

Closes #2825

(cherry picked from commit d74fea4)

Co-authored-by: Dimitrios Liappis <[email protected]>
dliappis added a commit that referenced this pull request Jan 23, 2024
This commit fixes IT failures that frequently occur after
version bumps due to missing unified release snapshot builds for
the new version.

This commit uses project specific DRA snapshot URLs for ES and Filebeat
in all cases apart from release builds.

(cherry picked from commit d74fea4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants