<p>I have a below pipeline</p>
<pre><code>apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: git-clone-pipeline
spec:
  params:
    - name: repo-url
      type: string
  workspaces:
    - name: shared-workspace
  tasks:
    - name: clone-repository
      taskRef:
        name: git-clone
      workspaces:
        - name: output
          workspace: shared-workspace
      params:
        - name: url
          value: &quot;$(params.repo-url)&quot;
        - name: deleteExisting
          value: &quot;true&quot;
    - name: build
      taskRef:
        name: gradle
      runAfter:
        - &quot;clone-repository&quot;
      params:
        - name: TASKS
          value: build
        - name: GRADLE_IMAGE
          value: docker.io/library/gradle:jdk17-alpine@sha256:dd16ae381eed88d2b33f977b504fb37456e553a1b9c62100b8811e4d8dec99ff
        - name: PROJECT_DIR
          value: ./discount-api
      workspaces:
        - name: source
          workspace: shared-workspace
</code></pre>
<p>And <strong>pipeline-run</strong></p>
<pre><code>apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  name: run-pipeline
  namespace: tekton-pipelines
spec:
  serviceAccountName: git-service-account
  pipelineRef:
    name: git-clone-pipeline
  workspaces:
    - name: shared-workspace
      emptyDir: {}
  params:
    - name: repo-url
      value: git@bitbucket.org:anandjaisy/discount.git
</code></pre>
<p>And a project structure directory as</p>
<p><a href="https://i.stack.imgur.com/o8mEq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o8mEq.png" alt="enter image description here" /></a></p>
<p>Facing an issue during the pipeline run</p>
<pre><code>2022-06-18T08:17:57.775506334Z Directory '/workspace/source/discount-api' does not contain a Gradle build.
</code></pre>
<p>This issue is related to the file not being found. The git-clone task has cloned the code somewhere in the cluster. How do I know where is the code?</p>
<pre><code>kubectl get pods

run-pipeline-build-pod                               0/1     Error       0          173m
run-pipeline-fetch-source-pod                        0/1     Completed   0          173m
tekton-dashboard-b7b8599c6-wf7b2                     1/1     Running     0          12d
tekton-pipelines-controller-674dd45d79-529pc         1/1     Running     0          12d
tekton-pipelines-webhook-86b8b9d87b-qmxzk            1/1     Running     0          12d
tekton-triggers-controller-6d769dddf7-847nt          1/1     Running     0          12d
tekton-triggers-core-interceptors-69c47c4bb7-77bvt   1/1     Running     0          12d
tekton-triggers-webhook-7c4fc7c74-lgm79              1/1     Running     0          12d
</code></pre>
<p>If we do logs on POD <code>run-pipeline-build-pod</code> gets an exception as above.</p>
<pre><code>kubectl exec --stdin --tty &lt;Pod-name&gt; -- /bin/bash
</code></pre>
<p>The above command is used to go inside the pod, however, in the above case the <code>run-pipeline-fetch-source-pod</code> is completed and we can't apply the above code.</p>
<p>How can I solve this file issue ?</p>

<p>You're using an emptyDir as a workspace. You should use a PVC. You could fix your PipelineRun with something like this:</p>
<pre><code>workspaces:
- name: shared-workspace
  volumeClaimTemplate:
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 2Gi
</code></pre>
<p>The workspace is used by your git clone task. Describing the git-clone pod from your PipelineRun, you should find a volume of type emptyDir. Which is where data is cloned.</p>
<p>Then, using that workspace in another Task, being an emptyDir, in another Pod: you're starting from scratch, there's no data when pod starts. A PVC would allow you to share data in between tasks.</p>
<hr />
<p>As for debugging: once pods are completed, there's not much to do.</p>
<p>Debugging PipelineRuns, if it exits too fast for me to <code>kubectl exec -it</code> a Pod, I would try to change the failing container arguments (editing the corresponding Task), adding some &quot;sleep 86400&quot; or something equivalent, instead of its usual command. Then restart a PipelineRun.</p>
<p>In your case, if you already had a PVC as your workspace: it would have been easier to just start a Pod (create a deployment), attach the PVC created by your PipelineRun, checking what's in there, ...</p>
