Skip to content

Skipping few lines from pipeline based on results of previous task script?? #2178

Closed

Description

@mujahidsof

Hi Team,
I have shell script for example-task with if and else. I want to trigger email in if statment only. "else" statement should stop the pipeline and skip - get: email-resource-source and - put: send-an-email.
I tried hard but don't find any solution. Do we have this feature in concourse.
jobs:

  • name: cfusage
    max_in_flight: 1
    plan:
    • get: cfusagerepo
    • task: cf-usage-task
      file: cfusagerepo/ci/tasks/usage-task.yml
      params:
      API_URL: {{API_URL}}
      USERNAME: {{USERNAME}}
      PASSWORD: {{PASSWORD}}
      ORG: {{ORG}}
      ENV: {{ENV}}
      TO: {{TO}}
      THRESHOLD: {{THRESHOLD}}
    • get: email-resource-source
    • put: send-an-email
      params:
      subject: email/subject
      body: email/body
      to: email/usr

Pipeline is broken on every run and it will pass only when it reaches to ELSE statement. I can see only red red :( . I am not happy to see RED i want see BLUE in all cases . :)

Activity

  1. mujahidsof commented on Apr 23, 2018

    @mujahidsof
    Author

    For Work-around i kept try step so it is not breaking the last step put now. :) . Do we have any alternative???

    jobs:

    • name: cfusage
      plan:
      • get: cfusagerepo
      • task: cf-usage-task
        file: cfusagerepo/ci/tasks/usage-task.yml
        params:
        USERNAME: {{USERNAME}}
        PASSWORD: {{PASSWORD}}
        ORG: {{ORG}}
        ENV: {{ENV}}
        TO: {{TO}}
        THRESHOLD: {{THRESHOLD}}
      • get: email-resource-source
      • try:
        put: send-an-email
        params:
        subject: email/subject
        body: email/body
        to: email/usr
  2. shashwathi commented on Apr 27, 2018

    @shashwathi
    Contributor

    @mujahidsof : If I understand your problem correctly, you need the pipeline to branch out depending the results of the previous task. If so you might be interested in on_success, on_failure hooks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions