Reputation: 2774
I'm trying to automate the deployment of a Ruby on Rails app to App Engine using Cloud Build.
My app.yaml
looked like this,
runtime: ruby
env: flex
entrypoint: bundle exec rails server
But I'm getting this error,
Step #1: ERROR: (gcloud.app.deploy) There is a cloudbuild.yaml in the current directory, and the runtime field in /workspace/app.yaml is currently set to [runtime: ruby]. To use your cloudbuild.yaml to build a custom runtime, set the runtime field to [runtime: custom]. To continue using the [ruby] runtime, please remove the cloudbuild.yaml from this directory.
Then I tried to change the runtime to custom
and add a Dockerfile as custom runtime needs a Dockerfile.
But now I'm getting an error saying,
ERROR: (gcloud.app.deploy) A custom runtime must have exactly one of [Dockerfile] and [cloudbuild.yaml] in the source directory; [/home/milindu/Projects/ElePath-Ruby] contains both
Then I removed Dockerfile also. But now getting into this weird situation. You can see the 'Step #1:' is growing into several like stuck in a recursion.
Upvotes: 0
Views: 1015
Reputation: 654
Cloudbuild.yaml should work with App Engine Flexible without the need to use a custom runtime. As detailed in the first error message you received, you cannot have an app.yaml and the cloudbuild.yaml in the same directory if you are deploying in a non-custom runtime, to remedy the situation, follow these steps:
Move your app.yaml and other ruby files into a subdirectory (use your original app.yaml, no need to use custom runtime)
Under your cloudbuild.yaml steps, modify the argument for app deploy by adding a third one specifying your app.yaml's path.
Below is an example:
==================FROM:
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy']
timeout: '1600s'
===================TO:
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', '[SUBDIRECTORY/app.yaml]']
timeout: '1600s'
Upvotes: 2