GoogleCloudPlatform / gsutil

A command line tool for interacting with cloud storage services.
Apache License 2.0
874 stars 334 forks source link

WARN Credentials file could not be loaded, will ignore and overwrite #1181

Open olivierboudet opened 3 years ago

olivierboudet commented 3 years ago

Hello,

I am running these commands in a script :

gcloud auth activate-service-account --key-file /etc/secrets/gcloud-key --quiet --no-user-output-enabled
gsutil --quiet cp /exports/* gs://mybucket/2021-01-18/

All the files are correctly uploaded to my bucket.

But I always have these warnings :

WARNING 0118 08:21:02.248046 multiprocess_file_storage.py] Credentials file could not be loaded, will ignore and overwrite.
WARNING 0118 08:21:02.248446 multiprocess_file_storage.py] Credentials file could not be loaded, will ignore and overwrite.
WARNING 0118 08:21:02.391002 multiprocess_file_storage.py] Credentials file could not be loaded, will ignore and overwrite.

1) I don't know why I have these kind of warning as I am not using -m option to activate multiprocess uploads 2) how can I fix this warn ? It tells that credentials could not be loaded but upload on a private bucket works successfully ? 3) As they are logged in stderr and are always written, I can not use stderr to do alerting.

leblancmeneses commented 3 months ago

I was getting this error along with it constantly retrying forever.

Here is what fixed it in our build.

      - uses: 'google-github-actions/auth@v2'
        id: auth
        with:
          credentials_json: '${{ secrets.GCP_GITHUB_SERVICE_ACCOUNT_XYZ_FILE }}'

      - name: 'Set up Cloud SDK'
        uses: 'google-github-actions/setup-gcloud@v2'

      - name: Set GOOGLE_APPLICATION_CREDENTIALS
        run: echo "GOOGLE_APPLICATION_CREDENTIALS=${{ steps.auth.outputs.credentials_file_path }}" >> $GITHUB_ENV

      - name: run example
        shell: bash
        run: |
          set -e
          # not sure if this is actually needed after setting env value but left it in.
          gcloud auth activate-service-account --key-file=${GOOGLE_APPLICATION_CREDENTIALS}

          now all gsutil commands work without retrying.