I have to workflows into pipeline. I want my test
and deploy
pipelines to share the same steps but on top of this, I want to have extra steps into the deploy
pipeline.
I tried to search for a solution and bumped into StackOverflow QA. Unfortunately, none of the suggestion worked. Also, most of them create extra work for the pipeline build and maintenance.
The config.yml
looks the following way:
version: 2.1
do_stuff: &do_stuff
steps:
- checkout
- run:
mvn clean test
- store_artifacts:
path: htmlcov
- store_test_results:
path: test-results
jobs:
build:
docker:
- image: circleci/openjdk:8-jdk
<<: *do_stuff
deployment:
docker:
- image: circleci/openjdk:8-jdk
<<: *do_stuff
steps:
- run:
mvn deploy
workflows:
build-and-test-workflow:
jobs:
- build-and-test
deployment-workflow:
jobs:
- deployment:
requires:
- build-and-test
My problem is that steps
override steps from <<: *do_stuff
reference and I cannot find an acceptable solution for usage references. The reason why I want solution look this way, mvn deploy
should be strictly after reference and I don't want to duplicate pipelines. In the actual project, pipeline way more complicated.
Is there any way I can bypass this limitation of a yml
syntax? Between, I am using pipeline
if it makes any difference.