Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Disable init by default if kubeconfig used
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent99 committed Oct 22, 2022
1 parent 480b645 commit 3466a34
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,21 @@ jobs:
npm install
- run: |
npm run all
test: # make sure the action works on a clean machine without building
k3s: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
- run: acorn
shell: bash
main:
kubeconfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
k3s-install: false
kubeconfig: 'hello kube'
acorn-version: main
acorn-init: false
- run: |
env
acorn
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
acorn-init:
description: Whether to initialize acorn in the cluster
required: false
default: 'true'
default: 'auto'

kubeconfig:
description: Provide a kubeconfig to use instead of installing k3s
Expand Down
13 changes: 12 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ import {resolve} from 'path'
async function setup(): Promise<void> {
const kubeconfig = core.getInput('kubeconfig')

const initStr = core.getInput('acorn-init')
let init = false

if (initStr === 'auto') {
init = !kubeconfig
} else {
init = core.getBooleanInput('acorn-init')
}

if (kubeconfig) {
core.info(`Applying kubeconfig`)

Expand Down Expand Up @@ -35,9 +44,11 @@ async function setup(): Promise<void> {
core.info('Installing acorn')
await acorn.installAsset(asset)

if (core.getBooleanInput('acorn-init')) {
if (init) {
core.info('Initializing acorn on cluster')
await acorn.init()
} else {
core.info('Skipping acorn init')
}
}

Expand Down

0 comments on commit 3466a34

Please sign in to comment.