-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Python base image: create airbyte user #36544
base: augustin/11-20-base-images_prompt_for_bump_type_with_optional_pre-releases
Are you sure you want to change the base?
Python base image: create airbyte user #36544
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
field | ||
for field in list(container._ctx.selections) | ||
if isinstance(field, dagger.client._core.Field) and field.type_name == "Container" | ||
] |
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.
This change is due to a change in the latest dagger version
1e27a25
to
95e918c
Compare
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.
I'll let someone else like Angel approve the functionality as I'm not comfortable saying I know all the pieces that need to change to make this change. Reviewing from a "update to base image side" and looks good
@@ -19,6 +19,10 @@ class AirbyteConnectorBaseImage(ABC): | |||
Please do not declare any Dagger with_exec instruction in this class as in the abstract class context we have no guarantee about the underlying system used in the base image. |
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.
Does this concern still apply? I assume that the commands we're using are so basic as to not be concerned, but the messaging is confusing
@@ -67,7 +71,7 @@ def with_file_based_connector_dependencies(container: dagger.Container) -> dagge | |||
- nltk data | |||
""" | |||
container = with_tesseract_and_poppler(container) | |||
container = container.with_exec(["mkdir", self.nltk_data_path], skip_entrypoint=True).with_directory( | |||
container = container.with_exec(["mkdir", "-p", "755", self.nltk_data_path], skip_entrypoint=True).with_directory( |
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.
Optional: as we in the base class are doing the setup of the airbyte user, I think(?) that all new directories in the python base or other future bases have to be made with these permissions. Maybe in the base class we could define a method that we can use in the subsclasses to create based on the permissions required from the base.
@@ -99,3 +99,74 @@ async def check_socat_version(container: dagger.Container, expected_socat_versio | |||
raise errors.SanityCheckError(f"unexpected socat version: {version_number}") | |||
else: | |||
raise errors.SanityCheckError(f"Could not find the socat version in the version output: {socat_version_line}") | |||
|
|||
|
|||
async def check_user_exists(container: dagger.Container, user: str): |
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.
Lots of sanity checks 🙏🏻
await base_sanity_checks.check_user_can_read_dir(container, self.USER, self.AIRBYTE_DIR_PATH) | ||
await base_sanity_checks.check_user_can_read_dir(container, self.USER, self.nltk_data_path) | ||
await base_sanity_checks.check_user_can_read_dir(container, self.USER, self.CACHE_DIR_PATH) | ||
await base_sanity_checks.check_user_can_write_dir(container, self.USER, self.AIRBYTE_DIR_PATH) | ||
await base_sanity_checks.check_user_cant_write_dir(container, self.USER, self.CACHE_DIR_PATH) |
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.
Nit: For a second I thought 124 and 126 were contradicting. I think this is easier to parse when organized by file:
await base_sanity_checks.check_user_can_read_dir(container, self.USER, self.AIRBYTE_DIR_PATH) | |
await base_sanity_checks.check_user_can_read_dir(container, self.USER, self.nltk_data_path) | |
await base_sanity_checks.check_user_can_read_dir(container, self.USER, self.CACHE_DIR_PATH) | |
await base_sanity_checks.check_user_can_write_dir(container, self.USER, self.AIRBYTE_DIR_PATH) | |
await base_sanity_checks.check_user_cant_write_dir(container, self.USER, self.CACHE_DIR_PATH) | |
await base_sanity_checks.check_user_can_read_dir(container, self.USER, self.AIRBYTE_DIR_PATH) | |
await base_sanity_checks.check_user_can_write_dir(container, self.USER, self.AIRBYTE_DIR_PATH) | |
await base_sanity_checks.check_user_can_read_dir(container, self.USER, self.nltk_data_path) | |
await base_sanity_checks.check_user_can_read_dir(container, self.USER, self.CACHE_DIR_PATH) | |
await base_sanity_checks.check_user_cant_write_dir(container, self.USER, self.CACHE_DIR_PATH) |
.with_exec(["ln", "-snf", "/usr/share/zoneinfo/Etc/UTC", "/etc/localtime"], skip_entrypoint=True) | ||
# Install socat 1.7.4.4 | ||
.with_exec(["sh", "-c", "apt update && apt-get install -y socat=1.7.4.4-2"], skip_entrypoint=True) | ||
.with_exec(["adduser", "--system", "--group", "--no-create-home", self.USER], skip_entrypoint=True) |
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.
.with_exec(["adduser", "--system", "--group", "--no-create-home", self.USER], skip_entrypoint=True) | |
.with_exec(["adduser", "-u", "1000", "--system", "--group", "--no-create-home", self.USER], skip_entrypoint=True) |
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.
We'd like to make the uid/gid consistent with the platform images (where uid=1000(airbyte)
gid=1000(airbyte)
)
95e918c
to
13f5b18
Compare
13f5b18
to
1eef8aa
Compare
1eef8aa
to
c16bb07
Compare
c402324
to
c12d318
Compare
c12d318
to
c1d53e3
Compare
c1d53e3
to
f7a67a8
Compare
We want to make our python connector image use a non root user.
This PR cuts a new base image version which:
airbyte
user/airbyte