From 8d303d3378f72f4be45c85cc7ecfb68504971044 Mon Sep 17 00:00:00 2001 From: Ani1357 Date: Wed, 30 Jul 2025 10:38:48 +0200 Subject: [PATCH 1/3] feat: adding aplCharts version support --- src/cmd/commit.ts | 30 ++++++++++++++++++------------ versions.yaml | 1 + 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/cmd/commit.ts b/src/cmd/commit.ts index 8d2aacfe1b..0c10d6ffdc 100644 --- a/src/cmd/commit.ts +++ b/src/cmd/commit.ts @@ -9,7 +9,7 @@ import { terminal } from 'src/common/debug' import { env, isCi } from 'src/common/envalid' import { hfValues } from 'src/common/hf' import { createGenericSecret, k8s, waitTillGitRepoAvailable } from 'src/common/k8s' -import { getFilename } from 'src/common/utils' +import { getFilename, loadYaml } from 'src/common/utils' import { getRepo } from 'src/common/values' import { getParsedArgs, HelmArguments, setParsedArgs } from 'src/common/yargs' import { Argv } from 'yargs' @@ -19,6 +19,8 @@ import { validateValues } from './validate-values' const cmdName = getFilename(__filename) +export const rootDir = process.cwd() === '/home/app/stack/env' ? '/home/app/stack' : process.cwd() + interface Arguments extends HelmArguments, DroneArgs { m?: string message?: string @@ -130,22 +132,24 @@ export const commit = async (initialInstall: boolean, overrideArgs?: HelmArgumen export const cloneOtomiChartsInGitea = async (): Promise => { const d = terminal(`cmd:${cmdName}:gitea-apl-charts`) - d.info('Checking if apl-charts already exists in Gitea') + const versions = await loadYaml(`${rootDir}/versions.yaml`, { noError: true }) + const tag = versions?.aplCharts + d.info(`Checking if apl-charts tag '${tag}' already exists in Gitea`) const values = (await hfValues()) as Record const { email, username, password } = getRepo(values) const workDir = '/tmp/apl-charts' const otomiChartsUrl = env.OTOMI_CHARTS_URL const giteaChartsUrl = `http://${username}:${password}@gitea-http.gitea.svc.cluster.local:3000/otomi/charts.git` try { - // Check if remote repository exists by verifying if output from git ls-remote is not empty - const repoExists = await $`git ls-remote ${giteaChartsUrl}` - if (repoExists.stdout.trim()) { - d.info('apl-charts repository already exists in Gitea. Skipping clone and initialization steps.') + // Check if the tag exists in the remote Gitea repository + const tagExists = await $`git ls-remote --tags ${giteaChartsUrl} refs/tags/${tag}` + if (tagExists.stdout.trim()) { + d.info(`Tag '${tag}' already exists in Gitea. Skipping clone and initialization steps.`) return } - d.info('Cloning apl-charts in Gitea') - await $`mkdir ${workDir}` - await $`git clone --depth 1 ${otomiChartsUrl} ${workDir}` + d.info(`Cloning apl-charts at tag '${tag}' from upstream`) + await $`mkdir -p ${workDir}` + await $`git clone --branch ${tag} --depth 1 ${otomiChartsUrl} ${workDir}` cd(workDir) await $`rm -rf .git` await $`rm -rf deployment` @@ -158,14 +162,16 @@ export const cloneOtomiChartsInGitea = async (): Promise => { await setIdentity(username, email) await $`git checkout -b main` await $`git add .` - await $`git commit -m "first commit"` + await $`git commit -m "first commit for tag ${tag}"` + await $`git tag ${tag}` await $`git remote add origin ${giteaChartsUrl}` await $`git config http.sslVerify false` await $`git push -u origin main` + await $`git push origin ${tag}` } catch (error) { - d.info('CloneOtomiChartsInGitea Error ', error?.message?.replace(password, '****')) + d.info('cloneOtomiChartsInGitea Error ', error?.message?.replace(password, '****')) } - d.info('Cloned apl-charts in Gitea') + d.info(`Cloned apl-charts at tag '${tag}' in Gitea`) } export async function retryIsOAuth2ProxyRunning() { diff --git a/versions.yaml b/versions.yaml index d54e4c2e07..f3c2a59e11 100644 --- a/versions.yaml +++ b/versions.yaml @@ -3,3 +3,4 @@ console: main consoleLogin: main tasks: main tools: main +aplCharts: main From dba0d8b55cf7765da947ad856f47883b00915e65 Mon Sep 17 00:00:00 2001 From: Ani1357 Date: Wed, 6 Aug 2025 10:23:39 +0200 Subject: [PATCH 2/3] test: aplCharts tag --- versions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.yaml b/versions.yaml index f3c2a59e11..f7ef181c51 100644 --- a/versions.yaml +++ b/versions.yaml @@ -3,4 +3,4 @@ console: main consoleLogin: main tasks: main tools: main -aplCharts: main +aplCharts: TagApl607 From a3446d1fc3282209d50d8cdea708ad2b4eeef1dc Mon Sep 17 00:00:00 2001 From: Ferruh Cihan <63190600+ferruhcihan@users.noreply.github.com> Date: Thu, 7 Aug 2025 16:40:26 +0200 Subject: [PATCH 3/3] chore: update versions.yaml --- versions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.yaml b/versions.yaml index f7ef181c51..f3c2a59e11 100644 --- a/versions.yaml +++ b/versions.yaml @@ -3,4 +3,4 @@ console: main consoleLogin: main tasks: main tools: main -aplCharts: TagApl607 +aplCharts: main