Skip to content

Commit 7525219

Browse files
author
Maurice Faber
committed
fix: cd issues, chart bump
1 parent dd1145b commit 7525219

File tree

8 files changed

+19
-15
lines changed

8 files changed

+19
-15
lines changed

chart/otomi/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: A Helm chart for installing otomi in Kubernetes
44
home: https://otomi.io/
55
icon: https://otomi.io/img/otomi-logo.svg
66
type: application
7-
version: '0.2.0-rc1'
7+
version: '0.2.1'
88
appVersion: 'APP_VERSION_PLACEHOLDER'
99
keywords:
1010
- otomi

chart/otomi/templates/job.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,5 @@ spec:
6161
- name: otomi-values
6262
emptyDir: {}
6363
restartPolicy: Never
64+
# Don't restart as it recreates passwords every time!
65+
backoffLimit: 1

charts/gitea/templates/gitea/init.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ stringData:
5858
|| \
5959
( \
6060
export GITEA_AUTH_ID=$(gitea admin auth list | grep {{ .Values.gitea.oauth.name | quote }} | awk -F " " "{print \$1}"); \
61-
gitea admin auth update-oauth --id ${GITEA_AUTH_ID} \
61+
gitea admin auth update-oauth --id "${GITEA_AUTH_ID}" \
6262
{{- include "gitea.oauth_settings" . | nindent 6 }} \
6363
) \
6464
{{- end }}

helmfile.d/snippets/domains.gotmpl

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626
{{- end }}
2727
{{- end }}
2828
{{- end }}
29-
{{- $proxyDomain := print "proxy." $v.cluster.domainSuffix }}
3029
{{- $authDomain := print "auth." $v.cluster.domainSuffix }}
31-
{{- $domains = concat $domains (list (dict "domain" $proxyDomain "hasCert" false "certArn" "" "certName" "") (dict "domain" $authDomain "hasCert" false "certArn" "" "certName" "")) }}
30+
{{- $domains = concat $domains (list (dict "domain" $authDomain "hasCert" false "certArn" "" "certName" "")) }}
3231
domains:
3332
{{- range $domInfo := $domains }}
3433
- {{- $domInfo | toYaml | nindent 4 }}

src/cmd/apply.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { mkdirSync, rmdirSync, writeFileSync } from 'fs'
22
import { Argv, CommandModule } from 'yargs'
33
import { $, cd, nothrow } from 'zx'
44
import { env } from '../common/envalid'
5-
import { hf, hfStream } from '../common/hf'
5+
import { hf, hfStream, hfValues } from '../common/hf'
66
import { cleanupHandler, prepareEnvironment } from '../common/setup'
77
import {
88
getFilename,
@@ -43,6 +43,12 @@ const commitOnFirstRun = async () => {
4343
cd(env.ENV_DIR)
4444

4545
const healthUrl = (await $`git config --get remote.origin.url`).stdout.trim()
46+
const isCertStaging = (await hfValues()).charts?.['cert-manager']?.stage === 'staging'
47+
if (isCertStaging) {
48+
process.env.GIT_SSL_NO_VERIFY = 'true'
49+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
50+
}
51+
4652
await waitTillAvailable(healthUrl)
4753

4854
if ((await nothrow($`git ls-remote`)).stdout.trim().length !== 0) return

src/cmd/commit.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ interface Arguments extends HelmArgs, DroneArgs {}
1919
export const preCommit = async (): Promise<void> => {
2020
const pcDebug = terminal('Pre Commit')
2121
pcDebug.info('Check for cluster diffs')
22-
cd(env.ENV_DIR)
2322
const settingsDiff = (await nothrow($`git diff env/settings.yaml`)).stdout.trim()
2423
const secretDiff = (await nothrow($`git diff env/secrets.settings.yaml`)).stdout.trim()
2524
cd(rootDir)
@@ -50,13 +49,9 @@ export const gitPush = async (branch: string): Promise<boolean> => {
5049

5150
export const commit = async (): Promise<void> => {
5251
await validateValues()
53-
5452
debug.info('Preparing values')
55-
56-
cd(env.ENV_DIR)
57-
5853
const values = await hfValues()
59-
54+
cd(env.ENV_DIR)
6055
preCommit()
6156
await encrypt()
6257
debug.info('Committing values')
@@ -69,7 +64,9 @@ export const commit = async (): Promise<void> => {
6964
debug.log('Something went wrong trying to commit. Did you make any changes?')
7065
}
7166

72-
if (!env.CI) await pull()
67+
// if (!env.CI) await pull()
68+
// previous command returned to rootDir, so go back to env:
69+
cd(env.ENV_DIR)
7370
let branch: string
7471
if (values.charts?.gitea?.enabled === false) {
7572
branch = values.charts!['otomi-api']!.git!.branch ?? 'main'

src/common/utils.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ export const waitTillAvailable = async (dom: string, subsequentExists = 3): Prom
240240
const domain = dom.startsWith('http') ? dom : `https://${dom}`
241241
const waitDebug = terminal('waitTillAvailable')
242242
let count = 0
243+
const timeout = 10
243244
// Need to wait for 3 subsequent exists, since DNS doesn't always propagate equally
244245
do {
245246
waitDebug.debug(`Waiting for ${domain} ...`)
@@ -257,9 +258,9 @@ export const waitTillAvailable = async (dom: string, subsequentExists = 3): Prom
257258
waitDebug.error(error.message)
258259
}
259260
// eslint-disable-next-line no-await-in-loop
260-
await sleep(250)
261+
await sleep(timeout * 1000)
261262
} while (count < subsequentExists)
262-
waitDebug.debug(`Waiting for ${domain} succeeded`)
263+
waitDebug.debug(`Waiting ${timeout} secs for ${domain} to become available`)
263264
}
264265

265266
export const flattenObject = (obj: Record<string, any>, path = ''): { [key: string]: string } => {

values-schema.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ definitions:
248248
type: string
249249
required:
250250
- domainSuffix
251-
- k8sContext
252251
- k8sVersion
253252
- name
254253
- owner

0 commit comments

Comments
 (0)