YAML アンカーを使って Bitbucket Pipelines 構成を簡潔にする
YAML アンカーを利用して Bitbucket Pipelines 構成の重複が減らせることが分かったので紹介します。
YAML アンカーを利用した例
bitbucket-pipelines.yml
にはこのように記述します。アンカーの前方参照はできないようなので、 definitions.steps
を上にして、 &test
をアンカーとして使っています。
definitions:
steps:
- step: &test
caches:
- pip
script:
- pip install setuptools
- python ./setup.py test
pipelines:
default:
- step: *test
これだけでは利点があまり大きくありませんが、 Bitbucket Pipelines では <<
によるオーバーライドも可能なので、パイプラインの数が増えたら便利になりますね。
pipelines:
default:
- step: *test
branches:
python3:
- step:
<<: *test
image: python:3
Author And Source
この問題について(YAML アンカーを使って Bitbucket Pipelines 構成を簡潔にする), 我々は、より多くの情報をここで見つけました https://qiita.com/kazssym/items/243458993c47349b7400著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .