I'm trying to deploy my Django API on to Google App Engine using GitHub CI/CD, but I'm getting a strange error that doesn't provide any stack trace in my deploy
job. My build
job with unit tests and code coverage passes.
main.yaml:
name: Python application
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
defaults:
run:
working-directory: src
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: github_actions
ports:
- 5433:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test with Unittest
env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
DB_NAME: ${{ secrets.DB_NAME }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_ENGINE: ${{ secrets.DB_ENGINE }}
run: |
coverage run manage.py test && coverage report --fail-under=75 && coverage xml
mv coverage.xml ../
- name: Report coverage to Codecov
env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
DB_NAME: ${{ secrets.DB_NAME }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_ENGINE: ${{ secrets.DB_ENGINE }}
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
directory: ./coverage/reports/
fail_ci_if_error: true
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Deploy to App Engine
id: deploy
uses: google-github-actions/[email protected]
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
deliverables: app.yaml
credentials: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
version: v1
- name: Test
run: curl "${{ steps.deploy.outputs.url }}
app.yaml:
runtime: python39
instance_class: B1
service: deploy
basic_scaling:
max_instances: 1
idle_timeout: 10m
Here are the two errors I'm getting:
I also get another strange error in app.yaml, which causes the workflow to not run. I thought from the Google App Engine documentation for this file that we didn't need to include an on
trigger. I'm not sure if it's caused by the error in main.yaml
.
Is there an easy way to fix this error?
UPDATE: After trying v0.4.0
of the GitHub Action, I get the same error, but I found out that my GOOGLE_APPLICATION_CREDENTIALS
are causing the error.
{
"type": "service_account",
"project_id": "***",
"private_key_id": "***",
"private_key": "-----BEGIN PRIVATE KEY-----***=\n-----END PRIVATE KEY-----\n",
"client_email": "***@appspot.gserviceaccount.com",
"client_id": "***",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/***%40appspot.gserviceaccount.com"
}
I replaced all private information with ***
, but the JSON is definitely still valid.