gcloud crashes when run within Cloud Build

309 views
Skip to first unread message

Craig Saville

unread,
Jan 9, 2019, 9:15:34 AM1/9/19
to Google App Engine
gcloud app deploy works fine locally but fails when it runs using gcr.io/cloud-builders/gcloud with the following error:

Do you want to continue (Y/n)? 
DEBUG: No bucket specified, retrieving default bucket.
DEBUG: Using bucket [gs://staging.welovesailing-117.appspot.com].
Beginning deployment of service [default]...
INFO: Ignoring directory [.sass-cache]: Directory matches ignore regex.
DEBUG: function takes exactly 5 arguments (1 given)
Traceback (most recent call last):
File "/builder/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 987, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "/builder/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 789, in Run
resources = command_instance.Run(args)
File "/builder/google-cloud-sdk/lib/surface/app/deploy.py", line 90, in Run
parallel_build=False)
File "/builder/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 626, in RunDeploy
service_deployed = True
File "/builder/google-cloud-sdk/lib/googlecloudsdk/core/util/files.py", line 586, in __exit__
exceptions.reraise(prev_exc_type(message), tb=prev_exc_trace)
TypeError: function takes exactly 5 arguments (1 given)
ERROR: gcloud crashed (TypeError): function takes exactly 5 arguments (1 given)

The same service account deploys other services fine so I don't believe it's a permission error that is causing this. The gcloud versions in Cloud Build matches my local gcloud versions, and I get the above error when running either cloud-build-local or when triggered within Cloud Build. I tried looking through all the log files I could find but couldn't find any better error message than the above.

The Cloud Build step that fails is:

  args: ['app','deploy','app.yaml','--project=$PROJECT_ID','--verbosity=debug']
  env: ['PROJECT_ROOT=app-web']


George (Cloud Platform Support)

unread,
Jan 9, 2019, 11:10:34 AM1/9/19
to Google App Engine
Hello Craig, 

How did you run the gcloud app deploy command? You have provided the output of the command, but not the command itself. You should edit out any sensitive information, such as project ID. 

Have you generated an app.yaml file in preparation? You may refer to the "Deploying to App Engine" sub-chapter of the "Using Container Registry with Google Cloud Platform" online document, for relevant information. 

What is the output of the same command with the --verbosity=debug parameter? 

Craig Saville

unread,
Jan 9, 2019, 2:40:10 PM1/9/19
to Google App Engine
Hi George thanks for the reply. The gcloud app deploy command that I run locally is:

gcloud app deploy app.yaml --project=xxx --verbosity=debug

This runs fine and successfully deploys my app to Google App Engine, it only fails when I try to run the gcloud app deploy command from within Cloud Build. I have Cloud Build running successfully for my other services, it's only this one that fails and I'm really struggling to see what I'm missing.

This is the output when using verbosity=debug :  

Beginning deployment of service [default]...
INFO
: Ignoring directory [.sass-cache]: Directory matches ignore regex.
DEBUG
: function takes exactly 5 arguments (1 given)
Traceback (most recent call last):
File "/builder/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 987, in Execute
resources
= calliope_command.Run(cli=self, args=args)
File "/builder/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 789, in Run
resources
= command_instance.Run(args)
File "/builder/google-cloud-sdk/lib/surface/app/deploy.py", line 90, in Run
parallel_build
=False)
File "/builder/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 626, in RunDeploy
service_deployed
= True
File "/builder/google-cloud-sdk/lib/googlecloudsdk/core/util/files.py", line 586, in __exit__
exceptions
.reraise(prev_exc_type(message), tb=prev_exc_trace)
TypeError: function takes exactly 5 arguments (1 given)
ERROR
: gcloud crashed (TypeError): function takes exactly 5 arguments (1 given)


George (Cloud Platform Support)

unread,
Jan 10, 2019, 11:19:44 AM1/10/19
to Google App Engine
Hi Craig, 

You indicate how you run the gcloud app deploy command locally, not in Cloud Build. How does your Cloud Build deploy command look like? It should look like: gcloud app deploy --image-url=[HOSTNAME]/[PROJECT-ID]/[IMAGE]:[TAG] . How does yours look like, with project ID edited out? 

As this group is orientated towards general discussions and voicing of opinions, you should rather open a similar issue in the Public Issue Tracker, where it will get properly assessed, tracked, and fixed. 


Craig Saville

unread,
Jan 11, 2019, 10:20:15 PM1/11/19
to Google App Engine
Thanks for that, I'll open an issue in Public Issue Tracker. For reference though the Cloud Build call that is being called is:

  args: ['app','deploy','app.yaml','--project=$PROJECT_ID','--verbosity=debug']
  env: ['PROJECT_ROOT=$SERVICE_NAME']
 
I don't specify an image but Cloud Build appears to assign one if it's not provided and this works fine for my other services.
 

George (Cloud Platform Support)

unread,
Jan 14, 2019, 11:02:47 AM1/14/19
to Google App Engine
Hi Craig, 

How did you prepare your build for deployment? You may refer to the "Deploying artifacts" sub-chapter of the "Building, testing, and deploying artifacts" page. Are all steps listed on that document covered in your case; nothing left out? What happens if you provide image details, though, in place of expecting to have one assigned? 
Reply all
Reply to author
Forward
0 new messages