Skip to content

Commit 9c54b63

Browse files
authored
Merge pull request #15 from yokawasa/v0.7.0
V0.7.0
2 parents b262ff1 + 3dd0c05 commit 9c54b63

File tree

6 files changed

+64
-18
lines changed

6 files changed

+64
-18
lines changed

CHANGELOG.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
All notable changes to the "action-setup-kube-tools" will be documented in this file.
44

5+
## v0.7.0
6+
- Add fail-fast parameter (fail-fast:true by default) that allows you to choose to fail fast immediately when it fails to download (say due to a bad version) - [#14](https://github.com/yokawasa/action-setup-kube-tools/issues/14)
7+
- Support tool version 'v' prefix. Prior to this, the action only accept the tool version without 'v' prefix, but now the action automatically add/remove the prefix as necessary - [#13](https://github.com/yokawasa/action-setup-kube-tools/issues/13)
8+
59
## v0.6.0
6-
- add tools setup option to choose which tool to setup - [Issue#8](https://github.com/yokawasa/action-setup-kube-tools/issues/8)
10+
- add tools setup option to choose which tool to setup - [#8](https://github.com/yokawasa/action-setup-kube-tools/issues/8)
711
- up default tool versions
812
- kubectl: 1.20.2
913
- kustomize: 4.0.5
@@ -12,25 +16,25 @@ All notable changes to the "action-setup-kube-tools" will be documented in this
1216

1317
## v0.5.0
1418

15-
- Add kube-score - [PR#10](https://github.com/yokawasa/action-setup-kube-tools/pull/10)
19+
- Add kube-score - [#10](https://github.com/yokawasa/action-setup-kube-tools/pull/10)
1620
- https://github.com/zegl/kube-score
1721

1822
## v0.4.0
1923

2024
- Minor markdown cleanup
2125
- Bump `actions/checkout` to v2 in tests and documentation
22-
- Add Tilt and Skaffold - [PR#6](https://github.com/yokawasa/action-setup-kube-tools/pull/6)
26+
- Add Tilt and Skaffold - [#6](https://github.com/yokawasa/action-setup-kube-tools/pull/6)
2327
- https://tilt.dev
2428
- https://skaffold.dev
2529

2630
## v0.3.0
2731

28-
- Add Rancher CLI - [PR#4](https://github.com/yokawasa/action-setup-kube-tools/pull/4)
32+
- Add Rancher CLI - [#4](https://github.com/yokawasa/action-setup-kube-tools/pull/4)
2933
- https://rancher.com/docs/rancher/v2.x/en/cli/
3034

3135
## v0.2.0
3236

33-
- Bumps @actions/core from 1.2.0 to 1.2.6 - [PR#2](https://github.com/yokawasa/action-setup-kube-tools/pull/2)
37+
- Bumps @actions/core from 1.2.0 to 1.2.6 - [#2](https://github.com/yokawasa/action-setup-kube-tools/pull/2)
3438

3539
## v0.1.0
3640

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ A GitHub Action that setup Kubernetes tools (kubectl, kustomize, helm, kubeval,
1111

1212
|Parameter|Required|Default Value|Description|
1313
|:--:|:--:|:--:|:--|
14+
|`fail-fast`|`false`|`true`| the action immediately fails when it fails to download (ie. due to a bad version) |
1415
|`setup-tools`|`false`|`""`|List of tool name to setup. By default, the action download and setup all supported Kubernetes tools. By specifying `setup-tools` you can choose which tools the action setup. Supported separator is `return` in multi-line string. Supported tools are `kubectl`, `kustomize`, `helm`, `helmv3`, `kubeval`, `conftest`, `yq`, `rancher`, `tilt`, `skaffold`, `kube-score`|
1516
|`kubectl`|`false`|`1.20.2`| kubectl version. kubectl vesion can be found [here](https://github.com/kubernetes/kubernetes/releases)|
1617
|`kustomize`|`false`|`4.0.5`| kustomize version. kustomize vesion can be found [here](https://github.com/kubernetes-sigs/kustomize/releases)|
@@ -23,8 +24,9 @@ A GitHub Action that setup Kubernetes tools (kubectl, kustomize, helm, kubeval,
2324
|`skaffold`|`false`|`1.20.0`| Skaffold version. Skaffold vesion can be found [here](https://github.com/GoogleContainerTools/skaffold/releases)|
2425
|`kube-score`|`false`|`1.10.1`| kube-score version. kube-score vesion can be found [here](https://github.com/zegl/kube-score/releases)|
2526

26-
> Supported Environments: Linux
27-
27+
> - Supported Environments: Linux
28+
> - From v0.7.0, the action supports tool version 'v' prefix. Prior to v0.7.0, the action only accept the tool version without 'v' prefix but from v0.7.0 the action automatically add/remove the prefix as necessary
29+
>
2830
### Outputs
2931
|Parameter|Description|
3032
|:--:|:--|
@@ -54,7 +56,7 @@ Specific versions for the commands can be setup by adding inputs parameters like
5456
kubectl: '1.17.1'
5557
kustomize: '3.7.0'
5658
helm: '2.16.7'
57-
helmv3: '3.2.4'
59+
helmv3: '3.5.2'
5860
kubeval: '0.14.0'
5961
conftest: '0.18.2'
6062
rancher: '2.4.10'
@@ -112,7 +114,7 @@ By specifying setup-tools you can choose which tools the action setup. Supported
112114
kustomize
113115
skaffold
114116
kubectl: '1.17.1'
115-
helmv3: '3.2.4'
117+
helmv3: '3.5.2'
116118
kustomize: '3.7.0'
117119
skaffold: '1.20.0'
118120
- run: |

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: 'Setup Kubernetes Tools'
22
description: 'Setup Kubernetes tools: kubectl, kustomize, helm, kubeval, conftest, yq, rancher, tilt, skaffold, kube-score'
33
author: 'Yoichi Kawasaki @yokawasa'
44
inputs:
5+
fail-fast:
6+
required: false
7+
default: 'true'
8+
description: 'the action immediately fails when it fails to download (ie. due to a bad version)'
59
setup-tools:
610
required: false
711
default: ''

dist/index.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,6 +1609,10 @@ function run() {
16091609
if (!os.type().match(/^Linux/)) {
16101610
throw new Error('The action only support Linux OS!');
16111611
}
1612+
let failFast = true;
1613+
if (core.getInput('fail-fast', { required: false }).toLowerCase() === 'false') {
1614+
failFast = false;
1615+
}
16121616
let setupToolList = [];
16131617
const setupTools = core.getInput('setup-tools', { required: false }).trim();
16141618
if (setupTools) {
@@ -1626,13 +1630,27 @@ function run() {
16261630
// By default, the action setup all supported Kubernetes tools, which mean
16271631
// all tools can be setup when setuptools does not have any elements.
16281632
if (setupToolList.length === 0 || setupToolList.includes(tool.name)) {
1629-
let toolVersion = core.getInput(tool.name, { required: false });
1633+
let toolVersion = core
1634+
.getInput(tool.name, { required: false })
1635+
.toLowerCase();
1636+
if (toolVersion && toolVersion.startsWith('v')) {
1637+
toolVersion = toolVersion.substr(1);
1638+
}
16301639
if (!toolVersion) {
16311640
toolVersion = tool.defaultVersion;
16321641
}
1633-
const cachedPath = yield downloadTool(toolVersion, tool);
1634-
core.addPath(path.dirname(cachedPath));
1635-
toolPath = cachedPath;
1642+
try {
1643+
const cachedPath = yield downloadTool(toolVersion, tool);
1644+
core.addPath(path.dirname(cachedPath));
1645+
toolPath = cachedPath;
1646+
}
1647+
catch (exception) {
1648+
if (failFast) {
1649+
// eslint-disable-next-line no-console
1650+
console.log(`Exiting immediately (fail fast) - [Reason] ${exception}`);
1651+
process.exit(1);
1652+
}
1653+
}
16361654
}
16371655
core.setOutput(`${tool.name}-path`, toolPath);
16381656
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "action-setup-kube-tools",
3-
"version": "0.6.0",
3+
"version": "0.7.0",
44
"private": true,
55
"description": "Github Action that install Kubernetes tools (kubectl, kustomize, helm, kubeval, conftest, yq, rancher) and cache them on the runner",
66
"main": "lib/main.js",

src/main.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ async function run() {
224224
throw new Error('The action only support Linux OS!')
225225
}
226226

227+
let failFast = true
228+
if (core.getInput('fail-fast', {required: false}).toLowerCase() === 'false') {
229+
failFast = false
230+
}
231+
227232
let setupToolList: string[] = []
228233
const setupTools = core.getInput('setup-tools', {required: false}).trim()
229234
if (setupTools) {
@@ -241,13 +246,26 @@ async function run() {
241246
// By default, the action setup all supported Kubernetes tools, which mean
242247
// all tools can be setup when setuptools does not have any elements.
243248
if (setupToolList.length === 0 || setupToolList.includes(tool.name)) {
244-
let toolVersion = core.getInput(tool.name, {required: false})
249+
let toolVersion = core
250+
.getInput(tool.name, {required: false})
251+
.toLowerCase()
252+
if (toolVersion && toolVersion.startsWith('v')) {
253+
toolVersion = toolVersion.substr(1)
254+
}
245255
if (!toolVersion) {
246256
toolVersion = tool.defaultVersion
247257
}
248-
const cachedPath = await downloadTool(toolVersion, tool)
249-
core.addPath(path.dirname(cachedPath))
250-
toolPath = cachedPath
258+
try {
259+
const cachedPath = await downloadTool(toolVersion, tool)
260+
core.addPath(path.dirname(cachedPath))
261+
toolPath = cachedPath
262+
} catch (exception) {
263+
if (failFast) {
264+
// eslint-disable-next-line no-console
265+
console.log(`Exiting immediately (fail fast) - [Reason] ${exception}`)
266+
process.exit(1)
267+
}
268+
}
251269
}
252270
core.setOutput(`${tool.name}-path`, toolPath)
253271
})

0 commit comments

Comments
 (0)