PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, September 26, 2022

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

 September 26, 2022     continuous-deployment, continuous-integration, gcloud, google-cloud-platform, google-cloud-storage     No comments   

Issue

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.



Answered By - Gourav B
Answer Checked By - Marie Seifert (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing