Welcome! This repository provides wrapper workflows that trigger standardized CI and CD reusable workflows hosted in cicd-templates. These wrappers make it easy for your teams to implement secure, consistent CI/CD pipelines with minimal setup. While this setup was tested using a Python Flask application, it's designed to be language-agnostic and can be adapted for any type of application or service.
-
ci-wrapper.ymlβ triggers Docker Build + Security Scans (CI)- Gitleaks secrets scanning
- Trivy vulnerability scanning
- OWASP Dependency Check
- SonarQube analysis
- Pytest
- Image Size Validator
- ECR push
- Slack alerts
- Artifact uploads
-
cd-wrapper.ymlβ triggers deployment to EKS using kubectl (CD)- Pulls latest ECR image
- Applies manifests to EKS (supports multiple modes)
- Validates rollout with retry logic
- Prunes old & untagged images
Before using the CI/CD workflows, ensure the following setup is complete.
- Go to your repository (e.g.,
https://github.com/your-org/your-repo) - Click on the "Settings" tab at the top
- In the left sidebar, go to "Secrets and variables" β "Actions"
- Click the "New repository secret" button
- Enter the secret name (e.g.,
AWS_ACCESS_KEY_ID) - Enter the secret value (your actual AWS access key, token, etc.)
- Click "Add secret"
- Repeat steps 4β7 for each secret required by the pipeline
See Secrets Table for a full list.
Make sure your repository includes the following:
- A
Dockerfilein the root or specified path - Kubernetes manifest files:
- For single-file mode:
deployment.template.yaml - For multi-file mode:
deployment.yaml,service.yaml,ingress.yamlinside ak8s/folder
- For single-file mode:
- Dependency files for your tech stack:
- Python:
requirements.txt - Node.js:
package.json - Java:
pom.xml,build.gradle, etc.
- Python:
- (Optional) A SonarQube project already created if
run_sonaris enabled
π Create a SonarQube project - (Optional) Slack channel created and Slack webhook URL generated (if
slack-enabledis true)
π Set up a Slack webhook
- GitHub Actions must be enabled for the repository
π GitHub Actions documentation - User running the workflow must have write access to the repo
- AWS IAM user/role used must have:
- ECR access permissions:
π Set up permissions for Amazon ECR - EKS cluster access:
π Configure access to EKS using IAM
- ECR access permissions:
- (Optional) Slack webhook must be allowed to post to the selected channel
- (Optional) SonarQube token must have permission to execute analysis on the selected project
- Enable branch protection rules to enforce successful CI before merging
π Protect branches in GitHub
| Input Name | Required | Type | Default | Description |
|---|---|---|---|---|
image_name |
Yes | string | - | Full image name (e.g., ghcr.io/my-org/my-app) |
image_tag |
Yes | string | - | Tag for the built image (e.g., latest, v1.0.0) |
dockerfile_path |
No | string | ./Dockerfile | Path to the Dockerfile |
context |
No | string | . | Docker build context directory |
build_args |
No | string | --no-cache | Extra arguments to pass to Docker build |
run_gitleaks |
No | boolean | true | Enable Gitleaks scan |
gitleaks_fetch_depth |
No | number | 1 | Git fetch depth for Gitleaks (0 = all commits, 1 = most recent) |
continue_on_gitleaks_error |
No | boolean | false | Whether to continue pipeline if Gitleaks scan fails |
run_owasp |
No | boolean | true | Enable OWASP dependency check |
continue_on_owasp_error |
No | boolean | false | Whether to continue pipeline if OWASP scan fails |
run_pytest |
No | boolean | true | Run tests using Pytest |
continue_on_pytest_error |
No | boolean | true | Whether to continue pipeline if tests fail |
run_trivy |
No | boolean | true | Enable Trivy scan for vulnerabilities |
continue_on_trivy_error |
No | boolean | false | Whether to continue pipeline if Trivy scan fails |
image_size_threshold_mb |
No | number | 200 | Maximum allowed image size in MB |
continue_on_size_check_error |
No | boolean | false | Whether to continue pipeline if image exceeds size |
push_to_ecr |
No | boolean | true | Whether to push the image to AWS ECR |
ecr_repository |
Yes* | string | - | ECR repository name (required if push_to_ecr is true) |
run_sonar |
No | boolean | true | Whether to run SonarQube static analysis |
sonar_host_url |
Yes* | string | - | SonarQube server URL (required if run_sonar is true) |
sonar_project_key |
Yes* | string | - | SonarQube project key |
sonar_project_name |
Yes* | string | - | SonarQube project name |
slack_enabled |
No | boolean | true | Whether to send Slack notifications |
slack_channel |
No | string | "#github-actions-notification" | Slack channel to send notifications to |
| Input Name | Required | Type | Default | Description |
|---|---|---|---|---|
ecr_repo |
Yes | string | - | Full ECR image URL to deploy (e.g., account.dkr.ecr.region.amazonaws.com/repo-name) |
eks_cluster_name |
Yes | string | - | Name of the EKS cluster to connect and deploy into |
deployment_mode |
No | string | "singlefile" | Deployment mode: singlefile, filenames, or recursive |
deployment_file |
No* | string | ./deployment.template.yaml | Path to single manifest file (used if deployment_mode is singlefile) |
deployment_files |
No* | string | - | Comma-separated list of files (used if deployment_mode is filenames) |
continue_on_validation_error |
No | boolean | false | Whether to continue if post-deploy validation fails |
delete_old_images |
No | boolean | true | Whether to delete older unused ECR images after deployment |
*Only one of
deployment_fileordeployment_filesis required, depending on the deployment mode.
| Secret Name | Required | Description |
|---|---|---|
| SLACK_WEBHOOK_URL | No | Slack webhook URL used for sending pipeline notifications |
| AWS_ACCESS_KEY_ID | Yes | AWS access key for authenticating with ECR and EKS |
| AWS_SECRET_ACCESS_KEY | Yes | AWS secret key for ECR and EKS authentication |
| AWS_REGION | Yes | AWS region (e.g., ap-south-1) where your resources are hosted |
| AWS_ACCOUNT_ID | Yes | AWS account ID used in constructing ECR repository URLs |
| SONAR_TOKEN | No | Token used to authenticate with SonarQube for static code analysis |
Note:
SLACK_WEBHOOK_URLandSONAR_TOKENare optional. They are only required if:
slack_enabled: trueis set in your workflow inputs (for Slack notifications), orrun_sonar: trueis enabled (for SonarQube static analysis).
If these secrets are not provided while the respective features are enabled, the pipeline may fail at runtime.
To use the CI/CD pipeline with the provided wrapper workflows, follow these steps:
Ensure your repository contains the following structure:
your-repo/
βββ .github/
β βββ workflows/
β βββ ci-wrapper.yml
β βββ cd-wrapper.yml
- Create a
.github/workflows/folder at the root of your repository if it doesn't already exist. - Place both the CI and CD wrapper workflow files (
ci-wrapper.ymlandcd-wrapper.yml) inside this folder.
The pipeline can be triggered in three ways:
on:
push:
branches:
- main- Every time you push code to the
mainbranch, the pipeline will automatically trigger. - branch name can be changed according to the usage
- No manual action is needed.
on:
workflow_dispatch:To run manually:
- Go to the Actions tab on your GitHub repository.
- Click on the desired workflow (
ci-wrapperorcd-wrapper). - Click "Run workflow".
- Click Run to start the workflow manually.
on:
schedule:
- cron: '20 8 * * *' # Runs every day at 08:20 AM UTC- The workflow will automatically run at the defined time.
- No user action is needed after setup.
After triggering the workflow:
- Open the Actions tab in your GitHub repository.
- Click on the workflow run (CI or CD) you want to inspect.
- Click on any job or step to expand and view logs in real time or post-run.
If the workflow generates artifacts (e.g., scan reports, test results, deployment files):
- Open the Actions tab.
- Select the completed run.
- Scroll to the bottom to the Artifacts section.
- Click the artifact name to download it.
Make sure all required
secretsandinputsare configured correctly in your repository settings for the pipeline to work successfully.