Concourse: How to add "passed" condition on put task

2.1k views Asked by At

I have a concourse pipeline which takes git source code, build then deploy it to pcf.

Now I have to make two deployments after the build, pcf-dev and pcf-qa with dependency of qa over dev. It means if dev deployment is successful then do the qa deployment.

groups: []
resources:
- name: pcf-dev
  type: cf
- name: pcf-qa
  type: cf
- name: source-code
  type: git
resource_types: []
jobs:
- name: build-deploy
  public: true
  plan:
  - get: source-code
  - task: build
    privileged: true
    config:
      platform: linux
      image_resource:
        type: docker-image
        source:
          repository: java
          tag: openjdk-8-alpine
      run:
        path: sh
        args:
        - -exc
        - |
          set -e -u -x
          cd source-code/api/
          ./mvnw package
          cp target/*.jar ../../build-output/api.jar
          cd /tmp
          find .
      inputs:
      - name: source-code
      outputs:
      - name: build-output
  - put: pcf-dev
    params:
      path: build-output/api.jar
  - put: pcf-qa
    params:
      path: build-output/api.jar

I don't know how to use "passed" condition for such case. I know I can use it with "get" but don't know how to use it with "put" for my case.

Can anyone please help?

1

There are 1 answers

0
Josh Zarrabi On

It should work as is. If pcf-dev fails then the job will fail and stop, and pcf-qa won't run. If pcf-dev passes then pcf-qa will run. Tasks only run at the same time if they are in an aggregate block.