Google Cloud にデプロイする

このガイドでは、Bitbucket Pipelines を構成して Google Cloud App Engine に自動的にデプロイする方法について説明します。単純なアプリケーション デプロイメントの前に、認証情報のセットアップ方法について説明します。

認証情報のセットアップ

First, you’ll need to create a Google service account key. For more guidance see Google's guide to creating service keys.

Once you have your key file

  1. open up your terminal
  2. browse to the location of your key file
  3. encode your file in base64 format:
    base64 -w 0 <your-key-file>
    Note: for some versions of MacOS the -w 0 is not necessary.
  4. copy the output of the command
  5. go to your repository settings in Bitbucket and then Pipelines > Repository variables
  6. create a new variable named KEY_FILE and paste the encoded service account credentials.

Deploy to Google Cloud App Engine

We can use the Google Cloud App Engine deploy pipe to do the rest. The pipe repository contains more usage examples, which variables you can use, and support information.

A simple bitbucket-pipelines.yml configuration to deploy to Google Cloud App Engine could look like:

bitbucket-pipelines.yml
image: node:10.15.1

pipelines:
  default:
    - step:
        name: Build and Test
        script:
          - npm install
          - npm test
    - step:
        name: Deploy
        script:
          - pipe: atlassian/google-app-engine-deploy:0.2.1
            variables:
              KEY_FILE: $KEY_FILE
              PROJECT: 'my-project'
最終更新日 2019 年 3 月 26 日

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

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.