This GitHub Actions workflow automates the building, testing, deploying, and monitoring process for a Kubernetes application using Docker, Helm, and Google Cloud Platform (GCP) services.
This pipeline gives developers the option to deploy their app with a simple push.
🛠️ Build: The workflow starts with building a Docker image of the application, pushing it to Docker Hub, packaging the Helm chart and upload it to GCP bucket.
✅ Test: After building, the application is deployed to a test cluster using the Helm chart. Helm tests are then executed on the deployed application.
🌐 Deploy: Upon successful testing, the application is deployed to a production cluster using the Helm chart.
📈 Monitor: Finally, the monitoring components (Prometheus and Grafana) are installed on the production cluster if not already present.
-
Ensure you have these credentials saved as secrets in your repository settings:
DOCKER_USERNAME
: Your Docker Hub username.DOCKER_PASSWORD
: Your Docker Hub password.API_KEY
: Your app API key , if there is a needGCP_SERVICE_ACCOUNT_KEY
: Contents of your GCP service account key JSON file.
-
Configure the required environment variables in your
.github/workflows/workflow.yaml
:PROJECT_ID
: Your GCP project ID.BUCKET_NAME
: Name of the GCP bucket to store Helm packages.HELM_PACKAGE
: Helm package file name.TAG
: Tag for Docker image and Helm chart version coming fromversionung.sh
.
-
That's it! Push your code changes to the
main
branch to trigger the workflow.
- GCP serverless Cloud Functions can be triggered automatically using an event trigger, but for clarity, it is triggered manually during the
cleanups
job in the workflow.