diff --git a/tasks/docker-registry/task.yaml b/tasks/docker-registry/task.yaml index aa9a764..3154aa8 100644 --- a/tasks/docker-registry/task.yaml +++ b/tasks/docker-registry/task.yaml @@ -8,32 +8,40 @@ spec: type: string description: Subdirectory within the repo where the source code is located default: "" + - name: imageName - description: Base image name with registry + description: Base image name with registry (e.g. docker.unbox-x.net/registry/unbox-x-aisi-cron-app) type: string + - name: tag - description: Version tag to apply to the image + description: Version tag to apply to the image (e.g. v0.2.0) type: string + - name: dockerfile description: Path to Dockerfile type: string default: ./Dockerfile + - name: context description: Build context path (relative to subdirectory) type: string default: . + workspaces: - name: source description: Source code workspace + - name: docker-auth description: Docker registry credentials (username + password) + - name: pypi-auth - description: PyPI registry credentials (username + password) + description: PyPI credentials (username + password) + results: - name: imageUrl - description: Final pushed image URL with tag + 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 @@ -55,48 +63,33 @@ spec: echo "πŸ” Writing Docker config for $REGISTRY..." mkdir -p /tekton/home/.docker - cat > /tekton/home/.docker/config.json < /tekton/home/.docker/config.json - # PyPI 인증 정보 λ³€μˆ˜ μ •μ˜ - echo "πŸ” Setting PyPI auth env..." - PYPI_USERNAME=$(cat /workspace/pypi-auth/username) - PYPI_PASSWORD=$(cat /workspace/pypi-auth/password) - echo "export PYPI_USERNAME=$PYPI_USERNAME" > /tekton/home/pypi-auth.env - echo "export PYPI_PASSWORD=$PYPI_PASSWORD" >> /tekton/home/pypi-auth.env - - # πŸ—οΈ Kaniko 곡식 이미지 μ‹€ν–‰ - name: kaniko-build - image: gcr.io/kaniko-project/executor:v1.23.2 + image: bitnami/kaniko:1.23.2 workingDir: /workspace/source env: - name: DOCKER_CONFIG value: /tekton/home/.docker - - name: PYPI_USERNAME - valueFrom: - configMapKeyRef: - name: pypi-auth-config - key: username - optional: true - - name: PYPI_PASSWORD - valueFrom: - configMapKeyRef: - name: pypi-auth-config - key: password - optional: true - args: - - --dockerfile=$(params.subdirectory)/$(params.dockerfile) - - --context=$(params.subdirectory)/$(params.context) - - --destination=$(params.imageName):$(params.tag) - - --skip-tls-verify - - --reproducible - - --verbosity=debug - - --build-arg=PYPI_USERNAME=$(env PYPI_USERNAME) - - --build-arg=PYPI_PASSWORD=$(env PYPI_PASSWORD) \ No newline at end of file + script: | + #!/bin/sh + set -e + + if [ -n "$(params.subdirectory)" ]; then + cd "$(params.subdirectory)" + fi + + PYPI_USERNAME=$(cat /workspace/pypi-auth/username) + PYPI_PASSWORD=$(cat /workspace/pypi-auth/password) + + echo "πŸš€ Running bitnami/kaniko build..." + /kaniko/executor \ + --dockerfile=$(params.dockerfile) \ + --context=$(params.context) \ + --destination=$(params.imageName):$(params.tag) \ + --skip-tls-verify \ + --reproducible \ + --verbosity=info \ + --build-arg PYPI_USERNAME=$PYPI_USERNAME \ + --build-arg PYPI_PASSWORD=$PYPI_PASSWORD