Bitbucket is getting a new navigation

We’re rolling out these changes, so the documentation may not match your experience in the Bitbucket Cloud app. Read about the new Bitbucket navigation

パイプとは

パイプについて

パイプを使用して、パイプラインを簡単に構成することができます。特に、サードパーティのツールで作業する場合に便利です。yaml ファイルにパイプを貼り付け、いくつかの主要な情報を指定するだけで、残りは自動的に行われます。ステップには任意の数のパイプを追加できます。

利用可能なパイプの一覧

  • You can find the complete list of pipes here.

  • If you need a custom approach to pipes you can create your own pipe.

動作の仕組み

パイプは Docker コンテナにあるスクリプトを使用し、過去に yaml に配置したコマンドといくつかの追加コマンドを含みます。

ユーザーはいくつかの値を入力するだけです。アトラシアンが提供しているタスクは公開されているため、ユーザーはソース コードを参照して動作の仕組みを確認することができます。


例: Amazon S3 バケットにアップロードするためのパイプを追加する

パイプラインで build ディレクトリのコンテンツを my-bucket-name S3 バケットにアップロードする場合、AWS S3 デプロイ パイプを使用できます。

AWS S3 デプロイ デモ GIF
  1. [AWS S3 デプロイ パイプ] を選択します。

  2. [コピー] を選択します。

  3. カーソルをデプロイメント ステップのスクリプト セクションに移動させます (場所が重要です)。 

  4. コピーしたコードを貼り付けます。

  5. 通知: ここではオプション パラメーターは削除していますが、必要に応じてコメント化を解除することができます。

  6. デプロイメントのパラメータ値を追加します (常に一重引用符で囲みます)。

    1. using our predefined variables $AWS_ACCESS_KEY_ID and $AWS_SECRET_ACCESS_KEY

    2. リージョンを us-east-1 に指定

    3. バケットの名前を my-bucket-name に指定

    4. build フォルダのコンテンツをデプロイするように定義

script: - pipe: atlassian/aws-s3-deploy:0.2.2 variables: AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY AWS_DEFAULT_REGION: 'us-east-1' S3_BUCKET: 'my-bucket-name' LOCAL_PATH: 'build'

AWS Elastic Beanstalk デプロイや NPM Publish などの一部のデプロイメント パイプでは、デプロイしたアプリケーションを表示できる便利なリンクをログに提供しています。

デプロイのサンプル gif

パイプの使用方法

パイプラインにパイプを追加するには、2 つの方法があります。

1. オンライン エディターの使用

  1. エディタで bitbucket-pipelines.yml ファイルを開きます。

  2. 必要なパイプを選択します。

  3. パイプをコピーして、ステップの script セクションに貼り付けます。

  4. 指定する値を、単一引用符で囲んで追加します (必要に応じ、使用したいオプション パラメータのコメントを解除します)。

  5. ビルドを実行します。

You can fill in the variable values in-line, or use predefined variables.

2. 構成を直接編集する

任意のエディタを使用して、bitbucket-pipelines.yml ファイルにタスクの詳細を追加できます。

後述の利用可能なパイプの一覧の README.md ファイルには、パイプの使用方法の手順や、bitbucket-pipelines.yml ファイルにコピー アンド ペーストできる行が含まれます。パイプ リポジトリでスクリプトを参照することで、パイプがバックグラウンドで実行している処理内容を確認することもできます。

考慮事項:

  • Pipes need to use the Docker service, which we start transparently. This counts towards the number of services you can run in a step. By default, this docker service can use 1GB of memory, but you can change that in your configuration if the pipe needs more memory.

  • Pipes use semantic versioning, so as we make changes to the pipe the version number will change. We'll be updating the repository changelog as we go. If you want to use a different version, you can by changing the version number in your bitbucket-pipelines.yml file. Note that  0.x.y versioned pipes are an exception to classic semantic versioning, as they are still under development, and can introduce breaking changes between minor and patch version changes.

    例:

    変更前: pipe: atlassian/aws-s3-deploy:0.1.0

    変更後: pipe: atlassian/aws-s3-deploy:0.2.0

パイプが不足している場合

If there is a pipe you'd like to see that we don't already have you can create your own pipe, or use the Suggest a pipe box in the Bitbucket editor.

[パイプを提案する] フィールドと [送信] ボタンが表示された画像

パイプで支援が必要な場合

もっとも簡単に支援を得る方法は、リポジトリの readme にあるパイプのサポート手順に従うことです (これはパイプを選択するとエディタにも表示されます)。

Another option, for general help or if you have an issue or feature request, is to let us know on Community.

問題を報告する場合は、迅速な調査のため、以下の情報を含めてください。

  • パイプのバージョン

  • 関連するログとエラー メッセージ

  • 再現手順

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。