diff --git a/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml b/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml index 7dbd7370..1e838b37 100644 --- a/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml +++ b/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml @@ -56,6 +56,21 @@ spec: #!/busybox/sh set -e + # Set up Docker credentials from workspace + DOCKER_CREDS_PATH="$(workspaces.docker-credentials.path)" + echo "Setting up Docker credentials from: $DOCKER_CREDS_PATH" + mkdir -p /tekton/home/.docker + if [ -f "$DOCKER_CREDS_PATH/config.json" ]; then + cp "$DOCKER_CREDS_PATH/config.json" /tekton/home/.docker/config.json + echo "Docker config.json copied successfully" + elif [ -f "$DOCKER_CREDS_PATH/.dockerconfigjson" ]; then + cp "$DOCKER_CREDS_PATH/.dockerconfigjson" /tekton/home/.docker/config.json + echo "Docker .dockerconfigjson copied successfully" + else + echo "Warning: No docker credentials found in workspace" + ls -la "$DOCKER_CREDS_PATH/" || echo "Cannot list docker-credentials workspace" + fi + echo "===================================================================" echo "Kaniko Build Configuration" echo "==================================================================="