【问题标题】:Best way to store json keyfile for GCP functions serverless deployment with Github actions使用 Github 操作为 GCP 功能无服务器部署存储 json 密钥文件的最佳方式
【发布时间】:2021-07-08 14:43:35
【问题描述】:

我使用serveless & Github actions 来部署 GCP 功能。

无服务.ylm

service: serverless-test

provider:
  name: google
  runtime: go113
  project: my-gcp-project
  credentials: ./gcp_keyfile_serverless.json

frameworkVersion: '2'

plugins:
  - serverless-google-cloudfunctions

package:
  exclude:
    - .gitignore
    - .git/**

functions:
  hello-world:
    handler: Hello
    events:
      - http: path

deploy_gcp_go.yml

name: Deploy master branch

on:
  push:
    branches:
      - master

jobs:
  deploy:
    name: deploy
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14.x]
    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm ci
    - name: serverless deploy
      uses: serverless/github-action@master
      with:
        args: deploy
      env:
        SERVERLESS_ACCESS_KEY: ${{secrets.SERVERLESS_SECRET_KEY}}

有没有办法不存储 gcp_keyfile_serverless.json 文件直接在 Github 存储库中? (在serverless.yml文件中使用)

【问题讨论】:

    标签: google-cloud-functions github-actions serverless-framework


    【解决方案1】:

    添加一个构建步骤,使用Cloud KMS 解密加密的*.json

    或者这是另一个example,做的差不多,但使用pgp

    【讨论】:

      猜你喜欢
      • 2021-03-03
      • 2023-01-20
      • 1970-01-01
      • 2021-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-26
      • 2018-11-12
      相关资源
      最近更新 更多