Run node.js database migrations on Google Cloud SQL during Google Cloud Build

后端 未结 5 1720
我寻月下人不归
我寻月下人不归 2020-12-16 01:45

I would like to run database migrations written in node.js during the Cloud Build process.

Currently, the database migration command is being executed but it seems

5条回答
  •  一个人的身影
    2020-12-16 01:56

    Use google-appengine/exec-wrapper. It is an image to do exactly this. Usage (see README in link):

    steps:
    - name: "gcr.io/google-appengine/exec-wrapper"
      args: ["-i", "gcr.io/my-project/appengine/some-long-name",
             "-e", "ENV_VARIABLE_1=value1", "-e", "ENV_2=value2",
             "-s", "my-project:us-central1:my_cloudsql_instance",
             "--", "bundle", "exec", "rake", "db:migrate"]
    

    The -s sets the proxy target.

提交回复
热议问题