Skip to content

Add 'latest' as alias for version 'x'#53

Closed
plamentotev wants to merge 2 commits into
actions:masterfrom
plamentotev:add-latest-version
Closed

Add 'latest' as alias for version 'x'#53
plamentotev wants to merge 2 commits into
actions:masterfrom
plamentotev:add-latest-version

Conversation

@plamentotev

@plamentotev plamentotev commented Apr 12, 2020

Copy link
Copy Markdown

With the new release cycle a new JDK version is released once every six months. It may not seems like that often, but still adds overhead to update the build matrix with the latest JDK version. It is more convenient to set the build to run on the LTS versions that the project supports plus the latest JDK version. I've created a proof of concept workflow [1].

While it is possible to specify that you want the latest JDK version by using semver X-Ranges (like 'x' for example), 'latest' is more readable as explicitly states the intention. Also if you use the value from the build matrix in your job name, "JDK:latest" is better than "JDK:x".

[1] The workflow uses my change as asked by the contributors guide

While it is possible to specify that you want the latest JDK version
by using semver X-Ranges (like 'x' for example), 'latest' is more
readable as explicitly states the intention.
@plamentotev

plamentotev commented Apr 12, 2020

Copy link
Copy Markdown
Author

To be honest I'm not quite sure if the tools cache plays well with x as version (or any other semver range for that matter. e.g >=13.0.1)

@giltene

giltene commented Apr 12, 2020

Copy link
Copy Markdown
Contributor

To be honest I'm not quite sure if the tools cache plays well with x as version (or any other semver range for that matter. e.g >=13.0.1)

Since the semver version parsing is done directly on the CDN contents, the caching (outside of the CDN itself) is not a significant issue. My experience has been that things we put in the CDN show up in .x version results fairly quickly (the longest I've seen had been about 30 minutes).

@giltene

giltene commented Apr 12, 2020

Copy link
Copy Markdown
Contributor

+1 for this. It took me a while to understand what it is for (since x technically works), but since the string we use to specify the version in a matrix is then typically used in the job name, I agree that seeing "Java latest" as a job name is much more readable than "Java x".

@plamentotev

Copy link
Copy Markdown
Author

Actually I did some tests. If 'x' is specified the version in the tools cache is used. But if 'latest' is specified the version in tools cache is not found as tc.find is not aware of the alias. I wonder if we should first normalize the version and then search in the tool cache. I'll check how it works with 1.x and -ea versions.

@plamentotev

Copy link
Copy Markdown
Author

Yes, it does not work for 1.8 as well. I'll open an issue and provide PR.

@maxim-lobanov

Copy link
Copy Markdown
Contributor

Hello @plamentotev , if it is still actual for you - we don't have objections to accept this PR.
But it will require pulling latest main, we have recently released V2 so your changes should be adopted for it: https://github.com/actions/setup-java/blob/main/src/distributions/base-installer.ts#L120

@plamentotev

Copy link
Copy Markdown
Author

I think I found a better way to achieve the same so I'll close it.

@plamentotev plamentotev closed this May 3, 2021
@plamentotev plamentotev deleted the add-latest-version branch May 3, 2021 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants