簡體   English   中英

Google Cloud Build 在構建期間推送遷移

[英]Google Cloud Build Push Migrations During Build

目前,我有我的 cloudbuild 設置要做:

- id: "apply migrations"
name: "gcr.io/google-appengine/exec-wrapper"
entrypoint: "bash"
args:
  [
    "-c",
    "/buildstep/execute.sh -i gcr.io/${PROJECT_ID}/${_SERVICE_NAME} -s ${PROJECT_ID}:${_REGION}:${_INSTANCE_NAME} -e RAILS_MASTER_KEY=$$RAILS_KEY -- bundle exec rails db:migrate",
  ]
secretEnv: ["RAILS_KEY"]

構建時,在遷移步驟中出現以下錯誤:

Caused by:
Step #3 - "apply migrations": PG::ConnectionBad: could not connect to server: No such file or directory
Step #3 - "apply migrations":   Is the server running locally and accepting
Step #3 - "apply migrations":   connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

什么可能導致發生此錯誤? 我找不到有關該主題的任何信息。

該錯誤與無法連接到數據庫有關,似乎替換無法正常工作,為了糾正它,請驗證您的.env文件是否具有正確的變量並填充了來自您的實例的信息。

如果文件包含所需的信息,請嘗試刪除--substitutions標志並將變量( ${PROJECT_ID}${_SERVICE_NAME}${_INSTANCE_NAME}等)直接替換為您的cloudbuild.yaml文件中的正確值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM