Commit Graph

1692 Commits

Author SHA1 Message Date
Roberto Tyley
bc95d68e4a feat: Enable use of latest: in .tool-versions files
This change enables `asdf`'s existing latest-version-resolution
functionality within the `.tool-versions` file itself. Rather than
having to have a `.tool-versions` file that contains a full version
number:

```
java corretto-21.0.5.11.1
```

...you can now use the same `latest:` syntax that is already available
in the `local` & `global` commands, ie:

```
java latest:corretto-21
```

### Use case

For many tool/runtime ecosystems (eg Java), if a program runs correctly under
a specific version of that runtime, it can generally be relied on to run
correctly under any _later_ version of that runtime with the same major version
number (eg if a project runs under Corretto Java 21.0.5.11.1, it will run on
any _later_ version of Corretto Java 21).

This means that for projects in those ecosystems, there is little incentive
to pin to fully-specified versions like `21.0.5.11.1`, and in fact there are
downsides - over time, developers will default to using older, unpatched versions
of Java, unless they are assiduous in continually updating the contents of
the `.tool-versions` file, or have tooling devoted to doing so.

At the Guardian we have several hundred projects that run on the Java platform,
and due to our security obligations we generally want to be running under the
_latest_ security-patched version of the Java runtime that matches our
major-version requirement. We love `asdf` as a tool, and like that the
`.tool-versions` file can become a source-of-truth documenting which version
of Java a project uses, but we don't want to have to commit fully-specified
version numbers like `21.0.5.11.1` to source control, or set up tooling to
increment those version numbers across those hundreds of repositories.

Allowing the use of `latest:` in the `.tool-versions` file means that we
don't need to continually update those `.tool-versions` files. It also
partially addresses some of the needs raised by https://github.com/asdf-vm/asdf/issues/1736,
though this solution uses the existing `asdf` version-resolution functionality,
rather than adopting the version requirements system used in nodejs.

### Implementation

A new `resolve_version_spec()` function has been extracted from the
existing `version_command()` function. This takes a version-spec string,
like `latest:corretto-11` or `corretto-21.0.5.11.1`, and resolves it to
a precise version number.

This new `resolve_version_spec()` function is now also called in
`select_version()`, used by `with_shim_executable()`, meaning that any
execution of the `asdf` shim (eg, executing `java`) will now resolve
any version specifications found in the `.tool-versions` file - if
`.tool-versions` contains `java latest:corretto-21`, this will be
resolved and the latest version of Java 21 used.

## Other Information

Previous `asdf` PRs relating to `latest`:

* https://github.com/asdf-vm/asdf/pull/575 in November 2019: added the `latest`
  command, eg `asdf latest python 3.6` reports the latest version of Python 3.6.
* https://github.com/asdf-vm/asdf/pull/633 in July 2021: made it possible
  to specify `latest` when using the `local` & `global` commands, eg:
  `asdf local python latest:3.7` - this would save a precise version number
  to `.tools-versions`, which is undesired behaviour for us at the Guardian.

A couple of Guardian systems attempting to standardise on using `.tool-versions`
as a source of truth:

