パイプ

このページの内容

このセクションの項目

お困りですか?

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

コミュニティに質問

Pipes simplify configuring your pipeline. They are extra powerful for actions that normally take several lines of code, especially when you want to work with third party tools. You just paste the pipe, supply a few key pieces of information, and the rest is done for you. We've already got a great selection of commonly used actions for CI/CD, but if you have more unique needs you can create your own pipe.

Rather than having to type lines and lines of script, call the pipe and give it some variables. For example, to deploy your build directory to Amazon S3 all you need to add to your pipeline is:

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

For some deployment pipes, like AWS Elastic Beanstalk Deploy and NPM Publish, we also provide a convenient link in the logs to view the deployed application.

animation of clicking the link in the logs

You can add as many pipes as you like to your steps, so the possibilities are endless!

How to use pipes

There are two ways to add pipes to your pipeline:

1. Use the online editor

  1. Open up your bitbucket-pipelines.yml file in the editor.
  2. If pipes don't automatically show on the right, click .
  3. Select the pipe you need.
  4. Copy the pipe, and paste it into the script section of your step.
  5. Add your specific values in single quotes (and un-comment any optional variables you want to use).
  6. ビルドを実行します。

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

2. Edit the configuration directly

You can add the details of the task to your bitbucket-pipelines.yml file using an editor of your choice.

The README.md file in the available pipes listed below contains instructions on how to use the pipe and the lines you can copy and paste into your bitbucket-pipelines.yml file. While you are in the pipe repo you can have a peek at the scripts to see all the good stuff the pipe is doing behind the scenes.

動作の仕組み

We've put all the commands you previously would put in your yml, with a few useful extras, into a script inside a docker container (a pipe). This pipe uses this script to perform powerful actions, and you only need to provide a few values. The pipes we've provided are public, so you can check the source code to see how it all works.

メモリに関する考慮事項

Our 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.

Example: add a pipe to upload to Amazon S3 bucket

If we want our pipeline to upload the contents of the build directory to our my-bucket-name S3 bucket, we can use the AWS S3 Deploy pipe.

  1. Reveal the AWS S3 Deploy pipe by clicking on it
  2. コピー ボタンを押します。
  3. カーソルをデプロイメント ステップのスクリプト セクションに移動させます (場所が重要です)。 
  4. コピーしたコードを貼り付けます。
  5. ここではオプション パラメータは削除していますが、必要に応じてコメント化を解除することができます。
  6. Add the parameter values for our deployment (always in single quotes):
    1. using our predefined variables $AWS_ACCESS_KEY_ID and $AWS_SECRET_ACCESS_KEY
    2. specifying our region as us-east-1
    3. supplying the name of our bucket: my-bucket-name
    4. defining that we want to deploy the contents of our build folder
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'

Pipe versions

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.

例:

changing pipe: atlassian/aws-s3-deploy:0.1.0

to pipe: atlassian/aws-s3-deploy:0.2.0

Note: 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.

Available pipes

Atlassian created pipes are kept in the Bitbucket Pipelines pipes project, so feel free to take a peek! There are even more available, so have a look at this list (links take you to the specific pipe repository):


AWS CodeDeploy

デプロイメントを S3 にプッシュし、CodeDeploy からトリガします

AWS Elastic Beanstalk deploy

Elastic Beanstalk にコードをデプロイします。

AWS Lambda deploy

Lambda 関数コードを更新し、関数を参照するエイリアスを作成または更新します

AWS S3 deploy

S3 バケットにファイルをアップロードします

Azure ARM deploy

Deploy resources to Azure using Azure Resource Manager templates.

Azure CLI Run

Run commands using the Azure CLI.

Azure Functions Deploy

Deploy Azure function code.

Azure Kubernetes Service deploy

Deploy to AKS (Azure Kubernetes Service) using Kubectl.

Azure Kubernetes Service Helm deploy

Deploy to AKS (Azure Kubernetes Service) using Helm.

Azure Storage deploy

Deploy to Microsoft Azure Storage.

Azure VM Linux Script Deploy

Run scripts on Azure VM using Custom Script Extension Version 2.

Azure VM Scale Set Linux script deploy

Run scripts on Azure VM Scale Set using Custom Script Extension Version 2.

Azure Web Apps containers deploy

Deploy a container to Azure Web Apps.

Azure Web Apps deploy

Deploy an application to Azure Web Apps.

Bugsnag build report
See which release introduced an error and link from stack traces to your repo.

Datadog send event

Send events to Datadog.

Firebase deploy

Deploy your code to Firebase.

Google App Engine deploy

Deploy your application to Google App Engine.

Google Cloud Storage deploy

Upload files to your GCP storage bucket.

Heroku deploy

Deploy your application to Heroku.

JFrog Artifactory build promotion

Promote a build within Artifactory to a specified repository.

JFrog Artifactory docker

Upload a Docker image to an Artifactory repository that serves as a Docker registry.

JFrog Artifactory generic download

Download an artifact from an Artifactory repository.

JFrog Artifactory generic upload

Upload an artifact to an Artifactory repository.

JFrog Artifactory Maven

Trigger a Maven build, resolve Maven dependencies, and deploy Maven packages to and from Artifactory.

JFrog Artifactory npm

Trigger an npm build to deploy npm packages to Artifactory.

JFrog Artifactory Xray Scan

Scan a build with JFrog Xray to identify security vulnerabilities and compliance issues.

Jira transition issue

Transition a Jira issue.

LaunchDarkly code references

Find and send feature flag code references to LaunchDarkly

NPM publish

npm リポジトリにログインし、現在のビルド ディレクトリで package.json からパッケージを公開します

Opsgenie send alert

Send alerts to Opsgenie.

PagerDuty send alert

Sends alert to PagerDuty.

PyPi publish

Publish your python package to PyPi

Rollbar notify

Notify Rollbar of a deploy.

Rollout.io Flag Templates

Control your feature flags using templates via git tags.

SCP deploy

SCP を使用してファイルをリモート サーバにコピーします

SFTP deploy

SFTP を使用してファイルをリモート サーバにコピーします

Snyk scan

Find, fix, and monitor known vulnerabilities in your app dependencies and docker image.

SonarCloud Scan

Detect bugs and vulnerabilities in your repository.

Sonatype Nexus publisher

Publish artifacts to Nexus Repository Manager.

Slack Notify  

Sends a custom notification to Slack.

WhiteSource scan

Scan and report open sources vulnerabilities and security issues.


Missing pipe?

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.

Need help with a pipe?

The quickest way to get help is to follow the pipe's support instructions, found in its repository's readme (also seen in the editor when you select a pipe).

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

If you’re reporting an issue, you can speed up response times by including:

  • the version of the pipe
  • relevant logs and error messages
  • steps to reproduce
最終更新日 2019 年 3 月 25 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する

このセクションの項目

Powered by Confluence and Scroll Viewport.