Add GitOps stack for abrban.com with Gitea Actions CI/CD.
Build and Deploy Platform / build-push-deploy (push) Has been cancelled

Harbor in-cluster builds via Kaniko, ArgoCD auto-sync, and production Helm values for abrban.com domains.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
keyhan
2026-07-02 01:27:20 +03:30
parent ee5bd0a291
commit 5ed2ef0958
39 changed files with 1841 additions and 99 deletions
+22 -7
View File
@@ -11,6 +11,7 @@ import { AppRuntime } from '../common/enums';
import { ClustersService } from '../clusters/clusters.service';
import { RegistryService } from '../kubernetes/registry.service';
import { BuildProgressStore } from './build-progress.store';
import { SourceStorageService } from '../storage/source-storage.service';
import {
detectDjangoSettingsModule,
detectGoBuildTarget,
@@ -64,6 +65,7 @@ export class BuildService {
private clustersService: ClustersService,
private registryService: RegistryService,
private progressStore: BuildProgressStore,
private sourceStorage: SourceStorageService,
) {}
private beginBuildSession(deploymentId: string): void {
@@ -321,13 +323,23 @@ export class BuildService {
this.beginBuildSession(deploymentId);
}
const codePath = app.codePath ? path.resolve(app.codePath) : null;
const hasUploadedCode = codePath && fs.existsSync(codePath);
const hasUploadedCode = !!app.codePath;
let localZipPath: string | null = null;
let cleanupSource: (() => void) | null = null;
if (hasUploadedCode) {
await validateRuntimeFromArchive(app.runtime, codePath);
try {
const materialized = await this.sourceStorage.materializeToTempFile(app.codePath!);
localZipPath = materialized.path;
cleanupSource = materialized.cleanup;
await validateRuntimeFromArchive(app.runtime, localZipPath);
} catch (e) {
cleanupSource?.();
throw e;
}
}
const archiveEntries = hasUploadedCode ? await listArchiveEntries(codePath!) : [];
const archiveEntries = hasUploadedCode && localZipPath ? await listArchiveEntries(localZipPath) : [];
// Determine Dockerfile based on runtime
const dockerfileContent = this.generateDockerfile(app, archiveEntries);
@@ -377,16 +389,18 @@ export class BuildService {
// If we have uploaded code, create a PVC and upload via kubectl cp
let sourcePvcName: string | undefined;
if (hasUploadedCode) {
if (hasUploadedCode && localZipPath) {
sourcePvcName = `${buildPodName}-source`;
if (deploymentId) {
this.updateBuildSession(deploymentId, { sourcePvcName });
}
const zipSize = fs.statSync(codePath!).size;
const zipSize = await this.sourceStorage.getSize(app.codePath!);
// Allocate PVC size = zip size * 3 (zip + extracted), min 1Gi
const pvcSizeGi = Math.max(1, Math.ceil((zipSize * 3) / (1024 * 1024 * 1024)));
await this.uploadSourceViaPVC(kc, coreApi, buildNamespace!, sourcePvcName, codePath!, pvcSizeGi, deploymentId);
await this.uploadSourceViaPVC(kc, coreApi, buildNamespace!, sourcePvcName, localZipPath, pvcSizeGi, deploymentId);
cleanupSource?.();
cleanupSource = null;
}
// Build the Kaniko Job spec
@@ -653,6 +667,7 @@ export class BuildService {
this.logger.warn(`Failed to clean up ConfigMap: ${e.message}`);
}
this.endBuildSession(deploymentId);
cleanupSource?.();
}
}