Skip to content

Arbitrary value (i.e., one-dimensional array or matrix) for parallel jobs

Problem to solve

The parallel option allow you to create multiple copies of the same job with an automatically incremented CI_NODE_INDEX over the jobs we create. However, it could be more useful if I could specify my own array of values for these jobs.

Target audience

Further details

Use cases could include a Node project that has an arbitray set of scripts outside of just npm test or npm build that I want to run. Perhaps I have a package.json with:

"scripts": {
    "clean": "rimraf dist/*",
    "prebuild": "npm run clean -s",
    "build": "npm run build:scripts -s && npm run build:styles -s && npm run build:markup -s",
    "build:scripts": "browserify -d assets/scripts/main.js -p [minifyify --compressPath . --map main.js.map --output dist/main.js.map] | hashmark -n dist/main.js -s -l 8 -m assets.json \"dist/{name}{hash}{ext}\"",
    "build:styles": "stylus assets/styles/main.styl -m -o dist/ && hashmark -s -l 8 -m assets.json dist/main.css \"dist/{name}{hash}{ext}\"",
    "build:markup": "jade assets/markup/index.jade --obj assets.json -o dist",
    "test": "karma start --singleRun",
  },

I could then say at the build stage I want to parallelize it and have it run the scripts ["build", "build:scripts", "build:styles", "build:markup"].

Proposal

We could expand on the matrix keyword to accept a one-dimensional matrix as follows:

deploystacks:
  stage: deploy
  script:
    - bin/deploy
  parallel:
    matrix:
      - PROVIDER: [gcp, vultr]

This would solve this use case in a clear way, using existing features (https://docs.gitlab.com/ee/ci/yaml/#parallel-matrix-jobs).

What does success look like, and how can we measure that?

Links / references

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Edited by 🤖 GitLab Bot 🤖