Add fast post-merge gateway integration check#1126
Add fast post-merge gateway integration check#1126Tharsanan1 wants to merge 2 commits intowso2:mainfrom
Conversation
WalkthroughThe pull request restructures GitHub Actions workflows into multi-phase pipelines with matrix-driven testing strategies (SQLite and PostgreSQL), adds Docker image caching and artifact exports, introduces PostgreSQL preflight verification, and enhances timing and debugging capabilities. Makefile changes introduce optional build cache arguments for Docker buildx operations. Changes
Sequence DiagramsequenceDiagram
participant Developer
participant GitHub as GitHub Actions
participant BuildJob as build-images Job
participant Registry as Image Registry
participant IntegrationJob as integration-test Job
participant Postgres as PostgreSQL
participant Tests as Test Suite
Developer->>GitHub: Push changes
GitHub->>BuildJob: Trigger build-images
BuildJob->>BuildJob: Setup Go + cache
BuildJob->>BuildJob: Build coverage image<br/>(instrumented)
BuildJob->>BuildJob: Build mock service image
BuildJob->>Registry: Export + upload artifacts
Registry-->>GitHub: Make artifacts reusable
par SQLite Mode
GitHub->>IntegrationJob: Run integration-test<br/>(sqlite matrix)
IntegrationJob->>IntegrationJob: Download images
IntegrationJob->>IntegrationJob: Load docker images
IntegrationJob->>Tests: Execute tests
Tests-->>IntegrationJob: Report results
and PostgreSQL Mode
GitHub->>IntegrationJob: Run integration-test<br/>(postgres matrix)
IntegrationJob->>IntegrationJob: Download images
IntegrationJob->>Postgres: Verify schema + connections
Postgres-->>IntegrationJob: Verification OK
IntegrationJob->>Tests: Execute tests
Tests-->>IntegrationJob: Report results
end
IntegrationJob->>IntegrationJob: Record timing metrics
IntegrationJob->>GitHub: Upload coverage + reports<br/>(per-matrix naming)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @.github/workflows/gateway-integration-test.yml:
- Line 13: Remove the stale path filter entry
".github/workflows/gateway-integration-test-postgres.yml" from the paths list in
the workflow configuration in gateway-integration-test.yml (or alternatively
restore that missing workflow file if intended); update the paths filter so it
only references existing workflow files and ensure the paths array no longer
contains the exact string
".github/workflows/gateway-integration-test-postgres.yml".
In @.github/workflows/gateway-post-merge-integration-check.yml:
- Line 45: The workflow uses the wrong container name when collecting logs after
`docker compose -p "gateway-it-postgres-verify"`; replace the incorrect
`it-gateway-controller` reference with the actual container name
`gateway-it-postgres-verify-gateway-controller-1` or, better, use `docker
compose -p "$PROJECT" logs gateway-controller` (or `docker logs
gateway-it-postgres-verify-gateway-controller-1`) so the logs file is populated
and the grep won’t fail under set -euo pipefail; also consolidate the two
duplicated "Run integration tests" steps (the identical steps that differ only
by condition) into a single step that contains both conditional logic or a
unified condition to avoid repetition.
🧹 Nitpick comments (3)
.github/workflows/gateway-post-merge-integration-check.yml (2)
60-75: Each matrix job rebuilds all images from scratch — consider reusing the artifact strategy from the PR workflow.Unlike
gateway-integration-test.ymlwhich builds once and shares images via artifact, this workflow rebuilds all coverage + mock images in each matrix leg (normal and postgres). On a post-merge path this doubles the build time. If speed is a goal (as the PR title suggests), consider extracting abuild-imagesjob similar to the PR workflow and sharing the tarball.
107-117: Two identical run steps can be collapsed into one unconditional step.Both the "normal" and "postgres" steps execute the exact same command (
COMPOSE_FILE=${{ matrix.compose_file }} make test-integration). The matrix already ensures only one mode runs per job, so theifconditions are redundant.♻️ Proposed simplification
- - name: Run integration tests (normal) - if: matrix.mode == 'normal' - run: | - cd gateway - COMPOSE_FILE=${{ matrix.compose_file }} make test-integration - - - name: Run integration tests (postgres) - if: matrix.mode == 'postgres' - run: | - cd gateway - COMPOSE_FILE=${{ matrix.compose_file }} make test-integration + - name: Run integration tests (${{ matrix.mode }}) + run: | + cd gateway + COMPOSE_FILE=${{ matrix.compose_file }} make test-integration.github/workflows/gateway-integration-test.yml (1)
91-93: Minor:mode: sqlitevssuffix: normalnaming inconsistency.The mode is
sqlitebut the artifact suffix isnormal. In the post-merge workflow, the equivalent mode isnormalwith suffixnormal. This inconsistency could cause confusion when correlating artifacts across workflows.Consider aligning the mode name (
normal→sqliteor vice versa) across both workflows for consistency.
| - "tests/mock-servers/**" | ||
| - "samples/sample-service/**" | ||
| - ".github/workflows/gateway-integration-test.yml" | ||
| - ".github/workflows/gateway-integration-test-postgres.yml" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if the referenced workflow file exists
fd "gateway-integration-test-postgres.yml" .github/workflows/Repository: wso2/api-platform
Length of output: 43
Remove the stale path filter entry for gateway-integration-test-postgres.yml.
The referenced workflow file does not exist, so this path filter will never trigger. Either restore the postgres integration workflow file or remove this entry from the filter.
🤖 Prompt for AI Agents
In @.github/workflows/gateway-integration-test.yml at line 13, Remove the stale
path filter entry ".github/workflows/gateway-integration-test-postgres.yml" from
the paths list in the workflow configuration in gateway-integration-test.yml (or
alternatively restore that missing workflow file if intended); update the paths
filter so it only references existing workflow files and ensure the paths array
no longer contains the exact string
".github/workflows/gateway-integration-test-postgres.yml".
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.25' | ||
| go-version: "1.25" |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
Go 1.25 release date availability
💡 Result:
- Go 1.25 release date: August 12, 2025 (Go 1.25.0). [1][2]
- Availability: Go 1.25 binary installers/archives are available from the official downloads page (go.dev/dl). [1][3]
- Updates: Go 1.25 has received minor (patch) releases after 1.25.0 (for example Go 1.25.1 on September 3, 2025). [2]
Sources: [1] Go blog announcement, [2] Go release history, [3] Official downloads page.
🏁 Script executed:
cat -n .github/workflows/gateway-post-merge-integration-check.ymlRepository: wso2/api-platform
Length of output: 6880
Fix container name in postgres verification step (line 96).
When docker compose -p "gateway-it-postgres-verify" is used (line 86), the gateway-controller container is named gateway-it-postgres-verify-gateway-controller-1, not it-gateway-controller. Line 96 attempts to read logs from a non-existent container, creating an empty log file. The subsequent grep (line 97) then fails under set -euo pipefail, causing the step to always fail. Use the correct container name: docker logs gateway-it-postgres-verify-gateway-controller-1 or reference the service name via docker compose -p "$PROJECT" logs gateway-controller.
Additionally, the two "Run integration tests" steps (lines 107–118) are identical except for their conditions; consolidate into a single step.
🤖 Prompt for AI Agents
In @.github/workflows/gateway-post-merge-integration-check.yml at line 45, The
workflow uses the wrong container name when collecting logs after `docker
compose -p "gateway-it-postgres-verify"`; replace the incorrect
`it-gateway-controller` reference with the actual container name
`gateway-it-postgres-verify-gateway-controller-1` or, better, use `docker
compose -p "$PROJECT" logs gateway-controller` (or `docker logs
gateway-it-postgres-verify-gateway-controller-1`) so the logs file is populated
and the grep won’t fail under set -euo pipefail; also consolidate the two
duplicated "Run integration tests" steps (the identical steps that differ only
by condition) into a single step that contains both conditional logic or a
unified condition to avoid repetition.
There was a problem hiding this comment.
Is this to run Postgres not in PR, but after PR merge?
Summary
Makefile updates
BUILDX_CACHE_ARGShook to gateway controller/runtime/builder Makefilesdocker buildx build --loadfor cache compatibilityNotes
Summary by CodeRabbit
New Features
Improvements