mirror of
https://github.com/azure/setup-kubectl.git
synced 2026-12-06 20:21:52 +00:00
feat: add version-file input to read kubectl version from .tool-versions (#261)
* feat: add version-file input to read kubectl version from .tool-versions Adds a `version-file` input that reads the kubectl version from an asdf/mise `.tool-versions` file. A specific `version` input takes precedence (with a warning); the default `latest` lets the file decide. Values from the file go through the same latest / major.minor / major.minor.patch resolution and validation as the `version` input. The file must be a regular, non-symlinked file of at most 64 KiB. Closes #259 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix: address version-file review feedback - Report a missing version-file with a clear error instead of a raw ENOENT - Document that the first kubectl entry wins, and the regular-file / 64 KiB limits - Assert that an explicit version skips reading the version-file entirely Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,30 @@ Acceptable values are latest or any semantic version string like `v1.15.0`. Use
|
||||
id: install
|
||||
```
|
||||
|
||||
Alternatively, read the kubectl version from an
|
||||
[asdf/mise `.tool-versions` file](https://asdf-vm.com/manage/configuration.html):
|
||||
|
||||
```yaml
|
||||
- uses: azure/setup-kubectl@v5
|
||||
with:
|
||||
version-file: '.tool-versions'
|
||||
id: install
|
||||
```
|
||||
|
||||
The kubectl entry may use `major.minor`, `major.minor.patch`, an optional `v`
|
||||
prefix, or `latest`:
|
||||
|
||||
```text
|
||||
kubectl 1.31.2
|
||||
```
|
||||
|
||||
If the file contains several `kubectl` entries, the first one is used. The file
|
||||
must be a regular file (not a symbolic link) of at most 64 KiB.
|
||||
|
||||
When both inputs are set, a specific `version` other than `latest` takes
|
||||
precedence and the action emits a warning. The default `version: latest` allows
|
||||
`version-file` to select the version.
|
||||
|
||||
Refer to the action metadata file for details about all the inputs https://github.com/Azure/setup-kubectl/blob/main/action.yml
|
||||
|
||||
# Contributing
|
||||
|
||||
Reference in New Issue
Block a user