Conversation
…CI/CD scripts to render app.yaml
There was a problem hiding this comment.
Pull request overview
This PR refactors the GitHub Actions CI/CD workflows to use a centralized template file with envsubst for generating the app.yaml configuration file used in Google Cloud deployments. This improves maintainability by eliminating duplicated inline YAML generation across staging and production workflows.
Changes:
- Refactored staging and production deployment workflows to use
envsubstwith a shared template file - Added
.github/app.template.yamlcontaining the Google App Engine deployment configuration template - Added
docs/directory to.gitignore
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
.gitignore |
Added docs/ directory to be ignored by git |
.github/workflows/CD_staging.yml |
Replaced inline YAML generation with envsubst-based template rendering for staging deployments |
.github/workflows/CD_production.yml |
Replaced inline YAML generation with envsubst-based template rendering for production deployments |
.github/app.template.yaml |
New shared template file for Google App Engine deployment configuration |
| PYGEOAPI_POSTGRES_HOST: "${{ vars.PYGEOAPI_POSTGRES_HOST || '127.0.0.1' }}" | ||
| PYGEOAPI_POSTGRES_PORT: "${{ vars.PYGEOAPI_POSTGRES_PORT || '5432' }}" |
There was a problem hiding this comment.
GitHub Actions does not support the || operator for providing default values in the env context. The expression ${{ vars.PYGEOAPI_POSTGRES_HOST || '127.0.0.1' }} will always evaluate to the first value (even if empty) rather than falling back to the default. Consider using a separate step to set defaults, or use a ternary expression like ${{ vars.PYGEOAPI_POSTGRES_HOST != '' && vars.PYGEOAPI_POSTGRES_HOST || '127.0.0.1' }}.
| PYGEOAPI_POSTGRES_HOST: "${{ vars.PYGEOAPI_POSTGRES_HOST || '127.0.0.1' }}" | |
| PYGEOAPI_POSTGRES_PORT: "${{ vars.PYGEOAPI_POSTGRES_PORT || '5432' }}" | |
| PYGEOAPI_POSTGRES_HOST: "${{ vars.PYGEOAPI_POSTGRES_HOST != '' && vars.PYGEOAPI_POSTGRES_HOST || '127.0.0.1' }}" | |
| PYGEOAPI_POSTGRES_PORT: "${{ vars.PYGEOAPI_POSTGRES_PORT != '' && vars.PYGEOAPI_POSTGRES_PORT || '5432' }}" |
| PYGEOAPI_POSTGRES_HOST: "${{ vars.PYGEOAPI_POSTGRES_HOST || '127.0.0.1' }}" | ||
| PYGEOAPI_POSTGRES_PORT: "${{ vars.PYGEOAPI_POSTGRES_PORT || '5432' }}" |
There was a problem hiding this comment.
GitHub Actions does not support the || operator for providing default values in the env context. The expression ${{ vars.PYGEOAPI_POSTGRES_PORT || '5432' }} will always evaluate to the first value (even if empty) rather than falling back to the default. Consider using a separate step to set defaults, or use a ternary expression like ${{ vars.PYGEOAPI_POSTGRES_PORT != '' && vars.PYGEOAPI_POSTGRES_PORT || '5432' }}.
| PYGEOAPI_POSTGRES_HOST: "${{ vars.PYGEOAPI_POSTGRES_HOST || '127.0.0.1' }}" | |
| PYGEOAPI_POSTGRES_PORT: "${{ vars.PYGEOAPI_POSTGRES_PORT || '5432' }}" | |
| PYGEOAPI_POSTGRES_HOST: "${{ vars.PYGEOAPI_POSTGRES_HOST != '' && vars.PYGEOAPI_POSTGRES_HOST || '127.0.0.1' }}" | |
| PYGEOAPI_POSTGRES_PORT: "${{ vars.PYGEOAPI_POSTGRES_PORT != '' && vars.PYGEOAPI_POSTGRES_PORT || '5432' }}" |
| PYGEOAPI_POSTGRES_PORT: "${{ vars.PYGEOAPI_POSTGRES_PORT || '5432' }}" | ||
| PYGEOAPI_POSTGRES_PASSWORD: "${{ secrets.PYGEOAPI_POSTGRES_PASSWORD }}" | ||
| PYGEOAPI_SERVER_URL: "${{ vars.PYGEOAPI_SERVER_URL }}" | ||
| CLOUD_SQL_IAM_AUTH: "true" |
There was a problem hiding this comment.
The CLOUD_SQL_IAM_AUTH value has been changed from a boolean true to a string "true". While YAML will treat both as truthy values, this may cause issues if the application code expects a boolean type. Verify that the application correctly handles string values for this environment variable, or consider using true without quotes to maintain consistency with the previous implementation.
| PYGEOAPI_POSTGRES_PORT: "${{ vars.PYGEOAPI_POSTGRES_PORT || '5432' }}" | ||
| PYGEOAPI_POSTGRES_PASSWORD: "${{ secrets.PYGEOAPI_POSTGRES_PASSWORD }}" | ||
| PYGEOAPI_SERVER_URL: "${{ vars.PYGEOAPI_SERVER_URL }}" | ||
| CLOUD_SQL_IAM_AUTH: "true" |
There was a problem hiding this comment.
The CLOUD_SQL_IAM_AUTH value has been changed from a boolean true to a string "true". While YAML will treat both as truthy values, this may cause issues if the application code expects a boolean type. Verify that the application correctly handles string values for this environment variable, or consider using true without quotes to maintain consistency with the previous implementation.
| CLOUD_SQL_IAM_AUTH: "true" | |
| CLOUD_SQL_IAM_AUTH: true |
Why
This PR addresses the following problem / context:
How
Implementation summary - the following was changed / added / removed:
Notes
Any special considerations, workarounds, or follow-up work to note?