jfrog-pipelines

Jfrog pipeline embedded pipeline parent step is failing if one of the step in the embedded pipeline is skipped


Jfrog pipelines embedded pipeline parent step is failing if one of the step in the embedded pipeline is skipped (without additional failures). Is there a way to make it green in case of skipped step?

Sample Pipeline Yaml

    pipelines:
  - name: top_pipeline
    steps:
      - name: scan_controller
        type: TriggerPipeline
        configuration:
          pipelineName: scanner_pipeline
          stepName: scan_it
          integrations:
            - name: myPlatformToken
          environmentVariables:
            scan_target:
              default: "hello-world"
              allowCustom: true
              values:
                - "vault"
                - "redis"
                - "postgresql"
                - "hello-world"
        execution:
          onStart:
            - set_trigger_payload pipelineVariables "scan_target=${scan_target}"
            - set_trigger_payload stepVariables "notify=email" "uploadReport=true"
          onComplete:
            - echo "Final status is $nested_run_status"
 
  - name: scanner_pipeline
    steps:
      - name: scan_it
        type: Bash
        execution:
          onExecute:
            - echo "Image to scan is $scan_target."
            - echo "Triggered by parent step at $parent_step_url"

Solution

  • The status of the TriggerPipeline native step will only be "success" if the run that it triggers is also "success". Any other status in the child run will result in the TriggerPipeline step going to a "failure" status.

    There are a few ways to better control the status of the child run:

    allowFailure - This flag can be added to any step. If "true", then that step will not count towards calculating the final status of the run. This means the step could actually be in skipped, error, or failure status, and that status would not impact how the final run status is calculated.

    newVersionOnly - If you configure an input resource with the newVersionOnly flag, it means that your step will skip if that resource was not updated during the run. If a step is skipped for this reason, it won't cause the run to be marked "skipped". That step will be ignored when calculating the final run status

    If you have a scenario where it doesn't make sense to try and adjust the status of the child pipeline just to get the TriggerPipeline step to be successful, then you might want to consider setting the "allowFailure" flag on the TriggerPipeline step itself, so that even if it fails, the rest of your run can continue.