apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  annotations:
    build.appstudio.openshift.io/build-nudge-files: bundle/bundle-patch.yaml
    build.appstudio.openshift.io/repo: https://github.com/red-hat-data-services/rhods-operator?rev=5fb40cd939c9c2411a28e29fa7231635823c2636
    build.appstudio.redhat.com/commit_sha: 5fb40cd939c9c2411a28e29fa7231635823c2636
    build.appstudio.redhat.com/target_branch: rhoai-2.16
    chains.tekton.dev/signed: "true"
    pipeline.tekton.dev/release: 58910a4
    pipelinesascode.tekton.dev/branch: rhoai-2.16
    pipelinesascode.tekton.dev/check-run-id: "33368400098"
    pipelinesascode.tekton.dev/controller-info: '{"name":"default","configmap":"pipelines-as-code","secret":"pipelines-as-code-secret",
      "gRepo": "pipelines-as-code"}'
    pipelinesascode.tekton.dev/event-type: push
    pipelinesascode.tekton.dev/git-auth-secret: pac-gitauth-lmvxoa
    pipelinesascode.tekton.dev/git-provider: github
    pipelinesascode.tekton.dev/installation-id: "54743998"
    pipelinesascode.tekton.dev/log-url: https://konflux.apps.stone-prod-p02.hjvn.p1.openshiftapps.com/application-pipeline/ns/rhoai-tenant/pipelinerun/odh-operator-v2-16-on-push-86w2z
    pipelinesascode.tekton.dev/max-keep-runs: "3"
    pipelinesascode.tekton.dev/on-cel-expression: event == "push" && target_branch
      == "rhoai-2.16" && !"bundle/**".pathChanged() && !"Dockerfiles/bundle.Dockerfile".pathChanged()
      && (!"build/**".pathChanged() || "build/operands-map.yaml".pathChanged() ||
      ".tekton/odh-operator-v2-16-push.yaml".pathChanged() ) && !".github/workflows/**".pathChanged()
    pipelinesascode.tekton.dev/original-prname: odh-operator-v2-16-on-push
    pipelinesascode.tekton.dev/repo-url: https://github.com/red-hat-data-services/rhods-operator
    pipelinesascode.tekton.dev/repository: odh-operator-v2-16
    pipelinesascode.tekton.dev/sender: github-actions[bot]
    pipelinesascode.tekton.dev/sha: 5fb40cd939c9c2411a28e29fa7231635823c2636
    pipelinesascode.tekton.dev/sha-title: Updating the operator repo with latest images
      and manifests
    pipelinesascode.tekton.dev/sha-url: https://github.com/red-hat-data-services/rhods-operator/commit/5fb40cd939c9c2411a28e29fa7231635823c2636
    pipelinesascode.tekton.dev/source-branch: rhoai-2.16
    pipelinesascode.tekton.dev/source-repo-url: https://github.com/red-hat-data-services/rhods-operator
    pipelinesascode.tekton.dev/state: started
    pipelinesascode.tekton.dev/url-org: red-hat-data-services
    pipelinesascode.tekton.dev/url-repository: rhods-operator
    results.tekton.dev/childReadyForDeletion: "true"
    results.tekton.dev/log: rhoai-tenant/results/ae67b23d-6485-4036-9efa-60fc1fcdb23e/logs/5de75a5c-7ae9-3cf8-b6f8-faf0cc4f55e2
    results.tekton.dev/record: rhoai-tenant/results/ae67b23d-6485-4036-9efa-60fc1fcdb23e/records/fa82fbcf-5158-4565-9bdd-18069a9de706
    results.tekton.dev/recordSummaryAnnotations: '{"repo":"rhods-operator","commit":"5fb40cd939c9c2411a28e29fa7231635823c2636","eventType":"push"}'
    results.tekton.dev/result: rhoai-tenant/results/ae67b23d-6485-4036-9efa-60fc1fcdb23e
    tekton.dev/pipelines.minVersion: 0.12.1
    tekton.dev/tags: image-build, appstudio
    tekton.dev/taskrunSpanContext: '{"traceparent":"00-ff57107c751bccd09a9efdbb42862bf2-b77e1c57cd24e053-01"}'
  creationTimestamp: "2024-11-22T08:13:58Z"
  finalizers:
  - chains.tekton.dev
  generation: 1
  labels:
    app.kubernetes.io/managed-by: pipelinesascode.tekton.dev
    app.kubernetes.io/version: v0.29.0
    appstudio.openshift.io/application: rhoai-v2-16
    appstudio.openshift.io/component: odh-operator-v2-16
    build.appstudio.redhat.com/build_type: docker
    pipelines.appstudio.openshift.io/type: build
    pipelinesascode.tekton.dev/check-run-id: "33368400098"
    pipelinesascode.tekton.dev/event-type: push
    pipelinesascode.tekton.dev/original-prname: odh-operator-v2-16-on-push
    pipelinesascode.tekton.dev/repository: odh-operator-v2-16
    pipelinesascode.tekton.dev/sha: 5fb40cd939c9c2411a28e29fa7231635823c2636
    pipelinesascode.tekton.dev/state: started
    pipelinesascode.tekton.dev/url-org: red-hat-data-services
    pipelinesascode.tekton.dev/url-repository: rhods-operator
    tekton.dev/memberOf: tasks
    tekton.dev/pipeline: odh-operator-v2-16-on-push-86w2z
    tekton.dev/pipelineRun: odh-operator-v2-16-on-push-86w2z
    tekton.dev/pipelineRunUID: ae67b23d-6485-4036-9efa-60fc1fcdb23e
    tekton.dev/pipelineTask: push-dockerfile
    tekton.dev/task: push-dockerfile-oci-ta
  name: odh-operator-v2-16-on-push-86w2z-push-dockerfile
  namespace: rhoai-tenant
  ownerReferences:
  - apiVersion: tekton.dev/v1
    blockOwnerDeletion: true
    controller: true
    kind: PipelineRun
    name: odh-operator-v2-16-on-push-86w2z
    uid: ae67b23d-6485-4036-9efa-60fc1fcdb23e
  resourceVersion: "504466904"
  uid: fa82fbcf-5158-4565-9bdd-18069a9de706
