Search code examples
google-cloud-platformcontinuous-integrationgoogle-cloud-storagegcloudcontinuous-deployment

Where and how catch gsutil errors on during deployment of my website?


I have a personal website hosted on Google Cloud storage. The way I am deploying my website on my bucket is the following:

  • Github Actions runs make deploy when I am pushing on the branch develop
  • Make deploy is running a shell script called bin/deploy.sh

I have a billing issue on my Google Cloud account so i am not able to modify anything on my GCS bucket. In fact, If I run make deploy locally, I am getting this error log:

AccessDeniedException: 403 The project to be billed is associated with a delinquent billing account.
CommandException: 29 files/objects could not be copied/removed.
make: *** No rule to make target `do', needed by `deploy'.  Stop.

My Github Actions pipeline succeeded and did not report any error. enter image description here

When and how should I catch a gcloud error?

deploy.sh

# set website config
gsutil web set -m index.html -e 404.html gs://pierre-alexandre.io

# add user permissions
gsutil iam ch allUsers:legacyObjectReader gs://pierre-alexandre.io

# copy the website files!
gsutil -m rsync -d -r public_html gs://pierre-alexandre.io

Makefile

deploy: $(shell ./bin/deploy.sh)

.github/workflows/main.yml

name: CI
on:
  push:
    branches: [ develop ]
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Deployment to production server 
        run: |
          echo deploying new version on pierre-alexandre.io ...
          echo make deploy

Solution

  • Apart from what @Mousumi provided, please find an example of how you can catch gstil errors, by writing some shell script.