-
Notifications
You must be signed in to change notification settings - Fork 24
fix: add --user flag to Docker container tests to allow config migration writes #639
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?
fix: add --user flag to Docker container tests to allow config migration writes #639
Conversation
…ion writes - Fixes PermissionError when config migration tries to write to /secrets/config.json - Adds --user flag with host UID/GID to all Docker run commands in container tests - Allows ManifestDeclarativeSource._migrate_and_transform_config() to write back migrated configs Co-Authored-By: AJ Steers <[email protected]>
Original prompt from AJ Steers:
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
PyTest Results (Full)3 688 tests 3 677 ✅ 18m 2s ⏱️ Results for commit b6c33bf. ♻️ This comment has been updated with latest results. |
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.
Pull Request Overview
Fixes permission errors in Docker container tests by running containers with the same UID/GID as the host, allowing config migration to write back to mounted files.
- Imported
os
to retrieve host user IDs. - Added
--user f"{os.getuid()}:{os.getgid()}"
to three Docker run commands in tests.
Comments suppressed due to low confidence (1)
airbyte_cdk/test/standard_tests/docker_base.py:212
- Consider handling platforms where os.getuid()/os.getgid() may not be available (e.g., Windows) by falling back to default user or skipping the flag when these functions are not defined.
"--user",
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. Testing This CDK VersionYou can test this version of the CDK using the following: # Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1751498158-fix-docker-config-write-permissions#egg=airbyte-python-cdk[dev]' --help
# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1751498158-fix-docker-config-write-permissions Helpful ResourcesPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
Fix Docker container test permission errors for config migration
Summary
Resolves
PermissionError: [Errno 13] Permission denied: '/secrets/config.json'
that occurs when connectors attempt to migrate and write back config during Docker container tests. The issue happens because config files are mounted as read-only volumes, butManifestDeclarativeSource._migrate_and_transform_config()
needs write access to persist migrated configurations.Root cause: Temporary config files are created with read-only permissions (0o444) and mounted as Docker volumes. When the container process (running as a different user) tries to write migrated config back to
/secrets/config.json
, it fails due to permission mismatch.Solution: Added
--user
flag with host UID/GID (f"{os.getuid()}:{os.getgid()}"
) to all Docker run commands in container tests, ensuring the container process has the same file permissions as the host user who created the temp files.Review & Testing Checklist for Human
os.getuid()/getgid()
calls might behave differently)Recommended test plan:
Diagram
Notes
test_docker_image_build_and_check
, and two commands intest_docker_image_build_and_read
(discover and read)Link to Devin run: https://app.devin.ai/sessions/145920cef86e4143bca1763d0cd2285a
Requested by: @aaronsteers