spec:
  params:
  - name: IMAGE
    value: quay.io/rhoai/odh-rhel8-operator:rhoai-2.16
  - name: IMAGE_DIGEST
    value: sha256:d7d6a380bf807c75215ce8960f133102187f4769364732e4430e0496c6bc8e5e
  - name: DOCKERFILE
    value: Dockerfiles/Dockerfile.konflux
  - name: CONTEXT
    value: .
  - name: SOURCE_ARTIFACT
    value: oci:quay.io/rhoai/odh-rhel8-operator@sha256:5d0ab06b9eceba2d62801735e67276cccc4ae2a90892b44b4717814ffda4ed11
  podTemplate:
    nodeSelector:
      konflux-ci.dev/workload: konflux-tenants
    tolerations:
    - effect: NoSchedule
      key: konflux-ci.dev/workload
      operator: Equal
      value: konflux-tenants
  serviceAccountName: appstudio-pipeline
  taskRef:
    params:
    - name: name
      value: push-dockerfile-oci-ta
    - name: bundle
      value: quay.io/konflux-ci/tekton-catalog/task-push-dockerfile-oci-ta:0.1@sha256:80d48a1b9d2707490309941ec9f79338533938f959ca9a207b481b0e8a5e7a93
    - name: kind
      value: task
    resolver: bundles
  timeout: 2h0m0s
