diff --git a/init.sh b/init.sh index eb6745a..28bbdbb 100755 --- a/init.sh +++ b/init.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # check if all required variables are set -if [ -z "$NAME" ] || [ -z "$APP" ] || [ -z "$PHASE" ] || [ -z "$PIPELINE" ] || [ -z "$TAG" ] || [ -z "$SERVICE_ACCOUNT" ] || [ -z "$BUILDER" ] || [ -z "$URL" ] || [ -z "$REVISION" ]; then +if [ -z "$NAME" ] || [ -z "$APP" ] || [ -z "$PHASE" ] || [ -z "$PIPELINE" ] || [ -z "$REPOSITORY" ] || [ -z "$TAG" ] || [ -z "$SERVICE_ACCOUNT" ] || [ -z "$BUILDER" ] || [ -z "$URL" ] || [ -z "$REVISION" ]; then echo "One or more required variables are not set" exit 1 fi @@ -13,7 +13,7 @@ metadata: name: ${NAME} spec: tags: - - ${TAG} + - ${REPOSITORY}:${TAG} serviceAccountName: ${SERVICE_ACCOUNT} builder: image: ${BUILDER} @@ -49,7 +49,7 @@ done sleep 2 # patch kuberoes resource with the new image -kubectl patch kuberoapps.application.kubero.dev ${APP} -p "{\"spec\":{\"image\":\"${IMAGE}\"}}" +kubectl patch kuberoapps.application.kubero.dev ${APP} -p "{\"spec\":{\"image\":{\"repository\":"${REPOSITORY}",\"tag\":\"${TAG}\"}}}" if [ $? -ne 0 ]; then echo "Failed to patch kubero app resource" exit 1 diff --git a/job.example.yaml b/job.example.yaml index afba28c..6f57b50 100644 --- a/job.example.yaml +++ b/job.example.yaml @@ -2,11 +2,11 @@ apiVersion: batch/v1 kind: Job metadata: labels: - batch.kubernetes.io/job-name: asdf - job-name: asdf - name: asdf + batch.kubernetes.io/job-name: example + job-name: example + name: example spec: - backoffLimit: 6 + backoffLimit: 2 completionMode: NonIndexed completions: 1 manualSelector: false @@ -17,13 +17,13 @@ spec: metadata: creationTimestamp: null labels: - batch.kubernetes.io/job-name: asdf - job-name: asdf + batch.kubernetes.io/job-name: example + job-name: example spec: containers: - image: ghcr.io/kubero-dev/deployer:latest imagePullPolicy: Always - name: asdf + name: example resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File @@ -36,15 +36,17 @@ spec: value: dev - name: PIPELINE value: pipelinename + - name: REPOSITORY + value: registry.kubero.linode.shoks.ch/kapck/example - name: TAG - value: registry.yourdomain.com/kapck/example:latest + value: latest - name: SERVICE_ACCOUNT value: kpack-sa - name: BUILDER value: gcr.io/paketo-buildpacks/builder:base - name: URL value: https://github.com/kubero-dev/template-nodeapp.git - - name: REVISON + - name: REVISION value: main dnsPolicy: ClusterFirst restartPolicy: Never