40 lines
937 B
YAML

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: crane-task
spec:
workspaces:
- name: source
- name: dockerconfig
params:
- name: IMAGE_TAG
type: string
description: "The image to push."
- name: IMAGE
type: string
description: "The image to push."
- name: REGISTRY
description: Docker Registry
steps:
- name: push-image-tar
image: gcr.io/go-containerregistry/crane:debug
script: |
#!/busybox/sh
set -eu -o pipefail
echo ""
echo "== CONFIGURE CREDENTIALS ==================================="
mkdir ~/.docker
cp $(workspaces.dockerconfig.path)/config.json ~/.docker/config.json
echo ""
echo "== PUSH IMAGE ==================================="
crane push $(workspaces.source.path)/image.tar $(params.REGISTRY)/$(params.IMAGE):$(params.IMAGE_TAG)
echo ""
echo ""