-
Notifications
You must be signed in to change notification settings - Fork 48
Use published SDK version instead of local replace directives #1067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The SDK is a user-facing published module, so gateway components should depend on a specific published version (v0.3.9) rather than using local replace directives. This ensures gateway builds use the same SDK version that external policy authors depend on, providing reproducible builds and clear compatibility contracts. - Remove SDK replace directives from policy-engine, gateway-builder, and gateway-controller go.mod files - Update gateway-builder and gateway-controller SDK dependency from v0.0.0 to published v0.3.9 - Keep common module replace directives (internal, unpublished module) - Add separate sdk-integration-test workflow that injects local SDK via go mod edit -replace to validate SDK changes against gateway integration tests
WalkthroughThe changes update GitHub Actions workflows to add SDK integration testing capabilities and update Go module dependencies across gateway components to use SDK v0.3.9 instead of local path replacements, removing local module overrides. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/sdk-integration-test.yml:
- Around line 27-36: The workflow step that injects the local SDK via go mod
edit -replace into the modules (gateway/gateway-runtime/policy-engine,
gateway-builder, gateway-controller) is missing go mod tidy, which can leave
go.sum inconsistent; after each go mod edit -replace invocation run go mod tidy
in the same module to update go.sum and pull correct transitive deps, and make
the step more robust by using absolute paths based on $GITHUB_WORKSPACE instead
of chained cd commands so each module (policy-engine, gateway-builder,
gateway-controller) is edited and tidied reliably.
| - name: Inject local SDK into gateway modules | ||
| run: | | ||
| cd gateway/gateway-runtime/policy-engine | ||
| go mod edit -replace github.com/wso2/api-platform/sdk=../../../sdk | ||
|
|
||
| cd ../../gateway-builder | ||
| go mod edit -replace github.com/wso2/api-platform/sdk=../../sdk | ||
|
|
||
| cd ../gateway-controller | ||
| go mod edit -replace github.com/wso2/api-platform/sdk=../../sdk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing go mod tidy after injecting replace directives.
After go mod edit -replace, the go.sum files won't reflect the local SDK's transitive dependencies. If the local SDK differs from v0.3.9 in its dependency graph, subsequent go build or go test may fail or fetch unexpected versions. Run go mod tidy in each module after editing.
Also, the chained cd navigation is fragile — consider using absolute paths from $GITHUB_WORKSPACE for clarity.
Proposed fix
- name: Inject local SDK into gateway modules
run: |
- cd gateway/gateway-runtime/policy-engine
- go mod edit -replace github.com/wso2/api-platform/sdk=../../../sdk
+ cd $GITHUB_WORKSPACE/gateway/gateway-runtime/policy-engine
+ go mod edit -replace github.com/wso2/api-platform/sdk=../../../sdk
+ go mod tidy
- cd ../../gateway-builder
- go mod edit -replace github.com/wso2/api-platform/sdk=../../sdk
+ cd $GITHUB_WORKSPACE/gateway/gateway-builder
+ go mod edit -replace github.com/wso2/api-platform/sdk=../../sdk
+ go mod tidy
- cd ../gateway-controller
- go mod edit -replace github.com/wso2/api-platform/sdk=../../sdk
+ cd $GITHUB_WORKSPACE/gateway/gateway-controller
+ go mod edit -replace github.com/wso2/api-platform/sdk=../../sdk
+ go mod tidy🤖 Prompt for AI Agents
In @.github/workflows/sdk-integration-test.yml around lines 27 - 36, The
workflow step that injects the local SDK via go mod edit -replace into the
modules (gateway/gateway-runtime/policy-engine, gateway-builder,
gateway-controller) is missing go mod tidy, which can leave go.sum inconsistent;
after each go mod edit -replace invocation run go mod tidy in the same module to
update go.sum and pull correct transitive deps, and make the step more robust by
using absolute paths based on $GITHUB_WORKSPACE instead of chained cd commands
so each module (policy-engine, gateway-builder, gateway-controller) is edited
and tidied reliably.
Summary
Fix #1066
replacedirectives with published versionv0.3.9in gateway go.mod filessdk-integration-test.yml) to validate SDK changes against gateway integration testsProblem
Gateway components used
replace github.com/wso2/api-platform/sdk => ../../sdkto always build against local SDK source. Since the SDK is a user-facing published module with external consumers (policy authors), this caused non-reproducible builds and masked potential interface drift between the gateway runtime and published SDK versions.Changes
go.mod (3 files):
gateway/gateway-runtime/policy-engine/go.mod— removed SDK replace directivegateway/gateway-builder/go.mod— removed SDK replace, updatedv0.0.0→v0.3.9gateway/gateway-controller/go.mod— removed SDK replace, updatedv0.0.0→v0.3.9commonmodule replace directives kept as-is (internal, unpublished module)CI (1 new file):
.github/workflows/sdk-integration-test.yml— triggers onsdk/**changes, injectsgo mod edit -replaceto test local SDK against gateway integration testsNo changes to Dockerfiles or Makefiles — SDK source continues to be copied into Docker builds via
--build-context sdk. During normal builds Go downloads the published version from module proxy; during SDK CI testing the injected replace directive makes Go use the local copy.Summary by CodeRabbit