Skip to content

Commit

Permalink
Add nightly image existance check
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Zgabur <[email protected]>
  • Loading branch information
azgabur committed Nov 21, 2024
1 parent 9fea2bd commit 26eab93
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 7 deletions.
21 changes: 15 additions & 6 deletions deploy/pipeline-nightly-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ spec:
workspaces:
- name: shared-workspace
workspace: shared-workspace
- name: nightly-image-date
taskRef:
kind: Task
name: nightly-image-date
- name: check-image-existence
params:
- name: index-image
value: $(tasks.nightly-image-date.results.nightly-image)
taskRef:
kind: Task
name: check-image-existence
runAfter:
- nightly-image-date
- name: kubectl-login
params:
- name: kube-api
Expand All @@ -31,24 +44,21 @@ spec:
workspaces:
- name: shared-workspace
workspace: shared-workspace
- name: nightly-image-date
taskRef:
kind: Task
name: nightly-image-date
- name: helm-uninstall
params:
- name: kubeconfig-path
value: $(tasks.kubectl-login.results.kubeconfig-path)
runAfter:
- clone
- kubectl-login
- check-image-existence
taskRef:
kind: Task
name: helm-uninstall
workspaces:
- name: shared-workspace
workspace: shared-workspace
- name: helm-install-nightly
- name: helm-install
params:
- name: index-image
value: $(tasks.nightly-image-date.results.nightly-image)
Expand All @@ -60,7 +70,6 @@ spec:
value: $(tasks.kubectl-login.results.kubeconfig-path)
runAfter:
- helm-uninstall
- nightly-image-date
taskRef:
kind: Task
name: helm-install
Expand Down
8 changes: 8 additions & 0 deletions deploy/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ spec:
workspaces:
- name: shared-workspace
workspace: shared-workspace
- name: check-image-existence
params:
- name: index-image
value: $(params.index-image)
taskRef:
kind: Task
name: check-image-existence
- name: kubectl-login
params:
- name: kube-api
Expand All @@ -46,6 +53,7 @@ spec:
runAfter:
- clone
- kubectl-login
- check-image-existence
taskRef:
kind: Task
name: helm-uninstall
Expand Down
26 changes: 26 additions & 0 deletions tasks/deploy/check-image-existence-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: check-image-existence
spec:
params:
- description: Kuadrant image url
name: index-image
type: string
steps:
- args:
- >-
export TAG=$(echo "$(params.index-image)" | sed -r 's/.*:(.*)/\1/') &&
export REPO=$(echo "$(params.index-image)" | sed -r 's/^[^\/]*\/(.*):.*/\1/') &&
export RESPONSE=$(curl -sL "https://quay.io/api/v1/repository/${REPO}/tag/?specificTag=${TAG}") &&
echo "$RESPONSE" | grep -Fv '{"tags": [], "page": 1, "has_additional": false}'
command:
- /bin/sh
- -cexv
computeResources:
limits:
cpu: '250m'
memory: 128Mi
image: quay.io/curl/curl:latest
imagePullPolicy: IfNotPresent
name: check-image-existence
1 change: 1 addition & 0 deletions tasks/deploy/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ resources:
- uninstall-task.yaml
- helm-install-task.yaml
- nightly-image.yaml
- check-image-existence-task.yaml
2 changes: 1 addition & 1 deletion tasks/deploy/nightly-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
command:
- /bin/sh
- -c
resources:
computeResources:
limits:
cpu: '250m'
memory: 128Mi
Expand Down

0 comments on commit 26eab93

Please sign in to comment.