Skip to content

Commit

Permalink
Pass deploy params to status check command
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarek-kindred committed Dec 17, 2024
1 parent b467a27 commit ad356dc
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions k8s-deployer/src/deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,25 @@ export const deployApplication = async (
let command = instructions.command
if (options?.namespace) command = `${ command } ${ options.namespace }`

const allParams = new Array()
// first pass params delcared in the pitfile
if (instructions.params) {
instructions.params.forEach(v => allParams.push(v))
}
// then pass additional params computed by deployer
if (options?.deployerParams) {
options.deployerParams.forEach(v => allParams.push(v))
}
for (let param of allParams) {
command = `${command} ${param}`
const fnCmdWithParams = (cmd: string, pitfileParams?: Array<string>, deployOptions?: DeployOptions) => {
const result = cmd
const allParams = new Array()
// first pass params delcared in the pitfile
if (pitfileParams) {
pitfileParams.forEach(v => allParams.push(v))
}
// then pass additional params computed by deployer
if (deployOptions?.deployerParams) {
deployOptions.deployerParams.forEach(v => allParams.push(v))
}
for (let param of allParams) {
result = `${result} ${param}`
}

return result
}

command = fnCmdWithParams(command, instructions.params, options)

const logFileName = `${ workspace }/logs/deploy-${ namespace }-${ appId }.log`
const opts: any = { homeDir: appDirectory, logFileName, tailTarget: (line: string) => {
Expand Down Expand Up @@ -145,6 +152,8 @@ export const deployApplication = async (
try {
let command = instructions.statusCheck.command
if (options?.namespace) command = `${ command } ${ options?.namespace }`

command = fnCmdWithParams(command, instructions.params)
await Shell.exec(command, { homeDir: appDirectory })

logger.info("Success")
Expand Down

0 comments on commit ad356dc

Please sign in to comment.