* https://github.com/guardian/gha-scala-library-release-workflow/pull/36
* https://github.com/guardian/setup-scala
2024-10-22 10:39:44 +01:00
dependabot[bot]
c5116dca60
chore(deps): bump dorny/paths-filter from 2 to 3 (#1718) 2024-10-07 13:57:17 +00:00
dependabot[bot]
5de3a8d17c
chore(deps): bump actions/cache from 3 to 4 (#1712) 2024-10-07 13:53:34 +00:00
dependabot[bot]
928365d52e
chore(deps-dev): bump the docs group across 1 directory with 3 updates (#1786)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James Hegedus <jthegedus@hey.com>
2024-10-08 00:51:50 +11:00
dependabot[bot]
3951f31cd5
chore(deps): bump amannn/action-semantic-pull-request from 5.4.0 to 5.5.3 (#1788)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-08 00:49:53 +11:00
github-actions[bot]
f00f759f3d
chore(master): release 0.14.1 (#1773)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-19 11:18:33 -04:00
Ben Blank
44f3efb63b
fix: Only display the "can't keep downloads" warning when asked to keep downloads (#1756) 2024-08-15 10:08:49 -04:00
github-actions[bot]
ccdd47df9b
chore(master): release 0.14.0 (#1641)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-01-19 19:43:39 +11:00
Edwin Kofler
b8ecf71d77
test(fish): Improve test isolation (#1708) 2024-01-19 19:38:06 +11:00
Bas Kok
53276973f7
fix(fish): use PATH instead of fish_user_paths (#1709) 2024-01-18 12:27:09 +11:00
Edwin Kofler
3b8f400c3e
fix(nushell): Use def --env instead of def-env (#1681) 2024-01-13 16:55:07 +11:00
mattyo161
b6b8074914
perf: only create dirs if they do not already exist (#1566)
Co-authored-by: Matt Ouellette <mouellette@cainc.com>
2024-01-11 00:10:30 +11:00
Ryo TAGAMI
2b9bec7710
docs: add Japanese translation (#1667)
Co-authored-by: kodaka <1562923+kodaka@users.noreply.github.com>
2024-01-10 23:45:57 +11:00
Bas Kok
0ffee7224b
fix: use universal scope for fish_user_paths (#1699)
Co-authored-by: James Hegedus <jthegedus@hey.com>
2024-01-10 23:25:11 +11:00
Edwin Kofler
19515eda3b
fix: warn if plugin does not support keeping downloads if configured (#1644) 2024-01-10 00:06:35 +11:00
Antonio Ognio
240a5fbdea
fix: list asdf version command under help.txt UTILS section (#1673) 2024-01-09 23:57:25 +11:00
dependabot[bot]
9265b87e0a
chore(deps): bump actions/setup-python from 4 to 5 (#1695)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-09 23:51:13 +11:00
Javier Garea
6d8cf9d44b
fix: plugin test git-ref to use plugin repo default branch (#1694)
Co-authored-by: James Hegedus <jthegedus@hey.com>
2024-01-09 23:47:27 +11:00
Edwin Kofler
d7e0740461
refactor: prefer grep --quiet over standard output redirection (#1655) 2024-01-09 23:39:18 +11:00
Edwin Kofler
dfea89ccc7
fix: avoid mention of ASDF_NU_DIR (#1660) 2024-01-09 23:25:30 +11:00
Edwin Kofler
9591a0ed79
ci: update Fish version in test dependencies (#1705) 2024-01-09 22:53:09 +11:00
kodaka
fad23bc9f4
docs: fix typo "node version" filename (#1679) 2023-11-16 10:17:18 +11:00
Edwin Kofler
8fbf9a396b
docs: Improve .asdfrc plugin hook docuentation (#1661) 2023-11-09 11:25:04 +11:00
Peter Bittner
5737fa316e
docs: fix typo (#1670) 2023-11-09 10:48:54 +11:00
dependabot[bot]
7c0d7766da
chore(deps-dev): bump the docs group in /docs with 2 updates (#1671) 2023-11-08 15:20:19 +00:00
dependabot[bot]
75626293d3
chore(deps): bump amannn/action-semantic-pull-request from 5.2.0 to 5.4.0 (#1676) 2023-11-08 14:45:01 +00:00
dependabot[bot]
37e0ddaf78
chore(deps): bump actions/setup-node from 3 to 4 (#1669) 2023-11-08 14:44:33 +00:00
dependabot[bot]
66ebc56ec3
chore(deps): bump asdf-vm/actions from 2 to 3 (#1664) 2023-11-08 14:44:11 +00:00
dependabot[bot]
fce6c534da
chore(deps-dev): bump the docs group in /docs with 2 updates (#1659) 2023-10-08 23:06:10 +00:00
Edwin Kofler
4085e5542b
fix!: Enable pipefail (#1608) 2023-09-17 21:52:39 +10:00
Edwin Kofler
61420ad908
fix: plugin extension commands to not require bin/ directory (#1643) 2023-09-17 21:50:47 +10:00
James Hegedus
b45f1dc9d7
ci: remove semantic release single-commit rule (#1642) 2023-09-15 01:04:34 +10:00
Lucas Grigolon Varela
0c7c41ab44
docs: fix some pt-br spelling (#1640) 2023-09-15 00:50:51 +10:00
github-actions[bot]
0586b37d03
chore(master): release 0.13.1 (#1638)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-09-13 17:51:22 +10:00
Yuri Pieters
5ac30328a7
fix(fish): use builtin realpath over system one (#1637)
Co-authored-by: Yuri Pieters <yuri.pieters@anaplan.com>
2023-09-13 00:29:07 +10:00
github-actions[bot]
43ca61af4e
chore(master): release 0.13.0 (#1580)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-09-12 00:16:14 +10:00
dependabot[bot]
ef2bb7dd8e
chore(deps): bump crazy-max/ghaction-github-pages from 3 to 4 (#1635) 2023-09-11 14:08:07 +00:00
James Hegedus
446f8c5f94 docs: upgrade deps & fix breaking changes 2023-09-11 23:43:43 +10:00
Lorenz Kitzmann
0ddab5dfaf
fix: nushell language syntax update (#1624)
Co-authored-by: James Hegedus <jthegedus@hey.com>
2023-09-11 21:02:46 +10:00
James Hegedus
c18b60fcd9
ci: use dependabot groups for docs/ dependency PRs (#1634) 2023-09-11 01:30:08 +10:00
Edvard
36c7024baa
feat: add plugin location when update the plugin (#1602) 2023-09-11 00:43:39 +10:00
Kurochan
4d5f22ddb8
fix: set default shell version values on POSIX entrypoint (#1594)
Co-authored-by: James Hegedus <jthegedus@hey.com>
2023-09-11 00:42:55 +10:00
Edwin Kofler
2043a09574
fix: warn when any ./lib/commands are marked as executable (#1593) 2023-09-11 00:36:39 +10:00
Edwin Kofler
b320803120
fix: improve lint and test scripts (#1607) 2023-09-11 00:34:50 +10:00
dependabot[bot]
0e1c90e177
chore(deps): bump actions/checkout from 3 to 4 (#1628)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 00:26:05 +10:00
dependabot[bot]
a2cb3055e0
chore(deps-dev): bump @types/node from 20.3.3 to 20.5.7 in /docs (#1627) 2023-09-10 14:17:08 +00:00
Edwin Kofler
e83d71e43f
fix: Make asdf.fish compatible with Fish 3.1.2 (#1590) 2023-08-14 17:34:51 +01:00
Edwin Kofler
624604a862
fix: no longer write temporary files to home directory (#1592) 2023-07-26 21:57:06 +10:00
Edwin Kofler
299dc97a5b
docs: bin/latest-stable empty query is set to default (#1591) 2023-07-26 21:55:46 +10:00
Edwin Kofler
a029c00750
fix!: plugin list exit code 0 when no plugins are installed (#1597) 2023-07-26 21:51:54 +10:00