Flow Project

The flow Project module handles creating Jenkins flow projects. You may specify flow in the project-type attribute of the Job definition.

Requires the Jenkins Build Flow Plugin.

In order to use it for job-template you have to escape the curly braces by doubling them in the DSL: { -> {{ , otherwise it will be interpreted by the python str.format() command.

Job Parameters:
  • dsl (str): The DSL content. (optional)
  • needs-workspace (bool): This build needs a workspace. (default false)
  • dsl-file (str): Path to the DSL script in the workspace. Has effect only when needs-workspace is true. (optional)

Job example:

- job:
      name: test_job
      project-type: flow
      dsl: |
        build("job1")
        parallel (
          { build("job2a") },
          { build("job2b") }
        )

Job template example:

- job-template:
    name: '{name}-unit-tests'
    project-type: flow
    dsl: |
        build("job1")
        parallel (
            {{ build("job2a") }},
            {{ build("job2b") }}
        )
        build("job2c")
    builders:
    - shell: unittest
    publishers:
    - email:
        recipients: '{mail-to}'

- job-group:
    name: '{name}-tests'
    jobs:
    - '{name}-unit-tests':
        mail-to: developer@nowhere.net

- project:
    name: project-name
    jobs:
    - '{name}-tests'

Job example runninng a DSL file from the workspace:

- job:
      name: test_job
      project-type: flow
      needs-workspace: true
      dsl-file: script.groovy
class project_flow.Flow(registry)