Details
-
Suggestion
-
Resolution: Duplicate
Description
So the issue is basically code duplication.
I currently have a pipeline similar to this
#!yaml pipelines: branches: master: - parallel: - step: name: Test image: chialab/php:7.2 caches: - composer script: - composer install --no-progress --no-suggest - vendor/bin/phpunit - step: name: Webpack image: node:carbon caches: - node script: - yarn install - yarn run build artifacts: - web/build/** - step: name: Composer image: chialab/php:7.2 caches: - composer script: - composer install --no-dev --no-progress --no-suggest --optimize-autoloader --classmap-authoritative artifacts: - vendor/** - step: name: Deploy deployment: Production script: - rsync [...]
This is for live deployment. But I would also like the test and webpack step to run on all branches. So the only way (that I know of) is to copy paste them into other branch definitions.
I would much rather have something like this:
#!yaml
pipelines:
default:
- parallel:
- step: test
- step: webpack
branches:
master:
- parallel:
- step: test
- step: webpack
- step: composer
- step:
name: Deploy
deployment: Production
script:
- rsync [...]
definitions:
steps:
test:
name: Test
image: chialab/php:7.2
caches:
- composer
script:
- composer install --no-progress --no-suggest
- vendor/bin/phpunit
webpack:
name: Webpack
image: node:carbon
caches:
- node
script:
- yarn install
- yarn run build
artifacts:
- web/build/**
composer:
name: Composer
image: chialab/php:7.2
caches:
- composer
script:
- composer install --no-dev --no-progress --no-suggest --optimize-autoloader --classmap-authoritative
artifacts:
- vendor/**