fix(gateway-builder,cli): stage python-executor inside builder container#2728
Merged
Krishanx92 merged 1 commit intoJul 17, 2026
Conversation
When using a rootful Docker daemon on Linux, the gateway-builder container runs as root and creates output/ files owned by root:root. The CLI's post-build steps (ensurePythonExecutorInRuntimeContext, ensureBuildLockInControllerContext) then fail with permission denied when trying to write into those root-owned directories. - Move python-executor staging into gateway-builder (main.go) so all file operations happen inside the container where root has full access - Add fsutil.CopyDir to the shared fsutil package (eliminates the duplicate private copyDir in policyengine/generator.go) - Remove ensurePythonExecutorInRuntimeContext and ensureBuildLockInControllerContext from the CLI entirely; the CLI no longer touches the output directory after the builder exits Fixes: wso2#2675
renuka-fernando
requested review from
AnuGayan,
Arshardh,
CrowleyRajapakse,
HeshanSudarshana,
HiranyaKavishani,
Krishanx92,
PasanT9,
RakhithaRR,
Tharsanan1,
VirajSalaka,
ashera96,
chamilaadhi,
dushaniw,
hisanhunais,
malinthaprasan,
pubudu538,
senthuran16,
tgtshanika,
tharikaGitHub and
tharindu1st
as code owners
July 16, 2026 13:16
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
Krishanx92
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Gateway image build fails with
permission deniedon Linux machines using a rootful Docker daemon. The gateway-builder container runs as root and writes output files owned byroot:rootinto the bind-mounted temp workspace. The CLI then tries to copypython-executor/intooutput/gateway-runtime/on the host — a root-owned directory — and fails.Resolves #2675
Backport of #2727 to
ap/0.8.x.Goals
Move all post-build file staging into the gateway-builder container itself, so the CLI never needs to touch root-owned output files after the container exits.
Approach
fsutil.CopyDirto the sharedgateway-builder/pkg/fsutilpackage (also eliminates the duplicate privatecopyDirinpolicyengine/generator.go)gateway-builder/cmd/builder/main.go, stageoutput/python-executor/→output/gateway-runtime/python-executor/inside the container after Dockerfile generation — same pattern already used forbuild-manifest.yamlinto the controller contextensurePythonExecutorInRuntimeContextandensureBuildLockInControllerContextfrom the CLI entirely; the CLI no longer touches the output directory after the builder exitsUser stories
As a developer using a rootful Docker daemon on Linux,
ap gateway image buildshould complete successfully without permission errors.Documentation
N/A
Automation tests
fsutil.CopyDirfollows the same pattern as the existing privatecopyDirSecurity checks
Samples
N/A
Related PRs
Test environment