在部署我的网站期间,在哪里以及如何捕获gsutil错误? [英] Where and how catch gsutil errors on during deployment of my website?

本文介绍了在部署我的网站期间,在哪里以及如何捕获gsutil错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个托管在谷歌云存储上的个人网站。我在我的存储桶上部署网站的方式如下:

  • Github Actions在我按下开发分支时运行make deploy
  • Make Deploy正在运行名为bin/deploy.sh
  • 的外壳脚本

我的Google Cloud帐户存在计费问题,因此我无法修改GCS存储桶上的任何内容。事实上,如果我在本地运行Make Deploy,我会得到这个错误日志:

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.

我的Github操作管道成功,未报告任何错误。

我应该在何时以及如何捕获gCloud错误?

ploy.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

生成文件

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

推荐答案

除了@Mousumi提供的内容外,请通过编写一些shell script来查找如何捕获Gstil错误的示例。

这篇关于在部署我的网站期间,在哪里以及如何捕获gsutil错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