Skip to content

Commit

Permalink
allow file path for license and config values (#46)
Browse files Browse the repository at this point in the history
* allow file path for license and config values

---------

Co-authored-by: cbodonnell <[email protected]>
  • Loading branch information
Craig O'Donnell and cbodonnell authored Feb 27, 2024
1 parent b4b05c8 commit 339ddf7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 23 deletions.
4 changes: 2 additions & 2 deletions kots-install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ wait_duration ---> kots_install
| app-slug | | True | App Slug. |
| app-version-label | | False | The application version label to install. If not specified, the latest version is installed. |
| shared-password | | False | Shared password to use when deploying the admin console. If not specified, a random password is generated. |
| license-file | | True | A license.yaml to use |
| config-values | | False | The config values to use |
| license-file | | True | A license.yaml to use. This can be a path to a file or the contents of the file. |
| config-values | | False | The config values to use. This can be a path to a file or the contents of the file. |
| namespace | default | False | The namespace to install the application to |
| wait-duration | | False | Timeout to be used while waiting for individual components to be ready. must be in Go duration format (eg: 10s, 2m) (default "2m") |

Expand Down
4 changes: 2 additions & 2 deletions kots-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ inputs:
description: 'Shared password to use when deploying the admin console. If not specified, a random password is generated.'
required: false
license-file:
description: 'A license.yaml to use'
description: 'A license.yaml to use. This can be a path to a file or the contents of the file.'
required: true
config-values:
description: 'The config values to use'
description: 'The config values to use. This can be a path to a file or the contents of the file.'
required: false
namespace:
description: 'The namespace to install the application to'
Expand Down
28 changes: 19 additions & 9 deletions kots-install/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 kots-install/dist/index.js.map

Large diffs are not rendered by default.

26 changes: 17 additions & 9 deletions kots-install/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,26 @@ import * as fs from 'fs';

async function run() {

// Write the license
const licenseFileInput = core.getInput('license-file')
let licenseFilePath = '';
const {fd, path: licensePath, cleanup: cleanupValues} = await file({postfix: '.yaml'});
fs.writeFileSync(licensePath, core.getInput('license-file'));
licenseFilePath = licensePath;
if (fs.existsSync(licenseFileInput)) {
licenseFilePath = licenseFileInput;
} else {
const {path: licensePath} = await file({postfix: '.yaml'});
fs.writeFileSync(licensePath, licenseFileInput);
licenseFilePath = licensePath;
}

// Write the values if any
const configValuesInput = core.getInput('config-values')
let valuesFilePath = '';
if (core.getInput('config-values')) {
const {fd, path: valuesPath, cleanup: cleanupValues} = await file({postfix: '.yaml'});
fs.writeFileSync(valuesPath, core.getInput('config-values'));
valuesFilePath = valuesPath;
if (configValuesInput) {
if (fs.existsSync(configValuesInput)) {
valuesFilePath = configValuesInput;
} else {
const {path: valuesPath} = await file({postfix: '.yaml'});
fs.writeFileSync(valuesPath, core.getInput('config-values'));
valuesFilePath = valuesPath;
}
}


Expand Down

0 comments on commit 339ddf7

Please sign in to comment.