From f2eeb80ae330d462806194f1874e818f51ab0b11 Mon Sep 17 00:00:00 2001 From: Guillaume Rose Date: Tue, 30 Mar 2021 11:21:13 +0200 Subject: [PATCH] Add podman-remote binary to bundle The podman client exactly matches the podman version of the server. It replicates what we do with oc. --- .gitignore | 1 + createdisk-library.sh | 26 ++++++++++++++++++++++++++ createdisk.sh | 5 +++++ 3 files changed, 32 insertions(+) diff --git a/.gitignore b/.gitignore index cf987452d..f94ff769d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ pull-secret oc yq openshift-clients/ +podman-remote/ diff --git a/createdisk-library.sh b/createdisk-library.sh index 15a360244..23bff947c 100755 --- a/createdisk-library.sh +++ b/createdisk-library.sh @@ -165,6 +165,8 @@ function copy_additional_files { # Copy oc client cp openshift-clients/linux/oc $destDir/ + cp podman-remote/linux/podman $destDir/ + update_json_description $srcDir $destDir eventually_add_pull_secret $destDir @@ -220,6 +222,8 @@ function generate_hyperkit_bundle { # Copy oc client cp openshift-clients/mac/oc $destDir/ + cp podman-remote/mac/podman $destDir/ + # Update the bundle metadata info cat $srcDir/crc-bundle-info.json \ | ${JQ} ".name = \"${destDir}\"" \ @@ -245,6 +249,8 @@ function generate_hyperv_bundle { # Copy oc client cp openshift-clients/windows/oc.exe $destDir/ + cp podman-remote/windows/podman.exe $destDir/ + ${QEMU_IMG} convert -f qcow2 -O vhdx -o subformat=dynamic $srcDir/${CRC_VM_NAME}.qcow2 $destDir/${CRC_VM_NAME}.vhdx diskSize=$(du -b $destDir/${CRC_VM_NAME}.vhdx | awk '{print $1}') @@ -268,3 +274,23 @@ function create_tarball { tar cSf - --sort=name "$dirName" | ${ZSTD} --no-progress ${CRC_ZSTD_EXTRA_FLAGS} --threads=0 -o "$dirName".crcbundle } + +function download_podman() { + local version=$1 + + mkdir -p podman-remote/linux + curl -L https://github.com/containers/podman/releases/download/v${version}/podman-remote-static.tar.gz | tar -zx -C podman-remote/linux podman-remote-static + mv podman-remote/linux/podman-remote-static podman-remote/linux/podman + + if [ -n "${SNC_GENERATE_MACOS_BUNDLE}" ]; then + mkdir -p podman-remote/mac + curl -L https://github.com/containers/podman/releases/download/v${version}/podman-remote-release-darwin.zip > podman-remote/mac/podman.zip + ${UNZIP} -o -d podman-remote/mac/ podman-remote/mac/podman.zip + fi + + if [ -n "${SNC_GENERATE_WINDOWS_BUNDLE}" ]; then + mkdir -p podman-remote/windows + curl -L https://github.com/containers/podman/releases/download/v${version}/podman-remote-release-windows.zip > podman-remote/windows/podman.zip + ${UNZIP} -o -d podman-remote/windows/ podman-remote/windows/podman.zip + fi +} diff --git a/createdisk.sh b/createdisk.sh index 0459f3ffb..3b73d7131 100755 --- a/createdisk.sh +++ b/createdisk.sh @@ -114,6 +114,8 @@ EOF ${SSH} core@api.${CRC_VM_NAME}.${BASE_DOMAIN} -- 'sudo rm -fr /etc/cni/net.d/100-crio-bridge.conf' ${SSH} core@api.${CRC_VM_NAME}.${BASE_DOMAIN} -- 'sudo rm -fr /etc/cni/net.d/200-loopback.conf' +podman_version=$(${SSH} core@api.${CRC_VM_NAME}.${BASE_DOMAIN} -- 'podman version -f json | jq -r .Client.Version') + # Remove the journal logs. # Note: With `sudo journalctl --rotate --vacuum-time=1s`, it doesn't # remove all the journal logs so separate commands are used here. @@ -123,6 +125,9 @@ ${SSH} core@api.${CRC_VM_NAME}.${BASE_DOMAIN} -- 'sudo journalctl --vacuum-time= # Shutdown the VM shutdown_vm ${VM_PREFIX} +# Download podman clients +download_podman $podman_version + # libvirt image generation get_dest_dir destDirSuffix="${DEST_DIR}"