status:
  completionTime: "2024-11-22T08:14:07Z"
  conditions:
  - lastTransitionTime: "2024-11-22T08:14:07Z"
    message: 'failed to create task run pod "odh-operator-v2-16-on-push-86w2z-push-dockerfile":
      translating TaskSpec to Pod: multiple volumes with same name "tekton-internal-secret-volume-imagerepository-for-rhoai-v-zhpht":
      [89].name. Maybe missing or invalid Task rhoai-tenant/'
    reason: PodCreationFailed
    status: "False"
    type: Succeeded
  podName: ""
  provenance: {}
  startTime: "2024-11-22T08:13:58Z"
  taskSpec:
    description: Discover Dockerfile from source code and push it to registry as an
      OCI artifact.
    params:
    - default: application/vnd.konflux.dockerfile
      description: Artifact type of the Dockerfile image.
      name: ARTIFACT_TYPE
      type: string
    - default: .
      description: Path to the directory to use as context.
      name: CONTEXT
      type: string
    - default: ./Dockerfile
      description: Path to the Dockerfile.
      name: DOCKERFILE
      type: string
    - description: The built binary image. The Dockerfile is pushed to the same image
        repository alongside.
      name: IMAGE
      type: string
    - description: The built binary image digest, which is used to construct the tag
        of Dockerfile image.
      name: IMAGE_DIGEST
      type: string
    - description: The Trusted Artifact URI pointing to the artifact with the application
        source code.
      name: SOURCE_ARTIFACT
      type: string
    - default: .dockerfile
      description: Suffix of the Dockerfile image tag.
      name: TAG_SUFFIX
      type: string
    results:
    - description: Digest-pinned image reference to the Dockerfile image.
      name: IMAGE_REF
      type: string
    stepTemplate:
      name: ""
      resources: {}
      volumeMounts:
      - mountPath: /var/workdir
        name: workdir
    steps:
    - args:
      - use
      - oci:quay.io/rhoai/odh-rhel8-operator@sha256:5d0ab06b9eceba2d62801735e67276cccc4ae2a90892b44b4717814ffda4ed11=/var/workdir/source
      image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:81c4864dae6bb11595f657be887e205262e70086a05ed16ada827fd6391926ac
      name: use-trusted-artifact
      resources: {}
    - env:
      - name: IMAGE
        value: quay.io/rhoai/odh-rhel8-operator:rhoai-2.16
      - name: IMAGE_DIGEST
        value: sha256:d7d6a380bf807c75215ce8960f133102187f4769364732e4430e0496c6bc8e5e
      - name: TAG_SUFFIX
        value: .dockerfile
      - name: DOCKERFILE
        value: Dockerfiles/Dockerfile.konflux
      - name: CONTEXT
        value: .
      - name: ARTIFACT_TYPE
        value: application/vnd.konflux.dockerfile
      - name: IMAGE_REF_RESULT
        value: /tekton/results/IMAGE_REF
      image: quay.io/konflux-ci/oras:latest@sha256:b7e810730d97fe862826a048773a7539e469453df3681fd22de9754722266c69
      name: push
      resources: {}
      script: |
        set -eu
        set -o pipefail

        # Same discovery logic used in buildah task
        SOURCE_CODE_DIR=source
        if [ -e "$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE" ]; then
          dockerfile_path="$(pwd)/$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE"
        elif [ -e "$SOURCE_CODE_DIR/$DOCKERFILE" ]; then
          dockerfile_path="$(pwd)/$SOURCE_CODE_DIR/$DOCKERFILE"
        elif echo "$DOCKERFILE" | grep -q "^https\?://"; then
          echo "Fetch Dockerfile from $DOCKERFILE"
          dockerfile_path=$(mktemp --suffix=-dockerfile)
          http_code=$(curl -s -L -w "%{http_code}" --output "$dockerfile_path" "$DOCKERFILE")
          if [ $http_code != 200 ]; then
            echo "No Dockerfile is fetched. Server responds $http_code"
            exit 1
          fi
        else
          echo "Cannot find Dockerfile $DOCKERFILE"
          exit 1
        fi

        echo "Selecting auth for $IMAGE"
        auth_json=$(mktemp)
        select-oci-auth $IMAGE >"$auth_json"

        dockerfile_image=${IMAGE%:*}:${IMAGE_DIGEST/:/-}${TAG_SUFFIX}

        dockerfile_for_upload_path=/tmp/Dockerfile
        cp "$dockerfile_path" "$dockerfile_for_upload_path"
        cd "$(dirname $dockerfile_for_upload_path)"
        retry oras push --no-tty \
          --format json \
          --registry-config "$auth_json" \
          --artifact-type "$ARTIFACT_TYPE" \
          "$dockerfile_image" "$(basename $dockerfile_for_upload_path)" |
          yq '.reference' | tr -d '\r\n' >"$IMAGE_REF_RESULT"
      workingDir: /var/workdir
    volumes:
    - emptyDir: {}
      name: workdir
