Skip to content

Commit

Permalink
fix: yaml dump indent 4, bump api [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurice Faber committed Oct 9, 2021
1 parent 64dd032 commit 64c501e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/cmd/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ export const bootstrapValues = async (): Promise<void> => {
['core.yaml', 'docker-compose.yml'].map((val) => copyFile(`${rootDir}/${val}`, `${env.ENV_DIR}/${val}`)),
)

let originalValues: Record<string, any> | undefined
let originalValues: Record<string, any>
let generatedSecrets
if (isChart) {
originalValues = getInputValues() as Record<string, any>
// store chart input values, so they can be merged with gerenerated passwords
await writeValues(originalValues)
generatedSecrets = await getOtomiSecrets(originalValues)
} else {
originalValues = await valuesOrEmpty()
originalValues = (await valuesOrEmpty()) as Record<string, any>
generatedSecrets = await generateSecrets(originalValues)
}
// Ensure that .dec files are in place, because the writeValues() relies on them.
Expand Down
8 changes: 4 additions & 4 deletions src/common/values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { cloneDeep, isEmpty, isEqual, merge, omit, pick } from 'lodash-es'
import { env } from './envalid'
import { extract, flattenObject, getValuesSchema, loadYaml, terminal } from './utils'

const objectToString = (obj: Record<string, any>): string => {
return isEmpty(obj) ? '' : dump(obj)
const objectToYaml = (obj: Record<string, any>): string => {
return isEmpty(obj) ? '' : dump(obj, { indent: 4 })
}

export function removeBlankAttributes(obj: Record<string, unknown>): Record<string, unknown> {
Expand All @@ -34,7 +34,7 @@ export const writeValuesToFile = async (
const nonEmptyValues = removeBlankAttributes(values)
d.debug('nonEmptyValues: ', JSON.stringify(nonEmptyValues, null, 2))
if (!existsSync(targetPath)) {
return writeFile(targetPath, objectToString(nonEmptyValues))
return writeFile(targetPath, objectToYaml(nonEmptyValues))
}
const suffix = targetPath.includes('/secrets.') && hasSops ? '.dec' : ''
const originalValues = loadYaml(`${targetPath}${suffix}`, { noError: true }) ?? {}
Expand All @@ -45,7 +45,7 @@ export const writeValuesToFile = async (
return undefined
}
d.debug('mergeResult: ', JSON.stringify(mergeResult, null, 2))
const res = writeFile(`${targetPath}${suffix}`, objectToString(mergeResult))
const res = writeFile(`${targetPath}${suffix}`, objectToYaml(mergeResult))
d.info(`Values were written to ${targetPath}${suffix}`)
return res
}
Expand Down
2 changes: 1 addition & 1 deletion values/otomi-api/otomi-api.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ resources:
image:
registry: eu.gcr.io
repository: otomi-cloud/otomi-api
tag: {{ $o | get "image.tag" "v0.4.74" }}
tag: {{ $o | get "image.tag" "v0.4.75" }}
pullPolicy: {{ $o | get "image.pullPolicy" "IfNotPresent" }}

secrets:
Expand Down

0 comments on commit 64c501e

Please sign in to comment.