Repository navigation
Conversation
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
14 similar comments
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
…thon script - Remove container/Containerfile (replaced by container/Containerfile.j2) - Remove container/build.sh (replaced by container/build.py) - Add container/Containerfile.j2: Jinja2 template rendering a clean Dockerfile with no runtime distro-detection bash; all distro values resolved at render time - Add container/build.py: PEP-8 Python script replacing build.sh Key improvements over PR #67960 approach: - No /etc/ceph-distro.env at container build time - All distro-specific logic (el_ver, dist_path, ganesha repo style, copr repos, python3-saml) resolved via Jinja2 conditionals at template render time - Supports centos/rocky/almalinux with EL9/EL10 detection from FROM_IMAGE - Branch substring matching per review feedback (reef/squid in branch name) - python3-saml comment explains SAML2->OAuth2 deprecation - CUSTOM_CEPH_REPO_URL feature preserved - Atomic secret file creation with o600 permissions (security fix) - argparse CLI, logging, proper error handling in build.py Agent-Logs-Url: https://github.com/ceph/ceph/sessions/7bf14465-0215-4f66-acda-948f28aa5710 Co-authored-by: epuertat <[email protected]>
| if not ci_container and not version: | ||
| errors.append("VERSION") | ||
| if errors: | ||
| log.error("Missing required environment variables: %s", ", ".join(errors)) |
| env = jinja2.Environment( | ||
| loader=jinja2.FileSystemLoader(tpl_dir), | ||
| keep_trailing_newline=True, | ||
| undefined=jinja2.StrictUndefined, | ||
| ) |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
|
This pull request has been automatically closed because there has been no activity for 90 days. Please feel free to reopen this pull request (or open a new one) if the proposed change is still appropriate. Thank you for your contribution! |
Replaces the procedural Bash approach (runtime
/etc/os-releaseparsing,source /etc/ceph-distro.envin everyRUNstep) with a clean render-then-build model: all distro decisions are resolved at template render time from CI env vars, producing a flat, readableContainerfilewith no runtime conditionals.What changed
Deleted:
container/Containerfile→ replaced bycontainer/Containerfile.j2container/build.sh→ replaced bycontainer/build.pycontainer/Containerfile.j2— Jinja2 template rendered beforepodman build:{{ el_ver }},{{ dist_path }},{{ distro_id }},{{ distro_major }}replace allsource /etc/ceph-distro.env+ bash conditionalsbaseurlpython3-samlconditionally omitted on EL 10+ (python3-saml: SAML2 SSO deprecated in favour of OAuth2)CUSTOM_CEPH_REPO_URLsupport preservedcontainer/build.py— PEP-8 Python, argparse, logging:distro_id / distro_major / el_ver / dist_pathfromFROM_IMAGE(e.g.quay.io/rockylinux/rockylinux:10→rocky / 10 / el10 / rocky/10)FROM_IMAGEby branch:"reef" in branchor"squid" in branch→centos:stream9; all others →rockylinux:10(substring match per review feedback on tentacle: container/build.sh: FROM_IMAGE=rockylinux-10 default for >=tentacle backports #67960)ceph:tentaclealways resolves to the preferred basebuild.shos.open(..., 0o600)before writing credentialsChecklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionOriginal prompt
Context
PR #67960 added multi-distro support (CentOS 9 / Rocky 10 / AlmaLinux) to
container/Containerfileandcontainer/build.sh. The current implementation uses procedural Bash inside the Containerfile — deriving distro-specific variables at container build time by sourcing/etc/os-release, writing an env file (/etc/ceph-distro.env), and then conditionally branching in every subsequentRUNstep. Thebuild.shscript also has complex Bash logic for tagging and pushing.The goal of this PR is to rewrite the approach so that:
container/Containerfile.j2Jinja2 template is the only declarative artifact describing the container image.container/build.pyreads CI environment variables (the same onesbuild.shconsumes today), rendersContainerfile.j2into a finalContainerfileusing Jinja2, builds the image, tags it, and optionally pushes it.Containerfileis clean and simple — nosource /etc/ceph-distro.env, no runtime bash conditionals for distro detection. All distro-specific decisions are resolved at template render time from CI env vars.build.shis replaced bybuild.py. The oldbuild.shshould be removed.container/Containerfileshould be removed and replaced bycontainer/Containerfile.j2.Key Design Decisions
Environment Variables (inputs to
build.py)The Python script should consume the same CI environment variables that
build.shuses today:FROM_IMAGEquay.io/centos/centos:stream9CI_CONTAINERfalsetruefor CI buildsFLAVORdefaultdefault,crimson-debug,crimson-release,debugBRANCHCEPH_SHA1ARCHx86_64orarm64CEPH_GIT_REPOCONTAINER_REPO_HOSTNAMEquay.ceph.ioCONTAINER_REPO_ORGANIZATIONceph-ci(CI) /ceph(release)CONTAINER_REPOceph(CI) /prerelease-<arch>(release)CONTAINER_REPO_USERNAMECONTAINER_REPO_PASSWORDPRERELEASE_USERNAMEPRERELEASE_PASSWORDREMOVE_LOCAL_IMAGEStrueNO_PUSHtrueVERSIONCONTAINER_ENGINEpodmanpodmanordockerCUSTOM_CEPH_REPO_URLGANESHA_REPO_BASEURLhttps://buildlogs.centos.org/...Distro Detection Logic
The Python script must derive from
FROM_IMAGE:distro_id:centos,rocky, oralmalinux— parsed from the image name (e.g.quay.io/centos/centos:stream9→centos,quay.io/rockylinux/rockylinux:10→rocky)distro_major:9,10, etc. — parsed from the image tagel_ver:el9,el10, etc.dist_path:centos/9,rocky/10, etc. — used in shaman API URLsThese are passed as Jinja2 template variables so all distro-specific decisions are resolved at render time, not at container build time.
Containerfile.j2 Template Design
The template should produce a clean, linear Dockerfile with no bash conditionals for distro detection. Key sections:
ARG FROM_IMAGE="{{ from_image }}" FROM $FROM_IMAGE # ... ARG declarations ... SHELL ["/bin/bash", "-c"] # Disable documentation RUN ... # Pre-reqs RUN dnf install -y --setopt=install_weak_deps=False epel-release jq # NFS-Ganesha repo {% if distro_id == 'rocky' %} RUN curl -fs -L "https://shaman.ceph.com/api/repos/nfs-ganesha/main/latest/{{ dist_path }}/repo?arch=$(arch)" \ -o /etc/yum.repos.d/ganesha.repo {% else %} RUN printf '%s\n' '[ganesha]' 'name=ganesha' ... > /etc/yum.repos.d/ganesha.repo {% endif %} # iSCSI repo RUN set -eux && \ curl -s -L https://shaman.ceph.com/api/repos/tcmu-runner/main/latest/{{ dist_path }}/repo?arch=$(arch) \ -o /etc/yum.repos.d/tcmu-runner.repo && \ ... # Use {{ el_ver }} and {{ dist_path }} instead of runtime detection # Ceph repo — use {{ el_ver }}, {{ dist_path }} # ... # Copr repos (only for EL <= 9) {% if distro_major | int <= 9 %} RUN dnf install -y ... dnf-plugins-core && dnf copr enable -y tchaikov/python-scikit-learn {% endif %} # Packages RUN echo "..." > packages.txt # ... # Crimson packages {% if osd_flavor in ('crimson-debug', 'crimson-release') %} RUN echo "ceph-osd-crimson" >> packages.txt {% endif %} # python3-saml only on EL <= 9 {% if distro_major | int <= 9 %} RUN echo "python3-saml" >> packages.txt {% endif %} # ... rest of install, cleanup, ENV ...bui...
This pull request was created from Copilot chat.