Skip to content

add multi-distro support for Alpine, CentOS/RHEL besides Debian/Ubuntu - #3093

Closed
AdaAibaby wants to merge 5 commits into
e2b-dev:mainfrom
AdaAibaby:feat/template-support-multi-distro-alpine-centos-rhel
Closed

AdaAibaby wants to merge 5 commits into
e2b-dev:mainfrom
AdaAibaby:feat/template-support-multi-distro-alpine-centos-rhel

Conversation

@AdaAibaby

@AdaAibaby AdaAibaby commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

Previously custom template builds only supported Debian/Ubuntu images relying on apt package manager, and failed on Alpine, CentOS/RHEL due to distro-specific provisioning scripts.
This change extends template provisioning logic to support mainstream Linux distributions:
Debian / Ubuntu (apt)
Alpine (apk)
CentOS / RHEL (dnf/yum)
The provisioning layer auto-detects target OS distribution, switches to corresponding native package manager, and adapts distro-specific package names & system file paths automatically during template build and provisioning phase.

Changes

Add OS distro detection logic to identify base image system
Implement separate provisioning branches for apt / apk / dnf/yum package managers
Normalize package names and file paths compatible with Alpine, CentOS/RHEL
Remove limitation that restricts templates to Debian-family images

/cc @jakubno @dobrac @ValentaTomas Would appreciate your review on this change, thanks!

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The hardcoded mount point preset-fix-mount in builder.go is shared across concurrent template builds, which can cause mount conflicts, race conditions, and data corruption; using a unique directory name per build prevents these issues.

Appending || true to package installation commands in provision.sh for RHEL and Alpine distros silently swallows failures, which can result in broken template images at runtime instead of halting the build.

Directly interpolating userArg into a shell command in user.go introduces a command injection vulnerability, which should be mitigated by validating that the username conforms to a strict alphanumeric pattern before execution.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/orchestrator/pkg/template/build/phases/base/builder.go Outdated
Comment thread packages/orchestrator/pkg/template/build/phases/base/provision.sh
Comment thread packages/orchestrator/pkg/template/build/phases/base/provision.sh Outdated
Comment thread packages/orchestrator/pkg/template/build/commands/user.go Outdated
@AdaAibaby

AdaAibaby commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author
image image image image image

@ValentaTomas
ValentaTomas force-pushed the main branch 2 times, most recently from 5aad415 to d71980e Compare July 25, 2026 22:53
@jakubno

jakubno commented Aug 3, 2026

Copy link
Copy Markdown
Member

Should be solved in #3411

@jakubno jakubno closed this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants