[英]Google Cloud, GitHub pipe with Google Cloud Run
我正在尝试使用云运行部署 pipe 和 Github 和 Google Cloud,因为我在服务器中使用 docker 容器,这是我的 GitHub 操作代码(工作流程)
name: Build and Deploy to Cloud Run
on:
push:
branches:
- master
env:
PROJECT_ID: ${{ secrets.RUN_PROJECT }}
RUN_REGION: us-west2-a
SERVICE_NAME: helloworld-python
jobs:
setup-build-deploy:
name: Setup, Build, and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# Setup gcloud CLI
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- uses: google-github-actions/setup-gcloud@v0
with:
version: '390.0.0'
service_account_email: ${{ secrets.ACC_MAIL }}
service_account_key: ${{ secrets.RUN_SA_KEY }}
project_id: ${{ secrets.RUN_PROJECT }}
# Build and push image to Google Container Registry
- name: Build
run: |-
gcloud builds submit \
--quiet \
--tag "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA"
# Deploy image to Cloud Run
- name: Deploy
run: |-
gcloud run deploy "$SERVICE_NAME" \
--quiet \
--region "$RUN_REGION" \
--image "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" \
--platform "managed" \
--allow-unauthenticated
一切似乎都是“正确的”,但在我运行工作流程的那一刻,出现了这个错误
ERROR: (gcloud.builds.submit) The required property [project] is not currently set.
You may set it for your current workspace by running:
$ gcloud config set project VALUE
or it can be set temporarily by the environment variable [CLOUDSDK_CORE_PROJECT]
项目 ID 在RUN_PROYECT
秘密中,我不知道还能做什么
有没有什么问题不能让它工作?
编辑:将版本更改为 390.0.0 有效,但现在我收到此错误
ERROR: (gcloud.builds.submit) Invalid value for [source]: Dockerfile required when specifying --tag
对于第一个错误:
ERROR: (gcloud.builds.submit) The required property [project] is not currently set.
You may set it for your current workspace by running:
$ gcloud config set project VALUE
or it can be set temporarily by the environment variable [CLOUDSDK_CORE_PROJECT]
gcloud
命令未正确配置。
根据google-github-actions/setup-gcloud的授权部分:
此操作安装 Cloud SDK (
gcloud
)。 要配置其对 Google Cloud 的身份验证,请使用google-github-actions/auth
操作。
因此,您需要使用其中任何一种受支持的方法来配置它以进行授权。
对于你的第二个错误:
ERROR: (gcloud.builds.submit) Invalid value for [source]: Dockerfile required when specifying --tag
/path/to/Dockerfile 丢失。 您需要在gcloud builds submit
命令中指定它。
有关详细信息,请参阅此相关的 SO 线程: Specify Dockerfile for gcloud build submit
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.