Skip to content

Conversation

thecoop
Copy link
Member

@thecoop thecoop commented Dec 20, 2023

Add a ReleaseVersions class to map between ids and release versions in error messages/logs, and gradle tasks to extract current version information and apply it to the version records in the repo

@thecoop thecoop added >feature WIP :Core/Infra/Core Core issues without another label labels Dec 20, 2023
@thecoop thecoop requested a review from a team as a code owner December 20, 2023 14:51
@thecoop thecoop changed the title Add class to map between version ids and release versions Add and modify mappings between version ids and release versions Dec 21, 2023
import javax.annotation.Nullable;
import javax.inject.Inject;

public class TagVersionsTask extends DefaultTask {
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I missing something? I don't see where this task is actually used/created.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this needs corresponding changes in release-tools (this PR is still WIP)

Copy link
Member Author

Choose a reason for hiding this comment

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

I've created a PR for the release tools to use these new tasks

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

This will be a nice addition to give users back versions they know about! I have a few thoughts.

}

public static String findReleaseVersion(Class<?> versionContainer, int id) {
if (USES_VERSIONS == false) return Integer.toString(id);
Copy link
Member

Choose a reason for hiding this comment

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

I think this means in serverless we would print the raw id. Is that what we want? The id is just as useless to a user there. Are we assuming a serverless user should never hit an error that would need to print the release version since it is kept up to date?

Copy link
Member Author

@thecoop thecoop Jan 10, 2024

Choose a reason for hiding this comment

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

This is mostly aimed at log messages - where transport/index versions do have meaning in serverless. If we ever need to print out anything for serverless, it should be the raw id, not the release version.


@Override
public void accept(FieldDeclaration fieldDeclaration) {
var ints = fieldDeclaration.findAll(IntegerLiteralExpr.class);
Copy link
Member

Choose a reason for hiding this comment

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

This seems fragile, wouldn't any other integer literal get caught up by this?

Copy link
Member Author

Choose a reason for hiding this comment

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

we do only have single int initializers in version classes. And it ignores those that have multiple ints in the initializer.

@thecoop thecoop requested a review from rjernst January 10, 2024 10:55
@thecoop thecoop removed the WIP label Jan 15, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Jan 15, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine
Copy link
Collaborator

Hi @thecoop, I've created a changelog YAML for you.

@thecoop thecoop added the WIP label Jan 15, 2024
@elasticsearchmachine
Copy link
Collaborator

Hi @thecoop, I've created a changelog YAML for you.

@thecoop thecoop requested a review from mark-vieira January 16, 2024 15:29
@thecoop thecoop requested a review from mark-vieira January 17, 2024 10:08
@thecoop
Copy link
Member Author

thecoop commented Jan 17, 2024

@elasticmachine update branch

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

Looks good, a couple last thoughts, and Mark's comment on write options should be addressed as well.

Copy link
Contributor

@ldematte ldematte left a comment

Choose a reason for hiding this comment

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

I like it, and with the helpers in the XxxVersions classes it will be easy to use too.
I'm wondering if we should have something similar for features too - probably worth a separate discussion (and definitely a separate PR in case).

@thecoop thecoop merged commit a11812e into elastic:main Jan 22, 2024
@thecoop thecoop deleted the version-records branch January 22, 2024 12:01
@thecoop thecoop removed the v8.12.1 label Jan 24, 2024
thecoop added a commit that referenced this pull request Jan 29, 2024
… release tag build infrastructure. (#104702)

Backport the extract versions task from  #103627, along with the dummy tagVersions task from #104532
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Feb 9, 2024
`ReleaseVersions` does some nontrivial initialization. It shouldn't
fail, but if it does then it should do so early in startup rather than
waiting until the class is first used, which may be in a context in
which failure is undesirable. This commit adds it to the list of classes
that are initialized even before the security manager is installed.

Relates elastic#103627
DaveCTurner added a commit that referenced this pull request Feb 15, 2024
`ReleaseVersions` does some nontrivial initialization. It shouldn't
fail, but if it does then it should do so early in startup rather than
waiting until the class is first used, which may be in a context in
which failure is undesirable. This commit adds it to the list of classes
that are initialized even before the security manager is installed.

Relates #103627
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >feature Team:Core/Infra Meta label for core/infra team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants