siamaksade / pipelines-examples

OpenShift Pipelines Examples based on Tekton
31 stars 49 forks source link

Issues running build pipeline #4

Open gbengataylor opened 4 years ago

gbengataylor commented 4 years ago

When the build-image task is run it fails because it can't find the Dockerfile in the copied source directory created by the build-app task. It seems by default (https://github.com/tektoncd/pipeline/blob/master/docs/tasks.md#outputs) the output is always in /workspace/output/source but when the git repo was cloned it was copied to / and that is the working directory

I modified the mvn-build task to clone to /workspace/output/source and run the maven build using that location as the working directory. Another workaround could have been to add a step to copy the directory

I also had to add an empty volume to get pass an "/.m2 doesn't exist" error

apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
  name: mvn-build
spec:
  inputs:
    resources:
      - name: source
        targetPath: output/source
        type: git
  outputs:
    resources:
      - name: source
        type: git
  steps:
    - args:
        - verify
      command:
        - /usr/bin/mvn
      image: 'maven:3.6.0-jdk-8-slim'
      name: build
      resources: {}
      volumeMounts:
        - mountPath: /.m2
          name: m2-repository
      workingDir: /workspace/output/source
  volumes:
    - emptyDir: {}
      name: m2-repository

I can create a PR if you wish