Skip to content

Matrix project axis creation and exclusion plugin using yaml file (It's similar to .travis.yml)

License

Notifications You must be signed in to change notification settings

jenkinsci/yaml-axis-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jenkins Yaml Axis Plugin

Matrix project axis creation and exclusion plugin using yaml file

Plugin Version Build Status

Usage

1. Add yaml file to repository

example

# axis.yml
RUBY_VERSION:
  - 2.1.8
  - 2.2.4
  - 2.3.0

exclude:
  - RUBY_VERSION: 2.1.8
  - RUBY_VERSION: 2.3.0
    DATABASE: oracle

2. Create Multi-configuration project

new_job

3. Configuration Axis

Choose Yaml Axis

Add axis

Input configurations

config

  • Axis yaml file : Yaml file path (relative path from workspace or absolute path)
  • Axis name : Top key in yaml file

You can combine Yaml Axis and other axes

4. Configuration Execution Strategy

Choose "Yaml matrix execution strategy" at Execution Strategy

strategy

If you don't want to exclusion, choose Classic

Input settings

Example 1 (Use yaml file)

yaml_file

Example 2 (Use yaml text)

yaml_text

4. Build job

Generate yaml based matrix and run job 💪

result

  • blue is executed job
  • gray is excluded(skipped) job

Detail

Excluding logic

Excluding pattern may be specified with List of Map (e.g. List<Map<String, [String or List]>>)

Elements in the Map may be a List to exclude multiple items for one key

# axis.yml
exclude:
  - RUBY_VERSION: 2.1.8
  - RUBY_VERSION: 2.3.0
    DATABASE: oracle

When specified 2 axes

axis

This results in a 3x3 build matrix.

result

  • When specified RUBY_VERSION value 2.1.8, 3 results are excluded
    • RUBY_VERSION value 2.1.8 and DATABASE value mysql is excluded
    • RUBY_VERSION value 2.1.8 and DATABASE value postgres is excluded
    • RUBY_VERSION value 2.1.8 and DATABASE value oracle is excluded
  • When specified RUBY_VERSION value 2.3.0 and DATABASE value oracle, 1 result is excluded
    • RUBY_VERSION value 2.3.0 and DATABASE value oracle is excluded

Another example

# axis2.yml
exclude:
  - RUBY_VERSION: 2.1.8
  - RUBY_VERSION: 2.3.0
    DATABASE: 
      - oracle
      - mysql
  • When specified RUBY_VERSION value 2.1.8, 3 results are excluded
    • RUBY_VERSION value 2.1.8 and DATABASE value mysql is excluded
    • RUBY_VERSION value 2.1.8 and DATABASE value postgres is excluded
    • RUBY_VERSION value 2.1.8 and DATABASE value oracle is excluded
  • When specified RUBY_VERSION value 2.3.0, 2 results are excluded
    • RUBY_VERSION value 2.3.0 and DATABASE value oracle is excluded
    • RUBY_VERSION value 2.3.0 and DATABASE value mysql is excluded

Final example

Using multiple lists will exclude the cartesian product of those lists.

# axis3.yml
exclude:
  - RUBY_VERSION: 
      - 2.1.8
      - 2.3.0
    DATABASE: 
      - oracle
      - mysql
  • 4 results are excluded
    • RUBY_VERSION value 2.1.8 and DATABASE value mysql is excluded
    • RUBY_VERSION value 2.1.8 and DATABASE value oracle is excluded
    • RUBY_VERSION value 2.3.0 and DATABASE value oracle is excluded
    • RUBY_VERSION value 2.3.0 and DATABASE value mysql is excluded