Apigee Proxy Deployment Workflow
Overview
This GitHub Actions workflow automates the deployment of Apigee API proxies across non-production and production environments with proper approval gates and validations.
Workflow Structure
1. Input Parameters
inputs:
proxy_name: # Name of the API proxy to deploy
proxy_directory: # Directory containing proxy files (default: 'apiproxy')
environment_group: # Target environment group (default, edd, homerun, etc.)
environment_type: # Target environment (dev, test-env, test, uat, prod)
2. Workflow Jobs
A. Validation Phase
- validate_deployment_inputs
- Validates environment configuration
- Checks environment group and type
- Determines if it's a production deployment
- Status checks and validation gates
B. Authentication Phase
- Setup_Auth
- Sets up authentication for both non-prod and prod environments
- Manages GCP tokens for both environments
- Handles credential management
C. Non-Production Deployment Phase
-
Validate_API_Proxy
- Runs apigeelint validation
- Ensures proxy meets quality standards
- Validates proxy structure
-
Build_And_Upload_NonProd
- Creates API proxy bundle
- Uploads to non-prod organization
- Manages artifact creation and storage
- Gets revision number
-
Deploy_To_NonProd
- Deploys to non-prod environment
- Handles environment-specific configurations
- Manages deployment process
-
Verify_NonProd_Deployment
- Verifies successful deployment
- Checks deployment status
- Ensures proxy is accessible
D. Production Approval Phase
- Request_Production_Approval
- Initiates production deployment approval
- Manages environment protection rules
- Waits for manual approval
- Shows approval button in GitHub UI
E. Production Deployment Phase
-
Build_And_Upload_Prod
- Downloads artifacts from non-prod
- Uploads to production organization
- Maintains version consistency
-
Deploy_To_Production
- Deploys approved version to production
- Manages production environment specifics
- Handles production deployment verification
Environment Setup
Required Environments
- Development/Test Environments
- Production Approval Environment
Name: production-approval
Protection rules: Required reviewers
- Production Environment
Name: production
Environment URL: Auto-generated
Required Secrets
APIGEE_ORG: # Non-prod Apigee organization
APIGEE_ORG_PROD: # Production Apigee organization
WORKLOAD_IDENTITY_PROVIDER: # Non-prod GCP identity provider
WORKLOAD_IDENTITY_PROVIDER_PROD: # Production GCP identity provider
SERVICE_ACCOUNT: # Non-prod service account
SERVICE_ACCOUNT_PROD: # Production service account
Workflow Features
1. Status Tracking
- Detailed logging with emojis for visual feedback
- Group markers for organized logs
- Clear success/failure indicators
2. Error Handling
- Comprehensive error checking
- Detailed error messages
- Retry mechanisms for API calls
3. Security Features
- Environment-specific authentication
- Secure token management
- Protected production deployments
4. Artifact Management
- Maintains proxy bundle consistency
- Proper version tracking
- Secure artifact storage
Usage Example
name: Deploy API Proxy
on:
workflow_dispatch:
inputs:
proxy_name:
description: "API Proxy Name"
required: true
environment_type:
description: "Target Environment"
type: choice
options:
- dev
- test
- prod
jobs:
deploy:
uses: ./.github/workflows/Reusable-proxy-deploy.yml@main
with:
proxy_name: ${{ inputs.proxy_name }}
environment_type: ${{ inputs.environment_type }}
environment_group: "default"
secrets: inherit
Production Deployment Flow
- Non-prod deployment succeeds
- Production approval request created
- Reviewers notified via GitHub
- Approval through GitHub UI
- Automatic production deployment after approval
Best Practices
- Always validate in non-prod first
- Use meaningful proxy names
- Keep proxy bundle structure consistent
- Monitor deployment logs
- Review changes before production approval
Troubleshooting
- Check proxy bundle structure
- Verify environment configurations
- Ensure proper authentication
- Review deployment logs
- Check GCP permissions
Would you like me to add any specific sections or provide more details about any particular aspect?