Skip to content

Commit

Permalink
Fix/allow chart from input (#2)
Browse files Browse the repository at this point in the history
* Fix default values for chart
  • Loading branch information
MikkelSnitker authored May 26, 2023
1 parent 7915a09 commit ee700c1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
21 changes: 15 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7002,16 +7002,25 @@ const main = async () => {
const helm = await helm_1.Helm.create();
const namespace = (0, core_1.getInput)('namespace', { required: true });
const releaseName = (0, core_1.getInput)('releaseName', { required: true });
const wait = (0, core_1.getInput)('wait', { required: false }) ?? true;
const wait = (0, core_1.getInput)('wait', { required: false });
const defaultRepo = {
name: 'gamote',
url: 'https://gamote.github.io/charts',
chart: 'deployer',
};
const repoUrl = (0, core_1.getInput)('repoUrl', { required: false }) ?? defaultRepo.url;
const repoName = (0, core_1.getInput)('repoName', { required: false }) ?? defaultRepo.name;
const chart = (0, core_1.getInput)('chart', { required: false }) ??
`${defaultRepo.name}/${defaultRepo.chart}`;
let repoUrl = (0, core_1.getInput)('repoUrl', { required: false });
if (!repoUrl) {
repoUrl = defaultRepo.url;
}
let repoName = (0, core_1.getInput)('repoName', { required: false });
if (!repoName) {
repoName = defaultRepo.name;
}
let chart = (0, core_1.getInput)('chart', { required: false });
if (!chart) {
chart = `${defaultRepo.name}/${defaultRepo.chart}`;
}
console.log(`REPO (${repoName}): ${repoUrl}`);
await helm.addRepo(repoName, repoUrl);
const helmArgs = [
// 'template',
Expand All @@ -7022,7 +7031,7 @@ const main = async () => {
releaseName,
chart,
];
if (wait) {
if (wait != 'false') {
helmArgs.push('--wait');
}
getValueFiles().forEach((file) => {
Expand Down
23 changes: 15 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,28 @@ const main = async (): Promise<void> => {

const namespace = getInput('namespace', { required: true });
const releaseName = getInput('releaseName', { required: true });
const wait = getInput('wait', { required: false }) ?? true;
const wait = getInput('wait', { required: false });

const defaultRepo = {
name: 'gamote',
url: 'https://gamote.github.io/charts',
chart: 'deployer',
};

const repoUrl = getInput('repoUrl', { required: false }) ?? defaultRepo.url;
const repoName =
getInput('repoName', { required: false }) ?? defaultRepo.name;
let repoUrl = getInput('repoUrl', { required: false });
if (!repoUrl) {
repoUrl = defaultRepo.url;
}

let repoName = getInput('repoName', { required: false });
if (!repoName) {
repoName = defaultRepo.name;
}

const chart =
getInput('chart', { required: false }) ??
`${defaultRepo.name}/${defaultRepo.chart}`;
let chart = getInput('chart', { required: false });
if (!chart) {
chart = `${defaultRepo.name}/${defaultRepo.chart}`;
}

await helm.addRepo(repoName, repoUrl);

Expand All @@ -96,7 +103,7 @@ const main = async (): Promise<void> => {
chart,
];

if (wait) {
if (wait != 'false') {
helmArgs.push('--wait');
}

Expand Down

0 comments on commit ee700c1

Please sign in to comment.