diff --git a/server/src/kubero.ts b/server/src/kubero.ts index c623ebcd..e1963a81 100644 --- a/server/src/kubero.ts +++ b/server/src/kubero.ts @@ -349,9 +349,6 @@ export class Kubero { if (contextName) { await this.kubectl.createApp(app, contextName); - if (app.deploymentstrategy == 'git' && (app.buildstrategy == 'dockerfile' || app.buildstrategy == 'nixpacks' || app.buildstrategy == 'buildpacks')){ - this.triggerImageBuild(app.pipeline, app.phase, app.name); - } this.appStateList.push(app); const m = { @@ -369,6 +366,13 @@ export class Kubero { } } as INotification; this.notification.send(m, this._io); + + if (app.deploymentstrategy == 'git' && (app.buildstrategy == 'dockerfile' || app.buildstrategy == 'nixpacks' || app.buildstrategy == 'buildpacks')){ + + // Wait 2 seconds to make sure the app is created + await new Promise(resolve => setTimeout(resolve, 2000)); + this.triggerImageBuild(app.pipeline, app.phase, app.name); + } } } diff --git a/server/src/modules/templates/nixpacks.yaml b/server/src/modules/templates/nixpacks.yaml index ce2ae540..3f376442 100644 --- a/server/src/modules/templates/nixpacks.yaml +++ b/server/src/modules/templates/nixpacks.yaml @@ -81,7 +81,12 @@ spec: command: - sh - -c - - nixpacks build . -o . + - |- + cd $BUILD_BASE_DIR + nixpacks build . -o . + env: + - name: BUILD_BASE_DIR + value: /app image: "ghcr.io/kubero-dev/build:latest" imagePullPolicy: Always resources: {} @@ -98,6 +103,7 @@ spec: - sh - -c - |- + cd $BUILD_BASE_DIR buildah build -f $BUILDAH_DOCKERFILE_PATH --isolation chroot -t $BUILD_IMAGE . buildah push --tls-verify=false $BUILD_IMAGE env: @@ -106,7 +112,9 @@ spec: - name: BUILD_IMAGE value: registry-kubero.yourdomain.com/optionalrepositoryowner/pipeline/app:123456 - name: BUILDAH_DOCKERFILE_PATH - value: /app/Dockerfile + value: Dockerfile + - name: BUILD_BASE_DIR + value: /app image: "quay.io/containers/buildah:v1.35" imagePullPolicy: IfNotPresent resources: {}