apiVersion: tekton.dev/v1 kind: Task metadata: name: docker-registry spec: params: - name: subdirectory type: string description: Subdirectory within the repo where the source code is located default: "" - name: imageName type: string description: Base image name with registry (e.g. docker.unbox-x.net/registry/unbox-x-aisi-cron-app) - name: tag type: string description: Version tag to apply to the image (e.g. v0.2.0) - name: dockerfile type: string default: ./Dockerfile description: Path to Dockerfile - name: context type: string default: . description: Build context path (relative to subdirectory) - name: pypi-username type: string description: PyPI registry username - name: pypi-password type: string description: PyPI registry password workspaces: - name: source description: Source code workspace - name: docker-auth description: Docker registry credentials (username + password) results: - name: imageUrl description: Final pushed image URL with tag (e.g. registry/app:v0.2.0) steps: - name: write-docker-config image: alpine:3.21.3 workingDir: /workspace/source script: | #!/bin/sh set -e if [ -n "$(params.subdirectory)" ]; then cd "$(params.subdirectory)" fi IMAGE="$(params.imageName):$(params.tag)" USERNAME=$(cat /workspace/docker-auth/username) PASSWORD=$(cat /workspace/docker-auth/password) REGISTRY=$(echo "$IMAGE" | cut -d/ -f1) echo "📦 Using image: $IMAGE" echo -n "$IMAGE" > /tekton/results/imageUrl echo "🔐 Writing Docker config for $REGISTRY..." mkdir -p /tekton/home/.docker cat > /tekton/home/.docker/config.json <