Compare commits

...

31 commits

Author SHA1 Message Date
dependabot[bot]
2d66d6bef6
Bump the actions group across 1 directory with 4 updates (#125)
Bumps the actions group with 4 updates in the / directory: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node), [@vercel/ncc](https://github.com/vercel/ncc), [prettier](https://github.com/prettier/prettier) and [typescript](https://github.com/microsoft/TypeScript).


Updates `@types/node` from 22.8.7 to 22.10.2
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `@vercel/ncc` from 0.38.2 to 0.38.3
- [Release notes](https://github.com/vercel/ncc/releases)
- [Commits](https://github.com/vercel/ncc/compare/0.38.2...0.38.3)

Updates `prettier` from 3.3.3 to 3.4.2
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.3.3...3.4.2)

Updates `typescript` from 5.6.3 to 5.7.2
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.6.3...v5.7.2)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: "@vercel/ncc"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-18 15:24:40 -05:00
dependabot[bot]
3b0a9a4ae3
Bump @types/node in the actions group across 1 directory (#119)
Bumps the actions group with 1 update in the / directory: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node).


Updates `@types/node` from 22.7.9 to 22.8.7
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-06 15:09:30 -05:00
dependabot[bot]
66e812b74c
Bump the actions group across 1 directory with 5 updates (#117)
Bumps the actions group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) | `1.10.1` | `1.11.1` |
| [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) | `29.5.12` | `29.5.14` |
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `22.5.4` | `22.7.9` |
| [@vercel/ncc](https://github.com/vercel/ncc) | `0.38.1` | `0.38.2` |
| [typescript](https://github.com/microsoft/TypeScript) | `5.5.4` | `5.6.3` |



Updates `@actions/core` from 1.10.1 to 1.11.1
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Updates `@types/jest` from 29.5.12 to 29.5.14
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Updates `@types/node` from 22.5.4 to 22.7.9
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `@vercel/ncc` from 0.38.1 to 0.38.2
- [Release notes](https://github.com/vercel/ncc/releases)
- [Commits](https://github.com/vercel/ncc/compare/0.38.1...0.38.2)

Updates `typescript` from 5.5.4 to 5.6.3
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.5.4...v5.6.3)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: "@types/jest"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: "@vercel/ncc"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 12:30:23 -07:00
Jaiveer Katariya
fc19d5430f
fix (#116) 2024-10-23 12:24:24 -07:00
dependabot[bot]
5f6d890454
Bump @types/node from 22.5.2 to 22.5.4 in the actions group (#110)
Bumps the actions group with 1 update: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node).


Updates `@types/node` from 22.5.2 to 22.5.4
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-11 15:33:10 -04:00
dependabot[bot]
27d304ebf8
Bump the actions group in /.github/workflows with 4 updates (#108)
Bumps the actions group in /.github/workflows with 4 updates: [actions/stale](https://github.com/actions/stale), [actions/checkout](https://github.com/actions/checkout), [actions/setup-python](https://github.com/actions/setup-python) and [actionsx/prettier](https://github.com/actionsx/prettier).


Updates `actions/stale` from 3 to 9
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v3...v9)

Updates `actions/checkout` from 1 to 4
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v1...v4)

Updates `actions/setup-python` from 2 to 5
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v2...v5)

Updates `actionsx/prettier` from 2 to 3
- [Release notes](https://github.com/actionsx/prettier/releases)
- [Commits](https://github.com/actionsx/prettier/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actionsx/prettier
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-11 15:32:13 -04:00
dependabot[bot]
b5a36385a8
Bump the actions group with 9 updates (#109)
Bumps the actions group with 9 updates:

| Package | From | To |
| --- | --- | --- |
| [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) | `1.10.0` | `1.10.1` |
| [@actions/tool-cache](https://github.com/actions/toolkit/tree/HEAD/packages/tool-cache) | `1.7.2` | `2.0.1` |
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `12.20.55` | `22.5.2` |
| [@vercel/ncc](https://github.com/vercel/ncc) | `0.34.0` | `0.38.1` |
| [jest](https://github.com/jestjs/jest/tree/HEAD/packages/jest) | `26.6.3` | `29.7.0` |
| [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) | `26.0.24` | `29.5.12` |
| [prettier](https://github.com/prettier/prettier) | `2.7.1` | `3.3.3` |
| [ts-jest](https://github.com/kulshekhar/ts-jest) | `26.5.6` | `29.2.5` |
| [typescript](https://github.com/Microsoft/TypeScript) | `3.9.2` | `5.5.4` |


Updates `@actions/core` from 1.10.0 to 1.10.1
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Updates `@actions/tool-cache` from 1.7.2 to 2.0.1
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/tool-cache/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/@actions/artifact@2.0.1/packages/tool-cache)

Updates `@types/node` from 12.20.55 to 22.5.2
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `@vercel/ncc` from 0.34.0 to 0.38.1
- [Release notes](https://github.com/vercel/ncc/releases)
- [Commits](https://github.com/vercel/ncc/compare/0.34.0...0.38.1)

Updates `jest` from 26.6.3 to 29.7.0
- [Release notes](https://github.com/jestjs/jest/releases)
- [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jestjs/jest/commits/v29.7.0/packages/jest)

Updates `@types/jest` from 26.0.24 to 29.5.12
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Updates `prettier` from 2.7.1 to 3.3.3
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.7.1...3.3.3)

Updates `ts-jest` from 26.5.6 to 29.2.5
- [Release notes](https://github.com/kulshekhar/ts-jest/releases)
- [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/kulshekhar/ts-jest/compare/v26.5.6...v29.2.5)

Updates `typescript` from 3.9.2 to 5.5.4
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v3.9.2...v5.5.4)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: "@actions/tool-cache"
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: "@vercel/ncc"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: "@types/jest"
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: ts-jest
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-03 16:17:04 -04:00
David Gamero
0b4bd0b42d
Create dependabot.yml (#107)
* Create dependabot.yml

* format

* directory for npm
2024-09-03 16:01:27 -04:00
Alexandre Leveille
2a0a121944
Update README.md (#102)
Update README.md version of the action from v3 (deprecated NodeJS 16) to v4 (NodeJS 20)
2024-08-01 11:27:45 -04:00
David Gamero
619a3634cc
Update release-pr.yml (#101) 2024-03-22 15:42:20 -04:00
David Gamero
688936d8db
update build script to include ncc install (#99)
gh actions won't respect npx installed devdeps
2024-02-07 12:45:04 -05:00
David Gamero
d1dc92d6ff
Update release-pr.yml (#98) 2024-02-07 12:39:29 -05:00
David Gamero
f471212b11
v4 release (#96) 2024-01-30 17:51:12 -05:00
dependabot[bot]
6a79469612
Bump tough-cookie from 4.0.0 to 4.1.3 (#81)
Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) from 4.0.0 to 4.1.3.
- [Release notes](https://github.com/salesforce/tough-cookie/releases)
- [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md)
- [Commits](https://github.com/salesforce/tough-cookie/compare/v4.0.0...v4.1.3)

---
updated-dependencies:
- dependency-name: tough-cookie
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-30 16:54:13 -05:00
dependabot[bot]
4552b26c1d
Bump semver from 5.7.1 to 5.7.2 (#82)
Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-30 16:54:05 -05:00
dependabot[bot]
0a920068d6
Bump word-wrap from 1.2.3 to 1.2.4 (#83)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-30 16:53:56 -05:00
David Gamero
340b2c4cf2
migrate to new azure release workflow (#95)
* migrate to new azure release workflow

* format
2024-01-30 15:46:08 -05:00
dependabot[bot]
bc474d7b1f
Bump @babel/traverse from 7.18.6 to 7.23.9 (#93)
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.18.6 to 7.23.9.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.9/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-29 14:43:09 -05:00
Per Karlsson
796733b6bf
Bump node to version 20 (#90) 2024-01-26 16:23:31 -05:00
dependabot[bot]
dd44a92c26
Bump json5 from 2.2.1 to 2.2.3 (#76)
Bumps [json5](https://github.com/json5/json5) from 2.2.1 to 2.2.3.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v2.2.1...v2.2.3)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 14:14:50 -05:00
Oliver King
bd5ca45a62
change uri (#77) 2023-01-09 13:55:56 -05:00
dependabot[bot]
ad011b0706
Bump decode-uri-component from 0.2.0 to 0.2.2 (#73)
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 12:41:33 -06:00
Sumner Warren
4beba283ef
Bump @actions/core (#68)
to address https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2022-11-01 19:28:09 -04:00
Asa Gayle
07847ca908
added support message (#67) 2022-10-17 15:23:15 -04:00
Vidya Reddy
d41afda166
syntax error fixes (#66) 2022-09-21 11:15:46 -07:00
Vidya Reddy
80632d0f30
Add the issue report and feature request form (#64) 2022-09-06 13:08:07 -04:00
dependabot[bot]
84f5aafb14
Bump @actions/core from 1.9.0 to 1.9.1 (#63)
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.9.0 to 1.9.1.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-22 14:00:54 -04:00
Oliver King
6d0ea16244
Update README example to v3 (#60) 2022-07-25 13:41:53 -04:00
Vidya Reddy
3545f3a551
Upgraded the ncc version (#61)
Co-authored-by: Vidya Reddy <vidyareddy@microsoft.com>
2022-07-05 10:17:07 -07:00
Vidya Reddy
2eb2a370ff
Vidya reddy prettier (#58)
* upgraded to Node16

* Enforce Prettier

* code fix

* jest version change and prettify code

Co-authored-by: Vidya Reddy <vidyareddy@microsoft.com>
2022-06-27 15:31:07 -07:00
dependabot[bot]
b474dc39ef
Bump ansi-regex from 5.0.0 to 5.0.1 (#56)
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-22 10:41:01 -04:00
25 changed files with 7213 additions and 11338 deletions

View file

@ -4,7 +4,4 @@ about: Create a report to help us improve
title: '' title: ''
labels: need-to-triage labels: need-to-triage
assignees: '@aksatlanta' assignees: '@aksatlanta'
--- ---

View file

@ -0,0 +1,36 @@
name: Bug Report
description: File a bug report specifying all inputs you provided for the action, we will respond to this thread with any questions.
title: 'Bug: '
labels: ['bug', 'triage']
assignees: '@Azure/aks-atlanta'
body:
- type: textarea
id: What-happened
attributes:
label: What happened?
description: Tell us what happened and how is it different from the expected?
placeholder: Tell us what you see!
validations:
required: true
- type: checkboxes
id: Version
attributes:
label: Version
options:
- label: I am using the latest version
required: true
- type: input
id: Runner
attributes:
label: Runner
description: What runner are you using?
placeholder: Mention the runner info (self-hosted, operating system)
validations:
required: true
- type: textarea
id: Logs
attributes:
label: Relevant log output
description: Run in debug mode for the most verbose logs. Please feel free to attach a screenshot of the logs
validations:
required: true

6
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1,6 @@
blank_issues_enabled: false
contact_links:
- name: GitHub Action "setup-kubectl" Support
url: https://github.com/Azure/setup-kubectl
security: https://github.com/Azure/setup-kubectl/blob/main/SECURITY.md
about: Please ask and answer questions here.

View file

@ -0,0 +1,13 @@
name: Feature Request
description: File a Feature Request form, we will respond to this thread with any questions.
title: 'Feature Request: '
labels: ['Feature']
assignees: '@Azure/aks-atlanta'
body:
- type: textarea
id: Feature_request
attributes:
label: Feature request
description: Provide example functionality and links to relevant docs
validations:
required: true

18
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
groups:
actions:
patterns:
- '*'
- package-ecosystem: github-actions
directory: .github/workflows
schedule:
interval: weekly
groups:
actions:
patterns:
- '*'

View file

@ -1,30 +1,30 @@
name: setting-default-labels name: setting-default-labels
on: on:
schedule: schedule:
- cron: "0 0/3 * * *" - cron: '0 0/3 * * *'
jobs: jobs:
label-issues: label-issues:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v3 - uses: actions/stale@v9
name: Setting issue as idle name: Setting issue as idle
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is idle because it has been open for 14 days with no activity.' stale-issue-message: 'This issue is idle because it has been open for 14 days with no activity.'
stale-issue-label: 'idle' stale-issue-label: 'idle'
days-before-stale: 14 days-before-stale: 14
days-before-close: -1 days-before-close: -1
operations-per-run: 100 operations-per-run: 100
exempt-issue-labels: 'backlog' exempt-issue-labels: 'backlog'
- uses: actions/stale@v3 - uses: actions/stale@v9
name: Setting PR as idle name: Setting PR as idle
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-pr-message: 'This PR is idle because it has been open for 14 days with no activity.' stale-pr-message: 'This PR is idle because it has been open for 14 days with no activity.'
stale-pr-label: 'idle' stale-pr-label: 'idle'
days-before-stale: 14 days-before-stale: 14
days-before-close: -1 days-before-close: -1
operations-per-run: 100 operations-per-run: 100

View file

@ -1,49 +1,54 @@
name: Integration test for setup-kubectl name: Integration test for setup-kubectl
on: # rebuild any PRs and main branch changes on: # rebuild any PRs and main branch changes
pull_request: pull_request:
branches: branches:
- main - main
- "releases/*" - 'releases/*'
push: push:
branches: branches:
- main - main
- "releases/*" - 'releases/*'
jobs: jobs:
run-integration-test: run-integration-test:
name: Validate release and master branch name: Validate release and master branch
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
KUBECONFIG: /home/runner/.kube/config KUBECONFIG: /home/runner/.kube/config
PR_BASE_REF: ${{ github.event.pull_request.base.ref }} PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
name: Checkout from PR branch name: Checkout from PR branch
- id: action-npm-build - id: action-npm-build
name: npm install and build name: npm install and build
run: | run: |
echo $PR_BASE_REF echo $PR_BASE_REF
if [[ $PR_BASE_REF != releases/* ]]; then if [[ $PR_BASE_REF != releases/* ]]; then
npm install npm install
npm run build npm run build
fi fi
- uses: actions/setup-python@v2 - uses: actions/setup-python@v5
name: Install Python name: Install Python
with: with:
python-version: "3.x" python-version: '3.x'
- name: Install requests library - name: Install requests library
run: pip install requests run: pip install requests
- name: Validate kubectl setup - name: Setup kubectl latest
run: python test/validate-kubectl.py !v1.15.1 uses: ./
with:
version: 'latest'
- name: Setup kubectl - name: Validate kubectl setup
uses: ./ run: python test/validate-kubectl.py latest
with:
version: "v1.15.1"
- name: Validate kubectl setup - name: Setup kubectl old version
run: python test/validate-kubectl.py 'v1.15.1' uses: ./
with:
version: 'v1.15.1'
- name: Validate kubectl setup old version
run: python test/validate-kubectl.py 'v1.15.1'

18
.github/workflows/prettify-code.yml vendored Normal file
View file

@ -0,0 +1,18 @@
name: 'Run prettify'
on:
pull_request:
push:
branches: [main]
jobs:
prettier:
name: Prettier Check
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Enforce Prettier
uses: actionsx/prettier@v3
with:
args: --check .

View file

@ -1,14 +1,18 @@
name: Create release PR name: Release Project
on: on:
workflow_dispatch: push:
inputs: branches:
release: - main
description: "Define release version (ex: v1, v2, v3)" paths:
required: true - CHANGELOG.md
workflow_dispatch:
jobs: jobs:
release-pr: release:
uses: OliverMKing/javascript-release-workflow/.github/workflows/release-pr.yml@main permissions:
with: actions: read
release: ${{ github.event.inputs.release }} contents: write
uses: Azure/action-release-workflows/.github/workflows/release_js_project.yaml@v1
with:
changelogPath: ./CHANGELOG.md

View file

@ -1,10 +0,0 @@
name: Tag and create release draft
on:
push:
branches:
- releases/*
jobs:
tag-and-release:
uses: OliverMKing/javascript-release-workflow/.github/workflows/tag-and-release.yml@main

View file

@ -1,21 +1,21 @@
name: "Run unit tests." name: 'Run unit tests.'
on: # rebuild any PRs and main branch changes on: # rebuild any PRs and main branch changes
pull_request: pull_request:
branches: branches:
- main - main
- 'releases/*' - 'releases/*'
push: push:
branches: branches:
- main - main
- 'releases/*' - 'releases/*'
jobs: jobs:
build: # make sure build/ci works properly build: # make sure build/ci works properly
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v4
- name: Build and run L0 tests. - name: Build and run L0 tests.
run: | run: |
npm install npm install
npm test npm test

4
.prettierignore Normal file
View file

@ -0,0 +1,4 @@
# dependencies
/node_modules
coverage
/lib

8
.prettierrc.json Normal file
View file

@ -0,0 +1,8 @@
{
"trailingComma": "none",
"bracketSpacing": false,
"semi": false,
"tabWidth": 3,
"singleQuote": true,
"printWidth": 80
}

7
CHANGELOG.md Normal file
View file

@ -0,0 +1,7 @@
# Changelog
## [v4.0.0] - 2024-01-30
### Changed
- #90 Migrate to node 20 as node 16 is deprecated

View file

@ -1,9 +1,9 @@
# Microsoft Open Source Code of Conduct # Microsoft Open Source Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
Resources: Resources:
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns

View file

@ -1,26 +1,32 @@
# Setup Kubectl # Setup Kubectl
#### Sample workflow to install a specific version of kubectl binary on the runner.
#### Sample workflow to install a specific version of kubectl binary on the runner.
Acceptable values are latest or any semantic version string like `v1.15.0`. Use this action in workflow to define which version of kubectl will be used.
Acceptable values are latest or any semantic version string like `v1.15.0`. Use this action in workflow to define which version of kubectl will be used.
```yaml
- uses: azure/setup-kubectl@v2.0 ```yaml
with: - uses: azure/setup-kubectl@v4
version: '<version>' # default is latest stable with:
id: install version: '<version>' # default is latest stable
``` id: install
Refer to the action metadata file for details about all the inputs https://github.com/Azure/setup-kubectl/blob/main/action.yml ```
# Contributing Refer to the action metadata file for details about all the inputs https://github.com/Azure/setup-kubectl/blob/main/action.yml
This project welcomes contributions and suggestions. Most contributions require you to agree to a # Contributing
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
When you submit a pull request, a CLA bot will automatically determine whether you need to provide the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA. When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). provided by the bot. You will only need to do this once across all repos using our CLA.
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
## Support
setup-kubectl is an open source project that is [**not** covered by the Microsoft Azure support policy](https://support.microsoft.com/en-us/help/2941892/support-for-linux-and-open-source-technology-in-azure). [Please search open issues here](https://github.com/Azure/setup-kubectl/issues), and if your issue isn't already represented please [open a new one](https://github.com/Azure/setup-kubectl/issues/new/choose). The project maintainers will respond to the best of their abilities.

View file

@ -1,35 +1,35 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.1 BLOCK --> <!-- BEGIN MICROSOFT SECURITY.MD V0.0.1 BLOCK -->
## Security ## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [many more](https://opensource.microsoft.com/). Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [many more](https://opensource.microsoft.com/).
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [definition](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)) of a security vulnerability, please report it to us as described below. If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [definition](<https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)>) of a security vulnerability, please report it to us as described below.
## Reporting Security Issues ## Reporting Security Issues
**Please do not report security vulnerabilities through public GitHub issues.** Instead, please report them to the Microsoft Security Response Center at [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://technet.microsoft.com/en-us/security/dn606155). **Please do not report security vulnerabilities through public GitHub issues.** Instead, please report them to the Microsoft Security Response Center at [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://technet.microsoft.com/en-us/security/dn606155).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) - Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue - Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL) - The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue - Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue - Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible) - Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue - Impact of the issue, including how an attacker might exploit the issue
This information will help us triage your report more quickly. This information will help us triage your report more quickly.
## Preferred Languages ## Preferred Languages
We prefer all communications to be in English. We prefer all communications to be in English.
## Policy ## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd). Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
<!-- END MICROSOFT SECURITY.MD BLOCK --> <!-- END MICROSOFT SECURITY.MD BLOCK -->

View file

@ -1,15 +1,15 @@
name: "Kubectl tool installer" name: 'Kubectl tool installer'
description: "Install a specific version of kubectl binary. Acceptable values are latest or any semantic version string like 1.15.0" description: 'Install a specific version of kubectl binary. Acceptable values are latest or any semantic version string like 1.15.0'
inputs: inputs:
version: version:
description: "Version of kubectl" description: 'Version of kubectl'
required: true required: true
default: "latest" default: 'latest'
outputs: outputs:
kubectl-path: kubectl-path:
description: "Path to the cached kubectl binary" description: 'Path to the cached kubectl binary'
branding: branding:
color: "blue" color: 'blue'
runs: runs:
using: "node16" using: 'node20'
main: "lib/index.js" main: 'lib/index.js'

View file

@ -1,18 +1,18 @@
module.exports = { module.exports = {
clearMocks: true, clearMocks: true,
moduleFileExtensions: ['js', 'ts'], moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node', testEnvironment: 'node',
testMatch: ['**/*.test.ts'], testMatch: ['**/*.test.ts'],
transform: { transform: {
'^.+\\.ts$': 'ts-jest' '^.+\\.ts$': 'ts-jest'
}, },
verbose: true, verbose: true,
coverageThreshold: { coverageThreshold: {
"global": { global: {
"branches": 0, branches: 0,
"functions": 14, functions: 14,
"lines": 27, lines: 27,
"statements": 27 statements: 27
} }
} }
} }

17394
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,31 +1,34 @@
{ {
"name": "setup-kubectl-action", "name": "setup-kubectl-action",
"version": "0.0.0", "version": "0.0.0",
"private": true, "private": true,
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {
"build": "ncc build src/run.ts -o lib", "build": "npm i ncc && npx ncc build src/run.ts -o lib",
"test": "jest", "test": "jest",
"test-coverage": "jest --coverage" "test-coverage": "jest --coverage",
}, "format": "prettier --write .",
"keywords": [ "format-check": "prettier --check ."
"actions", },
"node", "keywords": [
"setup" "actions",
], "node",
"author": "GitHub", "setup"
"license": "MIT", ],
"dependencies": { "author": "GitHub",
"@actions/core": "^1.2.6", "license": "MIT",
"@actions/exec": "^1.0.0", "dependencies": {
"@actions/tool-cache": "^1.0.0" "@actions/core": "^1.11.1",
}, "@actions/exec": "^1.0.0",
"devDependencies": { "@actions/tool-cache": "^2.0.1"
"@types/node": "^12.0.4", },
"@vercel/ncc": "^0.33.1", "devDependencies": {
"jest": "^26.0.1", "@types/jest": "^29.5.14",
"@types/jest": "^26.0.1", "@types/node": "^22.10.2",
"ts-jest": "^26.0.1", "@vercel/ncc": "^0.38.3",
"typescript": "3.9.2" "jest": "^29.7.0",
} "prettier": "3.4.2",
} "ts-jest": "^29.2.5",
"typescript": "5.7.2"
}
}

View file

@ -1,31 +1,31 @@
import * as os from 'os'; import * as os from 'os'
import * as util from 'util'; import * as util from 'util'
export function getKubectlArch(): string { export function getKubectlArch(): string {
const arch = os.arch(); const arch = os.arch()
if (arch === 'x64') { if (arch === 'x64') {
return 'amd64'; return 'amd64'
} }
return arch; return arch
} }
export function getkubectlDownloadURL(version: string, arch: string): string { export function getkubectlDownloadURL(version: string, arch: string): string {
switch (os.type()) { switch (os.type()) {
case 'Linux': case 'Linux':
return util.format('https://storage.googleapis.com/kubernetes-release/release/%s/bin/linux/%s/kubectl', version, arch); return `https://dl.k8s.io/release/${version}/bin/linux/${arch}/kubectl`
case 'Darwin': case 'Darwin':
return util.format('https://storage.googleapis.com/kubernetes-release/release/%s/bin/darwin/%s/kubectl', version, arch); return `https://dl.k8s.io/release/${version}/bin/darwin/${arch}/kubectl`
case 'Windows_NT': case 'Windows_NT':
default: default:
return util.format('https://storage.googleapis.com/kubernetes-release/release/%s/bin/windows/%s/kubectl.exe', version, arch); return `https://dl.k8s.io/release/${version}/bin/windows/${arch}/kubectl.exe`
} }
} }
export function getExecutableExtension(): string { export function getExecutableExtension(): string {
if (os.type().match(/^Win/)) { if (os.type().match(/^Win/)) {
return '.exe'; return '.exe'
} }
return ''; return ''
} }

View file

@ -1,183 +1,235 @@
import * as run from './run' import * as run from './run'
import { getkubectlDownloadURL, getKubectlArch, getExecutableExtension } from './helpers'; import {
import * as os from 'os'; getkubectlDownloadURL,
import * as toolCache from '@actions/tool-cache'; getKubectlArch,
import * as fs from 'fs'; getExecutableExtension
import * as path from 'path'; } from './helpers'
import * as core from '@actions/core'; import * as os from 'os'
import * as util from 'util'; import * as toolCache from '@actions/tool-cache'
import * as fs from 'fs'
import * as path from 'path'
import * as core from '@actions/core'
import * as util from 'util'
describe('Testing all functions in run file.', () => { describe('Testing all functions in run file.', () => {
test('getExecutableExtension() - return .exe when os is Windows', () => { test('getExecutableExtension() - return .exe when os is Windows', () => {
jest.spyOn(os, 'type').mockReturnValue('Windows_NT'); jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
expect(getExecutableExtension()).toBe('.exe'); expect(getExecutableExtension()).toBe('.exe')
expect(os.type).toBeCalled(); expect(os.type).toBeCalled()
}); })
test('getExecutableExtension() - return empty string for non-windows OS', () => { test('getExecutableExtension() - return empty string for non-windows OS', () => {
jest.spyOn(os, 'type').mockReturnValue('Darwin'); jest.spyOn(os, 'type').mockReturnValue('Darwin')
expect(getExecutableExtension()).toBe(''); expect(getExecutableExtension()).toBe('')
expect(os.type).toBeCalled(); expect(os.type).toBeCalled()
}); })
test.each([ test.each([
['arm', 'arm'], ['arm', 'arm'],
['arm64', 'arm64'], ['arm64', 'arm64'],
['x64', 'amd64'] ['x64', 'amd64']
])("getKubectlArch() - return on %s os arch %s kubectl arch", (osArch, kubectlArch) => { ])(
jest.spyOn(os, 'arch').mockReturnValue(osArch); 'getKubectlArch() - return on %s os arch %s kubectl arch',
(osArch, kubectlArch) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch)
expect(getKubectlArch()).toBe(kubectlArch); expect(getKubectlArch()).toBe(kubectlArch)
expect(os.arch).toBeCalled(); expect(os.arch).toBeCalled()
}); }
)
test.each([ test.each([['arm'], ['arm64'], ['amd64']])(
['arm'], 'getkubectlDownloadURL() - return the URL to download %s kubectl for Linux',
['arm64'], (arch) => {
['amd64'] jest.spyOn(os, 'type').mockReturnValue('Linux')
])('getkubectlDownloadURL() - return the URL to download %s kubectl for Linux', (arch) => { const kubectlLinuxUrl = util.format(
jest.spyOn(os, 'type').mockReturnValue('Linux'); 'https://dl.k8s.io/release/v1.15.0/bin/linux/%s/kubectl',
const kubectlLinuxUrl = util.format('https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/linux/%s/kubectl', arch); arch
)
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlLinuxUrl); expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlLinuxUrl)
expect(os.type).toBeCalled(); expect(os.type).toBeCalled()
}); }
)
test.each([ test.each([['arm'], ['arm64'], ['amd64']])(
['arm'], 'getkubectlDownloadURL() - return the URL to download %s kubectl for Darwin',
['arm64'], (arch) => {
['amd64'] jest.spyOn(os, 'type').mockReturnValue('Darwin')
])('getkubectlDownloadURL() - return the URL to download %s kubectl for Darwin', (arch) => { const kubectlDarwinUrl = util.format(
jest.spyOn(os, 'type').mockReturnValue('Darwin'); 'https://dl.k8s.io/release/v1.15.0/bin/darwin/%s/kubectl',
const kubectlDarwinUrl = util.format('https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/darwin/%s/kubectl', arch); arch
)
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlDarwinUrl); expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlDarwinUrl)
expect(os.type).toBeCalled(); expect(os.type).toBeCalled()
}); }
)
test.each([ test.each([['arm'], ['arm64'], ['amd64']])(
['arm'], 'getkubectlDownloadURL() - return the URL to download %s kubectl for Windows',
['arm64'], (arch) => {
['amd64'] jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
])('getkubectlDownloadURL() - return the URL to download %s kubectl for Windows', (arch) => {
jest.spyOn(os, 'type').mockReturnValue('Windows_NT');
const kubectlWindowsUrl = util.format('https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/windows/%s/kubectl.exe', arch); const kubectlWindowsUrl = util.format(
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlWindowsUrl); 'https://dl.k8s.io/release/v1.15.0/bin/windows/%s/kubectl.exe',
expect(os.type).toBeCalled(); arch
}); )
expect(getkubectlDownloadURL('v1.15.0', arch)).toBe(kubectlWindowsUrl)
expect(os.type).toBeCalled()
}
)
test('getStableKubectlVersion() - download stable version file, read version and return it', async () => { test('getStableKubectlVersion() - download stable version file, read version and return it', async () => {
jest.spyOn(toolCache, 'downloadTool').mockReturnValue(Promise.resolve('pathToTool')); jest
jest.spyOn(fs, 'readFileSync').mockReturnValue('v1.20.4'); .spyOn(toolCache, 'downloadTool')
.mockReturnValue(Promise.resolve('pathToTool'))
jest.spyOn(fs, 'readFileSync').mockReturnValue('v1.20.4')
expect(await run.getStableKubectlVersion()).toBe('v1.20.4'); expect(await run.getStableKubectlVersion()).toBe('v1.20.4')
expect(toolCache.downloadTool).toBeCalled(); expect(toolCache.downloadTool).toBeCalled()
expect(fs.readFileSync).toBeCalledWith('pathToTool', 'utf8'); expect(fs.readFileSync).toBeCalledWith('pathToTool', 'utf8')
}); })
test('getStableKubectlVersion() - return default v1.15.0 if version read is empty', async () => { test('getStableKubectlVersion() - return default v1.15.0 if version read is empty', async () => {
jest.spyOn(toolCache, 'downloadTool').mockReturnValue(Promise.resolve('pathToTool')); jest
jest.spyOn(fs, 'readFileSync').mockReturnValue(''); .spyOn(toolCache, 'downloadTool')
.mockReturnValue(Promise.resolve('pathToTool'))
jest.spyOn(fs, 'readFileSync').mockReturnValue('')
expect(await run.getStableKubectlVersion()).toBe('v1.15.0'); expect(await run.getStableKubectlVersion()).toBe('v1.15.0')
expect(toolCache.downloadTool).toBeCalled(); expect(toolCache.downloadTool).toBeCalled()
expect(fs.readFileSync).toBeCalledWith('pathToTool', 'utf8'); expect(fs.readFileSync).toBeCalledWith('pathToTool', 'utf8')
}); })
test('getStableKubectlVersion() - return default v1.15.0 if unable to download file', async () => { test('getStableKubectlVersion() - return default v1.15.0 if unable to download file', async () => {
jest.spyOn(toolCache, 'downloadTool').mockRejectedValue('Unable to download.'); jest
.spyOn(toolCache, 'downloadTool')
.mockRejectedValue('Unable to download.')
expect(await run.getStableKubectlVersion()).toBe('v1.15.0'); expect(await run.getStableKubectlVersion()).toBe('v1.15.0')
expect(toolCache.downloadTool).toBeCalled(); expect(toolCache.downloadTool).toBeCalled()
}); })
test('downloadKubectl() - download kubectl, add it to toolCache and return path to it', async () => { test('downloadKubectl() - download kubectl, add it to toolCache and return path to it', async () => {
jest.spyOn(toolCache, 'find').mockReturnValue(''); jest.spyOn(toolCache, 'find').mockReturnValue('')
jest.spyOn(toolCache, 'downloadTool').mockReturnValue(Promise.resolve('pathToTool')); jest
jest.spyOn(toolCache, 'cacheFile').mockReturnValue(Promise.resolve('pathToCachedTool')); .spyOn(toolCache, 'downloadTool')
jest.spyOn(os, 'type').mockReturnValue('Windows_NT'); .mockReturnValue(Promise.resolve('pathToTool'))
jest.spyOn(fs, 'chmodSync').mockImplementation(() => { }); jest
.spyOn(toolCache, 'cacheFile')
.mockReturnValue(Promise.resolve('pathToCachedTool'))
jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
jest.spyOn(fs, 'chmodSync').mockImplementation(() => {})
expect(await run.downloadKubectl('v1.15.0')).toBe(path.join('pathToCachedTool', 'kubectl.exe')); expect(await run.downloadKubectl('v1.15.0')).toBe(
expect(toolCache.find).toBeCalledWith('kubectl', 'v1.15.0'); path.join('pathToCachedTool', 'kubectl.exe')
expect(toolCache.downloadTool).toBeCalled(); )
expect(toolCache.cacheFile).toBeCalled(); expect(toolCache.find).toBeCalledWith('kubectl', 'v1.15.0')
expect(os.type).toBeCalled(); expect(toolCache.downloadTool).toBeCalled()
expect(fs.chmodSync).toBeCalledWith(path.join('pathToCachedTool', 'kubectl.exe'), '775'); expect(toolCache.cacheFile).toBeCalled()
}); expect(os.type).toBeCalled()
expect(fs.chmodSync).toBeCalledWith(
path.join('pathToCachedTool', 'kubectl.exe'),
'775'
)
})
test('downloadKubectl() - throw DownloadKubectlFailed error when unable to download kubectl', async () => { test('downloadKubectl() - throw DownloadKubectlFailed error when unable to download kubectl', async () => {
jest.spyOn(toolCache, 'find').mockReturnValue(''); jest.spyOn(toolCache, 'find').mockReturnValue('')
jest.spyOn(toolCache, 'downloadTool').mockRejectedValue('Unable to download kubectl.'); jest
.spyOn(toolCache, 'downloadTool')
.mockRejectedValue('Unable to download kubectl.')
await expect(run.downloadKubectl('v1.15.0')).rejects.toThrow('DownloadKubectlFailed'); await expect(run.downloadKubectl('v1.15.0')).rejects.toThrow(
expect(toolCache.find).toBeCalledWith('kubectl', 'v1.15.0'); 'DownloadKubectlFailed'
expect(toolCache.downloadTool).toBeCalled(); )
}); expect(toolCache.find).toBeCalledWith('kubectl', 'v1.15.0')
expect(toolCache.downloadTool).toBeCalled()
})
test('downloadKubectl() - throw kubectl not found error when receive 404 response', async () => { test('downloadKubectl() - throw kubectl not found error when receive 404 response', async () => {
const kubectlVersion = 'v1.15.0' const kubectlVersion = 'v1.15.0'
const arch = 'arm128'; const arch = 'arm128'
jest.spyOn(os, 'arch').mockReturnValue(arch); jest.spyOn(os, 'arch').mockReturnValue(arch)
jest.spyOn(toolCache, 'find').mockReturnValue(''); jest.spyOn(toolCache, 'find').mockReturnValue('')
jest.spyOn(toolCache, 'downloadTool').mockImplementation(_ => { jest.spyOn(toolCache, 'downloadTool').mockImplementation((_) => {
throw new toolCache.HTTPError(404); throw new toolCache.HTTPError(404)
}); })
await expect(run.downloadKubectl(kubectlVersion)).rejects await expect(run.downloadKubectl(kubectlVersion)).rejects.toThrow(
.toThrow(util.format("Kubectl '%s' for '%s' arch not found.", kubectlVersion, arch)); util.format(
expect(os.arch).toBeCalled(); "Kubectl '%s' for '%s' arch not found.",
expect(toolCache.find).toBeCalledWith('kubectl', kubectlVersion); kubectlVersion,
expect(toolCache.downloadTool).toBeCalled(); arch
}); )
)
expect(os.arch).toBeCalled()
expect(toolCache.find).toBeCalledWith('kubectl', kubectlVersion)
expect(toolCache.downloadTool).toBeCalled()
})
test('downloadKubectl() - return path to existing cache of kubectl', async () => { test('downloadKubectl() - return path to existing cache of kubectl', async () => {
jest.spyOn(toolCache, 'find').mockReturnValue('pathToCachedTool'); jest.spyOn(toolCache, 'find').mockReturnValue('pathToCachedTool')
jest.spyOn(os, 'type').mockReturnValue('Windows_NT'); jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
jest.spyOn(fs, 'chmodSync').mockImplementation(() => { }); jest.spyOn(fs, 'chmodSync').mockImplementation(() => {})
jest.spyOn(toolCache, 'downloadTool'); jest.spyOn(toolCache, 'downloadTool')
expect(await run.downloadKubectl('v1.15.0')).toBe(path.join('pathToCachedTool', 'kubectl.exe')); expect(await run.downloadKubectl('v1.15.0')).toBe(
expect(toolCache.find).toBeCalledWith('kubectl', 'v1.15.0'); path.join('pathToCachedTool', 'kubectl.exe')
expect(os.type).toBeCalled(); )
expect(fs.chmodSync).toBeCalledWith(path.join('pathToCachedTool', 'kubectl.exe'), '775'); expect(toolCache.find).toBeCalledWith('kubectl', 'v1.15.0')
expect(toolCache.downloadTool).not.toBeCalled(); expect(os.type).toBeCalled()
}); expect(fs.chmodSync).toBeCalledWith(
path.join('pathToCachedTool', 'kubectl.exe'),
'775'
)
expect(toolCache.downloadTool).not.toBeCalled()
})
test('run() - download specified version and set output', async () => { test('run() - download specified version and set output', async () => {
jest.spyOn(core, 'getInput').mockReturnValue('v1.15.5'); jest.spyOn(core, 'getInput').mockReturnValue('v1.15.5')
jest.spyOn(toolCache, 'find').mockReturnValue('pathToCachedTool'); jest.spyOn(toolCache, 'find').mockReturnValue('pathToCachedTool')
jest.spyOn(os, 'type').mockReturnValue('Windows_NT'); jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
jest.spyOn(fs, 'chmodSync').mockImplementation(); jest.spyOn(fs, 'chmodSync').mockImplementation()
jest.spyOn(core, 'addPath').mockImplementation(); jest.spyOn(core, 'addPath').mockImplementation()
jest.spyOn(console, 'log').mockImplementation(); jest.spyOn(console, 'log').mockImplementation()
jest.spyOn(core, 'setOutput').mockImplementation(); jest.spyOn(core, 'setOutput').mockImplementation()
expect(await run.run()).toBeUndefined(); expect(await run.run()).toBeUndefined()
expect(core.getInput).toBeCalledWith('version', { 'required': true }); expect(core.getInput).toBeCalledWith('version', {required: true})
expect(core.addPath).toBeCalledWith('pathToCachedTool'); expect(core.addPath).toBeCalledWith('pathToCachedTool')
expect(core.setOutput).toBeCalledWith('kubectl-path', path.join('pathToCachedTool', 'kubectl.exe')); expect(core.setOutput).toBeCalledWith(
}); 'kubectl-path',
path.join('pathToCachedTool', 'kubectl.exe')
)
})
test('run() - get latest version, download it and set output', async () => { test('run() - get latest version, download it and set output', async () => {
jest.spyOn(core, 'getInput').mockReturnValue('latest'); jest.spyOn(core, 'getInput').mockReturnValue('latest')
jest.spyOn(toolCache, 'downloadTool').mockReturnValue(Promise.resolve('pathToTool')); jest
jest.spyOn(fs, 'readFileSync').mockReturnValue('v1.20.4'); .spyOn(toolCache, 'downloadTool')
jest.spyOn(toolCache, 'find').mockReturnValue('pathToCachedTool'); .mockReturnValue(Promise.resolve('pathToTool'))
jest.spyOn(os, 'type').mockReturnValue('Windows_NT'); jest.spyOn(fs, 'readFileSync').mockReturnValue('v1.20.4')
jest.spyOn(fs, 'chmodSync').mockImplementation(); jest.spyOn(toolCache, 'find').mockReturnValue('pathToCachedTool')
jest.spyOn(core, 'addPath').mockImplementation(); jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
jest.spyOn(console, 'log').mockImplementation(); jest.spyOn(fs, 'chmodSync').mockImplementation()
jest.spyOn(core, 'setOutput').mockImplementation(); jest.spyOn(core, 'addPath').mockImplementation()
jest.spyOn(console, 'log').mockImplementation()
jest.spyOn(core, 'setOutput').mockImplementation()
expect(await run.run()).toBeUndefined(); expect(await run.run()).toBeUndefined()
expect(toolCache.downloadTool).toBeCalledWith('https://storage.googleapis.com/kubernetes-release/release/stable.txt'); expect(toolCache.downloadTool).toBeCalledWith(
expect(core.getInput).toBeCalledWith('version', { 'required': true }); 'https://storage.googleapis.com/kubernetes-release/release/stable.txt'
expect(core.addPath).toBeCalledWith('pathToCachedTool'); )
expect(core.setOutput).toBeCalledWith('kubectl-path', path.join('pathToCachedTool', 'kubectl.exe')); expect(core.getInput).toBeCalledWith('version', {required: true})
}); expect(core.addPath).toBeCalledWith('pathToCachedTool')
}); expect(core.setOutput).toBeCalledWith(
'kubectl-path',
path.join('pathToCachedTool', 'kubectl.exe')
)
})
})

View file

@ -1,64 +1,93 @@
import * as path from 'path'; import * as path from 'path'
import * as util from 'util'; import * as util from 'util'
import * as fs from 'fs'; import * as fs from 'fs'
import * as toolCache from '@actions/tool-cache'; import * as toolCache from '@actions/tool-cache'
import * as core from '@actions/core'; import * as core from '@actions/core'
import { getkubectlDownloadURL, getKubectlArch, getExecutableExtension } from './helpers'; import {
getkubectlDownloadURL,
const kubectlToolName = 'kubectl'; getKubectlArch,
const stableKubectlVersion = 'v1.15.0'; getExecutableExtension
const stableVersionUrl = 'https://storage.googleapis.com/kubernetes-release/release/stable.txt'; } from './helpers'
export async function run() { const kubectlToolName = 'kubectl'
let version = core.getInput('version', { 'required': true }); const stableKubectlVersion = 'v1.15.0'
if (version.toLocaleLowerCase() === 'latest') { const stableVersionUrl =
version = await getStableKubectlVersion(); 'https://storage.googleapis.com/kubernetes-release/release/stable.txt'
}
const cachedPath = await downloadKubectl(version); export async function run() {
let version = core.getInput('version', {required: true})
core.addPath(path.dirname(cachedPath)); if (version.toLocaleLowerCase() === 'latest') {
version = await getStableKubectlVersion()
core.debug(`Kubectl tool version: '${version}' has been cached at ${cachedPath}`); }
core.setOutput('kubectl-path', cachedPath); const cachedPath = await downloadKubectl(version)
}
core.addPath(path.dirname(cachedPath))
export async function getStableKubectlVersion(): Promise<string> {
return toolCache.downloadTool(stableVersionUrl).then((downloadPath) => { core.debug(
let version = fs.readFileSync(downloadPath, 'utf8').toString().trim(); `Kubectl tool version: '${version}' has been cached at ${cachedPath}`
if (!version) { )
version = stableKubectlVersion; core.setOutput('kubectl-path', cachedPath)
} }
return version;
}, (error) => { export async function getStableKubectlVersion(): Promise<string> {
core.debug(error); return toolCache.downloadTool(stableVersionUrl).then(
core.warning('GetStableVersionFailed'); (downloadPath) => {
return stableKubectlVersion; let version = fs.readFileSync(downloadPath, 'utf8').toString().trim()
}); if (!version) {
} version = stableKubectlVersion
}
export async function downloadKubectl(version: string): Promise<string> { return version
let cachedToolpath = toolCache.find(kubectlToolName, version); },
let kubectlDownloadPath = ''; (error) => {
const arch = getKubectlArch(); core.debug(error)
if (!cachedToolpath) { core.warning('GetStableVersionFailed')
try { return stableKubectlVersion
kubectlDownloadPath = await toolCache.downloadTool(getkubectlDownloadURL(version, arch)); }
} catch (exception) { )
if (exception instanceof toolCache.HTTPError && exception.httpStatusCode === 404) { }
throw new Error(util.format("Kubectl '%s' for '%s' arch not found.", version, arch));
} else { export async function downloadKubectl(version: string): Promise<string> {
throw new Error('DownloadKubectlFailed'); let cachedToolpath = toolCache.find(kubectlToolName, version)
} let kubectlDownloadPath = ''
} const arch = getKubectlArch()
if (!cachedToolpath) {
cachedToolpath = await toolCache.cacheFile(kubectlDownloadPath, kubectlToolName + getExecutableExtension(), kubectlToolName, version); try {
} kubectlDownloadPath = await toolCache.downloadTool(
getkubectlDownloadURL(version, arch)
const kubectlPath = path.join(cachedToolpath, kubectlToolName + getExecutableExtension()); )
fs.chmodSync(kubectlPath, '775'); } catch (exception) {
return kubectlPath; if (
} exception instanceof toolCache.HTTPError &&
exception.httpStatusCode === 404
run().catch(core.setFailed); ) {
throw new Error(
util.format(
"Kubectl '%s' for '%s' arch not found.",
version,
arch
)
)
} else {
throw new Error('DownloadKubectlFailed')
}
}
cachedToolpath = await toolCache.cacheFile(
kubectlDownloadPath,
kubectlToolName + getExecutableExtension(),
kubectlToolName,
version
)
}
const kubectlPath = path.join(
cachedToolpath,
kubectlToolName + getExecutableExtension()
)
fs.chmodSync(kubectlPath, '775')
return kubectlPath
}
run().catch(core.setFailed)

View file

@ -1,10 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES6", "target": "ES6",
"module": "commonjs" "module": "commonjs"
}, },
"exclude": [ "exclude": ["node_modules", "test"]
"node_modules", }
"test"
]
}