-
Notifications
You must be signed in to change notification settings - Fork 19
AGENT-1193: Add mirror-path and registry-cert support for OVE ISO builder #218
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,8 @@ export RELEASE_IMAGE_VERSION="" | |
| export RELEASE_IMAGE_URL="" | ||
| export ARCH="" | ||
| export DIR_PATH="" | ||
| export MIRROR_PATH="" | ||
| export REGISTRY_CERT="" | ||
|
|
||
| # Check user provided params | ||
| [[ $# -lt 2 ]] && usage | ||
|
|
@@ -52,6 +54,12 @@ EOF | |
| if [[ -n "$SSH_KEY_FILE" ]]; then | ||
| cat << EOF >> ${cfg} | ||
| sshKey: '$(cat "${SSH_KEY_FILE}")' | ||
| EOF | ||
| fi | ||
|
|
||
| if [[ -n "$MIRROR_PATH" ]]; then | ||
| cat << EOF >> ${cfg} | ||
| mirrorPath: /mirror | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @andfasano I've added the mirrorPath as field to the appliance-config. Previously we also discussed how we can minimize the change to agent-installer-utils and one of the things we considered was to have dev-scripts add the mirrorPath to the appliance-config.yaml. That would eliminate the need to support a --mirror-path command line options. Unfortunately, that's currently not possible because build-ove-image.sh "all" step does two things in the same call/step: 1) configure the appliance-config.yaml and 2) call appliance build live-iso. To break this up to allow dev-scripts to manually updated the appliance-config.yaml, we would need to create a new build step which is currently missing. The "all" step is what is currently used. The "configure" and "create-iso" steps are used by the Dockerfile and internally it calls appliance to build the live ISO. |
||
| EOF | ||
| fi | ||
|
|
||
|
|
@@ -62,9 +70,33 @@ EOF | |
|
|
||
| function build_live_iso() { | ||
| if [ ! -f "${appliance_work_dir}"/appliance.iso ]; then | ||
| local appliance_image=registry.ci.openshift.org/ocp/${major_minor_version}:agent-preinstall-image-builder | ||
| local appliance_image=registry.ci.openshift.org/ocp/${major_minor_version}:agent-preinstall-image-builder | ||
| echo "Building appliance ISO (image: ${appliance_image})" | ||
| $SUDO podman run --authfile "${PULL_SECRET_FILE}" --rm -it --privileged --pull always --net=host -v "${appliance_work_dir}"/:/assets:Z "${appliance_image}" build live-iso --log-level debug | ||
|
|
||
| # Build the podman run command with optional mirror path | ||
| local podman_cmd="$SUDO podman run --authfile \"${PULL_SECRET_FILE}\" --rm -it --privileged --pull always --net=host -v \"${appliance_work_dir}\"/:/assets:Z" | ||
| local appliance_cmd="build live-iso --log-level debug" | ||
|
|
||
| # Add mirror path mount if provided | ||
| if [[ -n "${MIRROR_PATH}" ]]; then | ||
| echo "Using pre-mirrored images from: ${MIRROR_PATH}" | ||
| podman_cmd="${podman_cmd} -v \"${MIRROR_PATH}\":/mirror:Z" | ||
| fi | ||
|
|
||
| # Add registry certificate mount if provided (for custom registries with self-signed certs) | ||
| if [[ -n "${REGISTRY_CERT}" ]]; then | ||
| echo "Mounting registry certificate for TLS verification: ${REGISTRY_CERT}" | ||
| podman_cmd="${podman_cmd} -v \"${REGISTRY_CERT}\":/etc/pki/ca-trust/source/anchors/registry.crt:Z,ro" | ||
| # Override entrypoint to run update-ca-trust before openshift-appliance | ||
| # Must include --dir /assets to match the volume mount | ||
| # Workaround: Move appliance.iso to /assets if it was created in wrong location | ||
| podman_cmd="${podman_cmd} --entrypoint sh" | ||
| appliance_cmd="-c 'update-ca-trust && /openshift-appliance --dir /assets ${appliance_cmd} ; if [ -f /appliance.iso ] && [ ! -f /assets/appliance.iso ]; then mv /appliance.iso /assets/appliance.iso; fi'" | ||
| fi | ||
|
|
||
| set -x | ||
| eval "${podman_cmd} \"${appliance_image}\" ${appliance_cmd}" | ||
| set +x | ||
| else | ||
| echo "Skip building appliance ISO. Reusing ${appliance_work_dir}/appliance.iso." | ||
| fi | ||
|
|
||
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.
Just wanted to confirm that this will also work if
build-ove-iso-containeris used?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.
mirror-path will not be supported for build-ove-iso-container. The ability to use a an existing mirror output is intended for developers only. It gets more complicated if we need to support it for the container based builds and currently there isn't a use case for it.