Search code examples
google-cloud-platformgithub-actionsgcloud

Github Actions Failing for setup-gcloud


My previous deployments with same github workflow file were successful. Suddenly today, I get this error in Github Actions while trying to deploy.

May I know how to fix this?

Run google-github-actions/setup-gcloud@v0
24
/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/runner/work/_temp/fa0cd935-fe7e-4593-8662-69259b4b00a0 -f /home/runner/work/_temp/52901a76-e32d-4cdf-92e4-83836f8c5362
25
Warning: "service_account_key" has been deprecated. Please switch to using google-github-actions/auth which supports both Workload Identity Federation and Service Account Key JSON authentication. For more details, see https://github.com/google-github-actions/setup-gcloud#authorization
26
Error: google-github-actions/setup-gcloud failed with: failed to execute command `gcloud --quiet auth activate-service-account *** --key-file -`: /opt/hostedtoolcache/gcloud/270.0.0/x64/lib/googlecloudsdk/core/console/console_io.py:544: SyntaxWarning: "is" with a literal. Did you mean "=="?
27
  if answer is None or (answer is '' and default is not None):
28
/opt/hostedtoolcache/gcloud/270.0.0/x64/lib/third_party/ipaddress/__init__.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
29
  raise TypeError("%s and %s are not of the same version" (a, b))
30
ERROR: gcloud failed to load: module 'collections' has no attribute 'MutableMapping'
31
    gcloud_main = _import_gcloud_main()
32
    import googlecloudsdk.gcloud_main
33
    from googlecloudsdk.calliope import base
34
    from googlecloudsdk.calliope import display
35
    from googlecloudsdk.calliope import display_taps
36
    from googlecloudsdk.core.resource import resource_printer_base
37
    from googlecloudsdk.core.resource import resource_projector
38
    from google.protobuf import json_format as protobuf_encoding
39
    from google.protobuf import symbol_database
40
    from google.protobuf import message_factory
41
    from google.protobuf import reflection
42
    from google.protobuf.internal import python_message as message_impl
43
    from google.protobuf.internal import containers
44
    MutableMapping = collections.MutableMapping
45

46
This usually indicates corruption in your gcloud installation or problems with your Python interpreter.
47

48
Please verify that the following is the path to a working Python 2.7 executable:
49
    /usr/bin/python
50

51
If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python 2.7 executable.
52

53
If you are still experiencing problems, please reinstall the Cloud SDK using the instructions here:
54
    https://cloud.google.com/sdk/

Solution

  • I fixed it by using below lines in workflow yml before uses: google-github-actions/setup-gcloud@v0

    - run: |
        sudo apt-get install python2.7
        export CLOUDSDK_PYTHON="/usr/bin/python2"