CircleCI-Public / gcp-cli-orb

Install and configure the Google Cloud CLI (gcloud)
https://circleci.com/orbs/registry/orb/circleci/gcp-cli
MIT License
9 stars 32 forks source link

New error in orb: gcloud crashed (ValueError): invalid width 0 (must be > 0) when tagging images #36

Closed joe-hilling closed 2 years ago

joe-hilling commented 2 years ago

Orb version

circleci/gcp-cli@1.3.0

What happened

The following step fails.

IMAGE_TO_TAG="eu.gcr.io/${GOOGLE_PROJECT_ID}/${PROJECT_NAME}:${CIRCLE_SHA1}"
echo Tagging "${IMAGE_TO_TAG}"
gcloud container images add-tag "${IMAGE_TO_TAG}" \
             eu.gcr.io/${GOOGLE_PROJECT_ID}/${PROJECT_NAME}:latest

Echo shows our project

Tagging eu.gcr.io/CHANGED_PROJECT_NAME/data-server:VALID_TAG
ERROR: gcloud crashed (ValueError): invalid width 0 (must be > 0)

Where the project name is valid / exists and the VALID_TAG is visible in the google cloud container registry.

I have tried to run this code from my personal machine and the statement executes without issue.

This workflow has run hundreds of times previously without fail and the most recent commit that triggered it had no changes to the circleci config. The container build and test steps pass without error.

Expected behavior

Image is successfully tagged with latest

joe-hilling commented 2 years ago

Same issue with circleci/gcp-cli@2.2.0

joe-hilling commented 2 years ago

The error is to do with 0 terminal size. Adding the line below makes sure gcloud does not crash

stty rows 50 cols 80
jordstew commented 2 years ago

also seeing the same error when running docker helper for gcp. our last successful build was 5 days ago, we have no changes to our config since then, and today we started getting this same width = 0 error. timing makes sense as this was opened 4 days ago. thanks for the temp solution joe-hilling.

Coppini commented 2 years ago

We're having the same issue with deploying apps on AppEngine:

gcloud app deploy --version "${APP_VERSION}" --no-promote

Error:

Services to deploy:

descriptor:                  [/root/project/app.yaml]
source:                      [/root/project]
target project:              [***********]
target service:              [default]
target version:              [*******]
target url:                  [https://*******-dot-***********.uc.r.appspot.com]
target service account:      [App Engine default service account]

     (add --promote if you also want to make this service available from
     [https://***********.uc.r.appspot.com])

ERROR: gcloud crashed (ValueError): invalid width 0 (must be > 0)

If you would like to report this issue, please run the following command:
  gcloud feedback

To check gcloud for common problems, please run the following command:
  gcloud info --run-diagnostics

Exited with code exit status 1
CircleCI received exit code 1

Apparently, the issue is with gcloud version 361.0.0. It started throwing errors on our builds just as this new version was released.

Pinning the version on 360.0.0 fixed it for us.

docker:
      - image: gcr.io/google.com/cloudsdktool/cloud-sdk:360.0.0-alpine
Coppini commented 2 years ago

Fix should come from Google on Tuesday, with the new release of cloud-sdk: https://github.com/GoogleCloudPlatform/cloud-sdk-docker/issues/257#issuecomment-947864851

Coppini commented 2 years ago

Issue should be fixed on cloud-sdk version 362.0.0

EricRibeiro commented 2 years ago

Seems like this issue was related to the cloud-sdk version and it's fixed.