11# ===============================================
2- # CI/CD Pipeline: Pull GHCR image -> Re-tag -> Push to DockerHub -> Deploy with Terraform
2+ # CI/CD Pipeline: Pull GHCR image -> Re-tag -> Push to DockerHub -> Deploy with Terraform -> Integration Tests -> Cleanup
33# ===============================================
44# Description:
5- # This workflow takes a Docker image from GHCR (GitHub Container Registry) generated by a PR or push,
6- # retags it with the DockerHub username, pushes it to DockerHub, and then deploys the latest image
7- # to Cloud Run using Terraform. It also handles initial database table creation if necessary.
5+ # This workflow automates the deployment and testing of the register-ticket-api service.
6+ # It performs the following steps:
7+ # 1. Pulls a Docker image from GitHub Container Registry (GHCR).
8+ # 2. Retags the image with DockerHub username and pushes it to DockerHub.
9+ # 3. Deploys the application to GCP using Terraform.
10+ # 4. Populates the database with test records.
11+ # 5. Runs integration tests against the deployed environment.
12+ # 6. Cleans up test data and database objects (always runs except for local environments).
813#
914# Inputs:
10- # - deployment_env: Deployment environment (e.g., staging, production)
15+ # - deployment_env: Deployment environment (e.g., local, staging, production)
1116# - image_uri: URI of the image in GHCR (e.g., ghcr.io/org/repo:tag)
1217#
1318# Outputs:
14- # - dockerhub_image: URI of the retagged image pushed to DockerHub
19+ # - dockerhub_image: URI of the image pushed to DockerHub
20+ # - db_host: Hostname/IP of the deployed PostgreSQL database
21+ # - api_url: URL of the deployed API service
1522# ===============================================
1623
1724on :
@@ -143,6 +150,9 @@ jobs:
143150 -v ON_ERROR_STOP=1
144151 done
145152
153+ # -------------------------------------------------
154+ # Job: Run integration tests
155+ # -------------------------------------------------
146156 run-integration-tests :
147157 needs : deploy
148158 uses : ./.github/workflows/integration-tests.yml
@@ -152,6 +162,9 @@ jobs:
152162 api_url : ${{ needs.deploy.outputs.api_url }}
153163 secrets : inherit # pragma: allowlist secret
154164
165+ # -------------------------------------------------
166+ # Job: Cleanup database
167+ # -------------------------------------------------
155168 cleanup-database :
156169 needs : [deploy, run-integration-tests]
157170 environment : ${{ inputs.deployment_env }}
0 commit comments