使用cloudbuild.yaml与手动执行“ gcloud app delpoy”进行云构建触发

时间:2019-08-13 05:31:24

标签: google-app-engine github google-cloud-platform google-cloud-build google-source-repositories

我正在GitHub存储库中进行Cloud Source Repository自动同步。当我更新代码并使用SDK手动执行“ gcloud应用程序部署”时,它已成功部署,并且网站运行正常,但是当我使用构建触发器进行App Engine部署自动化时,状态为成功,但在我的网站“ https://machine-problem-245503.appspot.com”中显示“ HTTP ERROR 500”。

Cloud Builder在更新代码并推送到GitHub后运行的结果:

enter image description here

使用SDK手动运行gcloud app deploy时的结果:

enter image description here

在我的cloudbuild.yaml中:

steps:
- name: "gcr.io/cloud-builders/gcloud"enter code here
args: ["app", "deploy"]
timeout: "1600s"

在我的app.yaml中:

runtime: php72
# [START handlers]
handlers:
- url: /bootstrap
  static_dir: bootstrap

- url: /css
  static_dir: public/css

- url: /fonts
  static_dir: public/fonts

- url: /img
  static_dir: public/img

- url: /js
  static_dir: public/js

- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico


env_variables:
  ## Put production environment variables here.
  APP_KEY: $keys
  APP_STORAGE: /tmp
  VIEW_COMPILED_PATH: /tmp
  CACHE_DRIVER: database
  SESSION_DRIVER: database
  ## Set these environment variables according to your CloudSQL configuration.
  DB_DATABASE: 
  DB_USERNAME: 
  DB_PASSWORD: 
  DB_SOCKET: "/cloudsql/$project-id"

1 个答案:

答案 0 :(得分:1)

通过在app.yaml中添加这些变量解决了该问题

  env_variables:
    APP_SERVICES_CACHE: /tmp/services.php
    APP_PACKAGES_CACHE: /tmp/packages.php