Skip to content

Commit

Permalink
fix patch
Browse files Browse the repository at this point in the history
  • Loading branch information
mms-gianni committed May 21, 2024
1 parent 4ce7458 commit 7abfcf0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
6 changes: 3 additions & 3 deletions init.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -13,7 +13,7 @@ metadata:
name: ${NAME}
spec:
tags:
- ${TAG}
- ${REPOSITORY}:${TAG}
serviceAccountName: ${SERVICE_ACCOUNT}
builder:
image: ${BUILDER}
Expand Down Expand Up @@ -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
Expand Down
20 changes: 11 additions & 9 deletions job.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7abfcf0

Please sign in to comment.