Split LocalStack integration tests for fork vs upstream PRs#275
Split LocalStack integration tests for fork vs upstream PRs#275jhjaggars wants to merge 2 commits intoopenshift-online:mainfrom
Conversation
Fork PRs cannot access repository secrets (LOCALSTACK_AUTH_TOKEN), so this change splits the workflow into two jobs: - localstack-community: Uses LocalStack Community (free, no token) for fork PRs - Runs processor in scan mode (no Lambda/API) - Uses make start-community and make deploy-community - localstack-pro: Uses LocalStack Pro (full features) for upstream PRs and main - Runs with Lambda containers and API Gateway - Uses make start and make deploy-api Changes: - docker-compose.yml: Make image configurable via LOCALSTACK_IMAGE env var - terraform/local/variables.tf: Add deploy_api variable - terraform/local/main.tf: Gate API/ECR resources on deploy_api - terraform/local/outputs.tf: Make API outputs conditional - Makefile: Add start-community and deploy-community targets - .github/workflows/: Split into two jobs with different conditions This allows fork contributors to run integration tests without LocalStack Pro while maintaining full testing for upstream changes. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhjaggars The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
|
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #275 +/- ##
===========================================
- Coverage 73.07% 52.61% -20.47%
===========================================
Files 8 12 +4
Lines 765 1015 +250
===========================================
- Hits 559 534 -25
- Misses 206 456 +250
- Partials 0 25 +25
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
This commit simplifies the LocalStack testing approach by skipping tests entirely for fork PRs instead of trying to support LocalStack Community with conditional terraform resources. Changes: - Reverted all terraform conditional logic (deploy_api variable, count guards) - Removed start-community and deploy-community Makefile targets - Restored hardcoded LocalStack Pro image in docker-compose.yml - Simplified workflow to single job that skips fork PRs via if condition - Fixed YAML indentation in Vector patch heredoc Fork contributors get full coverage from integration-tests.yaml (minikube + MinIO) which doesn't require LocalStack Pro secrets. This eliminates maintenance burden of gating every new resource with conditionals. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
User description
Summary
This PR splits the LocalStack integration tests workflow into two jobs to support fork contributors who cannot access the
LOCALSTACK_AUTH_TOKENrepository secret.Changes
1. Infrastructure Configuration
LOCALSTACK_IMAGEenvironment variabledeploy_apivariable to control API stack deploymentcount = var.deploy_api ? 1 : 02. Makefile Targets
start-community: Start LocalStack Community (no auth token required)deploy-community: Deploy infrastructure without Lambda or API (for Community edition)3. GitHub Workflow Split
Job 1:
localstack-community(Fork PRs)github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repositorylocalstack/localstack:latest)make deploy-community(no Lambda, no API)make run-scan-backgroundmake test-e2e-quick(API tests self-skip when endpoint is empty)Job 2:
localstack-pro(Upstream PRs & Main)github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)localstack/localstack-pro:latest)make deploy-api(full stack with Lambda and API)make test-e2e-with-warmup(full test suite)Benefits
Testing
PR Type
Enhancement
Description
Split LocalStack integration tests into two separate jobs for fork vs upstream PRs
Added LocalStack Community job for fork PRs without auth token requirement
Added LocalStack Pro job for upstream PRs with full feature support
Made LocalStack image configurable via environment variable in docker-compose
Added
deploy_apivariable to conditionally gate API/ECR resources in TerraformAdded Makefile targets
start-communityanddeploy-communityfor Community editionDiagram Walkthrough
flowchart LR PR["Pull Request Event"] FORK{"Fork PR?"} UPSTREAM["Upstream PR or Push"] COMMUNITY["localstack-community Job"] PRO["localstack-pro Job"] COMM_IMG["LocalStack Community Image"] PRO_IMG["LocalStack Pro Image"] COMM_DEPLOY["deploy-community: No Lambda/API"] PRO_DEPLOY["deploy-api: Full Stack"] COMM_TEST["test-e2e-quick"] PRO_TEST["test-e2e-with-warmup"] PR --> FORK FORK -->|Yes| COMMUNITY FORK -->|No| UPSTREAM UPSTREAM --> PRO COMMUNITY --> COMM_IMG PRO --> PRO_IMG COMM_IMG --> COMM_DEPLOY PRO_IMG --> PRO_DEPLOY COMM_DEPLOY --> COMM_TEST PRO_DEPLOY --> PRO_TESTFile Walkthrough
localstack-integration-tests.yaml
Split workflow into fork and upstream jobs.github/workflows/localstack-integration-tests.yaml
localstack-integrationjob into two conditional jobs:localstack-communityandlocalstack-prolocalstack-communityjob runs for fork PRs (whengithub.event.pull_request.head.repo.full_name != github.repository)localstack-projob runs for upstream PRs and main branch pushesmake start-communityandmake deploy-communitywithout auth token
make startandmake deploy-apiwithLOCALSTACK_AUTH_TOKENsecret
debugging steps
docker-compose.yml
Make LocalStack image configurabledocker-compose.yml
LOCALSTACK_IMAGEenvironmentvariable with default fallback to
localstack/localstack-pro:latestruntime
Makefile
Add Community edition Makefile targetsMakefile
start-communitytarget to start LocalStack Community editionusing
LOCALSTACK_IMAGE=localstack/localstack:latestdeploy-communitytarget to deploy infrastructure without Lambdaand API using
-var="deploy_lambda=false" -var="deploy_api=false".PHONYdeclaration to include new targetsstarttarget help text to specify "LocalStack Pro"variables.tf
Add deploy_api variableterraform/local/variables.tf
deploy_apiboolean variable (default: true) to control APIstack deployment
features
main.tf
Gate API resources on deploy_api variableterraform/local/main.tf
count = var.deploy_api ? 1 : 0to ECR repositories(
lambda_processor,api_service,api_authorizer)count = var.deploy_api ? 1 : 0to all API-related IAM roles andpolicies
count = var.deploy_api ? 1 : 0to Secrets Manager secret for APIPSK
count = var.deploy_lambda &&var.deploy_api ? 1 : 0count = var.deploy_api ? 1 : 0tocentral_api_stackmodule[0]outputs.tf
Make API outputs conditionalterraform/local/outputs.tf
var.deploy_apivariableapi_gateway_endpoint,api_gateway_id,api_authorizer_function_arn,api_service_function_arn,api_psk_secret_name,ecr_api_service_url,ecr_api_authorizer_urlcentral_lambda_functionoutput to check bothdeploy_lambda &&deploy_apiecr_repository_urloutput to be conditional ondeploy_apitest_commandsoutput to conditionally show API and Lambda testcommands