1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

YAML アンカーを使って Bitbucket Pipelines 構成を簡潔にする

1
Posted at

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
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?