Skip to content

Instantly share code, notes, and snippets.

@electrical
Created June 18, 2015 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save electrical/5e3b8a9413c96b92dd90 to your computer and use it in GitHub Desktop.
Save electrical/5e3b8a9413c96b92dd90 to your computer and use it in GitHub Desktop.
ES integration matrix jobs
I have a template called 'puppet-elasticsearch-integration-{es_branch}'
Each {branch} has a specific list of possible targets to test against.
for example:
es_versions_master:
- 'MASTER'
es_versions_1x:
- 1.x_nightly
- 1.6_nightly
- 1.5_nightly
- 1.4_nightly
- 1.3_nightly
- 1.2_nightly
- 1.1_nightly
- 1.6.0
- 1.5.2
- 1.4.5
- 1.3.9
- 1.2.4
- 1.1.2
This list should be values of an axis for the matrix job
For the project i would like to do the following:
- project:
name: es-integration
es_branch:
- master
- 1x
jobs:
- puppet-elasticsearch-integration-{es_branch}
@electrofelix
Copy link

Not quite the same, but I believe the following would solve this

- defaults:
    name: defaults
    es_versions_master: &es_versions_master
        - 'MASTER'

    es_versions_1x: &es_versions_1x
        - 1.x_nightly
        - 1.6_nightly
        - 1.5_nightly
        - 1.4_nightly
        - 1.3_nightly
        - 1.2_nightly
        - 1.1_nightly
        - 1.6.0
        - 1.5.2
        - 1.4.5
        - 1.3.9
        - 1.2.4
        - 1.1.2

- job-template:
    name: puppet-elasticsearch-integration-{es_branch}
    project-type: matrix
    axes:
      - axis:
          type: user-defined
          name: branches
          values: '{obj:axes_values}'

- project:
    name: es-integration
    jobs:
      - puppet-elasticsearch-integration-{es_branch}:
          es_branch: 1x
          axes_values: *es_versions_1x
      - puppet-elasticsearch-integration-{es_branch}:
          es_branch: master
          axes_values: *es_versions_master

@electrofelix
Copy link

Just to confirm the following works for me when specifying different defaults to use:

- defaults:
    name: global
    nothing: 1
    es_versions_master:
        - 'STABLE'

    es_versions_1x:
        - 1.x_hourly
        - 1.6_hourly

- defaults:
    name: es-integration
    es_versions_master:
        - 'MASTER'

    es_versions_1x:
        - 1.x_nightly
        - 1.6_nightly
        - 1.5_nightly
        - 1.4_nightly
        - 1.3_nightly
        - 1.2_nightly
        - 1.1_nightly
        - 1.6.0
        - 1.5.2
        - 1.4.5
        - 1.3.9
        - 1.2.4
        - 1.1.2

- job-template:
    name: puppet-elasticsearch-integration-{es_branch}
    defaults: es-integration
    project-type: matrix
    axes:
      - axis:
          type: user-defined
          name: branches
          values: '{obj:axes_values}'

- project:
    name: es-integration
    defaults: es-integration
    jobs:
      - puppet-elasticsearch-integration-{es_branch}:
          es_branch: 1x
          axes_values: '{obj:es_versions_1x}'
      - puppet-elasticsearch-integration-{es_branch}:
          es_branch: master
          axes_values: '{obj:es_versions_master}'

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