0

I am trying to create a pipeline using Concourse CI. The pipeline should:

  1. Get the code from git.
  2. Build and package everything using maven.
  3. Push generated artifact (target/*war) to Cloud Foundry.

Steps 1 and 2 are executed successfully but after hours of trying different configurations, I am not able to access the generated artifact and push it to CF.

I am getting following error in last step: error invalid path: found 0 files instead of 1 at path: /tmp/build/put/mvn-package/target/udm-0.1.war

File pipeline.yml:

resources:
- name: branch-dev
  type: git
  source:
    uri: {{git-url}}
    branch: {{git-branch}}
    private_key: {{private-repo-key}}

- name: PCF-Dev
  type: cf
  source:
    api: {{pcf-api}}
    username: {{pcf-username}}
    password: {{pcf-password}}
    organization: {{pcf-organization}}
    space: {{pcf-space}}
    skip_cert_check: false

jobs:
- name: udm
  serial: true
  plan:
  - get: branch-dev
    trigger: true
  - task: mvn-package
      privileged: true
      file: branch-dev/ci/package.yml
  - put: PCF-Dev
    params:
      manifest: branch-dev/ci/manifest.yml
      path: mvn-package-output/target/udm-0.1.war

File manifest.yml

applications:
- name: udm

File package.yml:

platform: linux

image_resource:
  type: docker-image
  source:
    repository: maven
    tag: latest

inputs:
  - name: branch-dev
outputs:
  - name: mvn-package-output

run:
  path: "mvn"
  args: ["-f", "branch-dev/udm/pom.xml", "package"]

I guess I am missing something. Could someone take a look and point me in the right direction?

muehsi
  • 588
  • 3
  • 19
Rodney
  • 53
  • 1
  • 5
  • Does this path `/tmp/build/put/mvn-package/target/udm-0.1.war` exists after you run step 1 and 2 ? – Jorge Campos Mar 21 '17 at 02:24
  • I hijacked into the container and there is no /tmp/build/put/mvn-package directory. I updated package.yml to generate an output folder. After doing that, I can see the output directory is empty. For some reason mvn package is not saving the output into the folder. – Rodney Mar 21 '17 at 14:03
  • try adding more parameters to `mvn` command line like `-e -x` to debug and see what it is happening. – Jorge Campos Mar 21 '17 at 14:06
  • It looks like you need another step where you copy branch-dev/udm/target/udm-0.1.war to mvn-package-output. Concourse will not do this automatically. – Corby Page Mar 21 '17 at 16:18
  • @CorbyPage, you were right. I added another step to copy the war file to the maven-package-output folder in package.yml and I worked pretty well. set -e -x mvn -f branch-dev/udm/pom.xml clean package cp branch-dev/udm/target/*.war mvn-package-output/. – Rodney Apr 04 '17 at 13:21
  • @Rodney, I am having an issue with maven, ```unknown artifact source: '' in task config file path '/package.yml'```. Did you declare repository types for maven, Could you help me. – Vipul Jun 09 '20 at 14:32

1 Answers1

0

You need to put/get the resource (build artifact) between build/deploy jobs (and have it defined as a resource)

Pivotal projects have very good examples of production Concourse use, like https://github.com/azwickey-pivotal/volume-demo/blob/master/ci/pipeline.yml

Anatoly Kern
  • 621
  • 3
  • 8