Codefresh Steps: Reusable Code for Common Operations
This page provides code you can use to perform common operations in the Codefresh CI/CD platform.
75.9K

Dynamically run Codefresh pipelines codefresh-run-dynamic

Accepts a YAML file specifying a list of pipelines and options, and runs them concurrently. You can specify most `codefresh run` options on a per-build basis within the YAML file, including: branch, sha, no_cache, no_cf_cache, reset_volume, variables[], contexts[], skip[], only[], and enable_notifications. See example YAML file: https://github.com/codefresh-io/steps/tree/master/incubating/codefresh-run-dynamic/example_run_list.yaml

arguments

  • CHECK_INTERVAL_MINS - When WAIT is specified, check the build status at this interval. Default is every 1 min.
  • COLUMNS - When WAIT is specified, choose which columns to log with build statuses. Default is 'id,pipeline-name,trigger,branch,status'. Available columns are 'id,pipeline-name,pipeline-id,status,created,started,finished,buildtime,totaltime,trigger,webhook,repository,branch,commit-id,pipeline-trigger-id'.
  • DEBUG - Set to 'true' to enable debug logging. Default is false.
  • FAIL_FAST - If a child build fails, the whole step should fail. Default is true.
  • LOG_DIRECTORY - Write build logs to files in this directory.
  • LOG_INTERVAL_MINS - When WAIT is specified, log the build statuses at this interval. Default is every 15 min.
  • RUN_LIST_YAML_FILE - Path to the YAML file containing the list of pipelines and run options.
  • TIMEOUT_MINS - When WAIT is specified, wait up to this amount of minutes for builds to finish. Default is 60.
  • WAIT - Wait for builds to finish and log the status of each build. Default is false.

returns

  • CF_BUILDS_STARTED - List of builds that were started, space-separated
  • CF_BUILDS_SUCCESS - When WAIT is specified, this will be 'true' if all builds completed successfully and 'false' if not.
    run_cf_pipelines:
  title: Start pipelines but don't wait
  type: codefresh-run-dynamic
  arguments:
    RUN_LIST_YAML_FILE: /codefresh/volume/my-pipelines-to-run.yaml

  
    run_cf_pipelines:
  title: Start pipelines and wait
  type: codefresh-run-dynamic
  arguments:
    RUN_LIST_YAML_FILE: /codefresh/volume/my-pipelines-to-run.yaml
    WAIT: true

  
    run_cf_pipelines:
  title: Start pipelines and wait - with extra options
  type: codefresh-run-dynamic
  arguments:
    RUN_LIST_YAML_FILE: /codefresh/volume/my-pipelines-to-run.yaml
    WAIT: true
    TIMEOUT_MINS: '90'
    LOG_INTERVAL_MINS: '30'
    LOG_DIRECTORY: /codefresh/volume/my-run-logs

  
github.com
Ted Spinks
Sep 28, 2021