Skip to content

Commit

Permalink
chore: Join Kaniko task for Dockerhub and Harbor into one (#47)
Browse files Browse the repository at this point in the history
Jira EPMDEDP-12618
Related #47

Change-Id: I99fb9a88dbd1b4688d1d34c3754020ad27196699
  • Loading branch information
Mykola Serdiuk committed Oct 12, 2023
1 parent 9078265 commit b37b165
Showing 1 changed file with 0 additions and 81 deletions.
81 changes: 0 additions & 81 deletions charts/pipelines-library/templates/tasks/kaniko-eks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,84 +93,3 @@ spec:
image="$(params.IMAGE)"
echo -n "${image}" | tee "$(results.IMAGE_URL.path)"
{{- end }}

{{- if and (eq .Values.global.platform "kubernetes") (eq .Values.global.dockerRegistry.type "dockerhub") }}
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: kaniko
labels:
app.kubernetes.io/based-on: "0.6"
{{- include "edp-tekton.labels" . | nindent 4 }}
annotations:
tekton.dev/pipelines.minVersion: "0.17.0"
tekton.dev/categories: Image Build
tekton.dev/tags: image-build
tekton.dev/displayName: "Build and upload container image using Kaniko"
tekton.dev/platforms: "linux/amd64"
spec:
description: >-
This Task builds a simple Dockerfile with kaniko and pushes to a registry.
This Task stores the image name and digest as results, allowing Tekton Chains to pick up
that an image was built & sign it.
params:
- name: IMAGE
description: Name (reference) of the image to build.
- name: IMAGE_TAR
description: Name (reference) of the image tar.
default: "image_tar"
- name: DOCKERFILE
description: Dockerfile name.
default: "Dockerfile"
- name: CONTEXT
description: The build context used by Kaniko.
default: ./
- name: BUILDER_IMAGE
description: The image on which builds will run
default: {{ .Values.kaniko.image.repository }}:{{ .Values.kaniko.image.tag}}-debug
- name: KANIKO_CACHE_REPO
description: The repo where Kaniko stores cached image layers
default: ""
workspaces:
- name: source
description: Holds the context and Dockerfile
volumes:
- name: dockerconfig
secret:
secretName: kaniko-docker-config
items:
- key: .dockerconfigjson
path: config.json
optional: true
results:
- name: IMAGE_DIGEST
description: Digest of the image just built.
- name: IMAGE_URL
description: URL of the image just built.
steps:
- name: build-and-push
workingDir: $(workspaces.source.path)
image: $(params.BUILDER_IMAGE)
script: |
/kaniko/executor \
--dockerfile=$(workspaces.source.path)/$(params.DOCKERFILE) \
--context=$(workspaces.source.path)/$(params.CONTEXT) \
--destination=$(params.IMAGE) \
--digest-file=$(results.IMAGE_DIGEST.path) \
--cache=true \
--cache-repo=$(params.KANIKO_CACHE_REPO) \
--tar-path=$(params.IMAGE_TAR).tar
securityContext:
runAsUser: 0
volumeMounts:
- name: dockerconfig
mountPath: /kaniko/.docker
{{- include "resources" . | nindent 6 }}
- image: alpine:3.18.3
name: write-url
resources: {}
script: |
set -e
image="$(params.IMAGE)"
echo -n "${image}" | tee "$(results.IMAGE_URL.path)"
{{- end }}

0 comments on commit b37b165

Please sign in to comment.