diff --git a/server/src/deployments/templates/buildpacks.yaml.ts b/server/src/deployments/templates/buildpacks.yaml.ts index 8ad868202..458dcc5ae 100644 --- a/server/src/deployments/templates/buildpacks.yaml.ts +++ b/server/src/deployments/templates/buildpacks.yaml.ts @@ -40,11 +40,12 @@ spec: value: "123456" - name: APP value: example + - name: PATCH_JSON + value: '{"spec":{"image":{"repository":"$REPOSITORY","tag": "$TAG"}}}' command: - sh - -c - - 'kubectl patch kuberoapps $APP --type=merge -p "{\"spec\":{\"image\":{\"repository\": - \"$REPOSITORY\",\"tag\": \"$TAG\"}}}"' + - 'kubectl patch kuberoapps $APP --type=merge -p "$PATCH_JSON"' image: bitnami/kubectl:latest imagePullPolicy: Always resources: {} diff --git a/server/src/deployments/templates/dockerfile.yaml.ts b/server/src/deployments/templates/dockerfile.yaml.ts index a4d2bd4a7..6c7788dc8 100644 --- a/server/src/deployments/templates/dockerfile.yaml.ts +++ b/server/src/deployments/templates/dockerfile.yaml.ts @@ -41,11 +41,12 @@ spec: value: 123456 - name: APP value: example + - name: PATCH_JSON + value: '{"spec":{"image":{"repository":"$REPOSITORY","tag": "$TAG"}}}' command: - sh - -c - - 'kubectl patch kuberoapps $APP --type=merge -p "{\"spec\":{\"image\":{\"repository\": - \"$REPOSITORY\",\"tag\": \"$TAG\"}}}"' + - 'kubectl patch kuberoapps $APP --type=merge -p "$PATCH_JSON"' image: bitnami/kubectl:latest imagePullPolicy: Always name: deploy diff --git a/server/src/deployments/templates/nixpacks.yaml.ts b/server/src/deployments/templates/nixpacks.yaml.ts index 62a6ba63a..47868b062 100644 --- a/server/src/deployments/templates/nixpacks.yaml.ts +++ b/server/src/deployments/templates/nixpacks.yaml.ts @@ -41,11 +41,12 @@ spec: value: 123456 - name: APP value: example + - name: PATCH_JSON + value: '{"spec":{"image":{"repository":"$REPOSITORY","tag": "$TAG"}}}' command: - sh - -c - - 'kubectl patch kuberoapps $APP --type=merge -p "{\"spec\":{\"image\":{\"repository\": - \"$REPOSITORY\",\"tag\": \"$TAG\"}}}"' + - 'kubectl patch kuberoapps $APP --type=merge -p "$PATCH_JSON"' image: bitnami/kubectl:latest imagePullPolicy: Always name: deploy diff --git a/server/src/kubernetes/kubernetes.service.ts b/server/src/kubernetes/kubernetes.service.ts index 0749222f3..6e3914ad6 100644 --- a/server/src/kubernetes/kubernetes.service.ts +++ b/server/src/kubernetes/kubernetes.service.ts @@ -1309,9 +1309,12 @@ export class KubernetesService { job.spec.template.spec.initContainers[0].env[0].value = git.url; job.spec.template.spec.initContainers[0].env[1].value = git.ref; job.spec.template.spec.containers[0].env[0].value = repository.image; - job.spec.template.spec.containers[0].env[1].value = - repository.tag + '-' + id; + const tag = repository.tag + '-' + id; + job.spec.template.spec.containers[0].env[1].value = tag; job.spec.template.spec.containers[0].env[2].value = appName; + job.spec.template.spec.containers[0].env[3].value = JSON.stringify({ + spec: { image: { repository: repository.image, tag: tag } }, + }); if (buildstrategy === 'buildpacks') { // configure build container