Skip to content
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

Add podman-remote binary to bundle #378

Merged
merged 1 commit into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ pull-secret
oc
yq
openshift-clients/
podman-remote/
2 changes: 1 addition & 1 deletion crc-bundle-info.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
{
# Name of the file
"name": "oc"
# What kind of file this is, valid types are 'oc-executable'
# What kind of file this is, valid types are 'oc-executable', 'podman-executable'
"type": "oc-executable"
"size": "72728632"
"sha256sum": "983f0883a6dffd601afa663d10161bfd8033fd6d45cf587a9cb22e9a681d6047"
Expand Down
47 changes: 47 additions & 0 deletions createdisk-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ function update_json_description {
ocSize=$(du -b $destDir/oc | awk '{print $1}')
ocSha256Sum=$(sha256sum $destDir/oc | awk '{print $1}')

podmanSize=$(du -b $destDir/podman-remote | awk '{print $1}')
podmanSha256Sum=$(sha256sum $destDir/podman-remote | awk '{print $1}')

cat $srcDir/crc-bundle-info.json \
| ${JQ} ".name = \"${destDir}\"" \
| ${JQ} '.clusterInfo.sshPrivateKeyFile = "id_ecdsa_crc"' \
Expand All @@ -110,6 +113,10 @@ function update_json_description {
| ${JQ} '.storage.fileList[0].type = "oc-executable"' \
| ${JQ} ".storage.fileList[0].size = \"${ocSize}\"" \
| ${JQ} ".storage.fileList[0].sha256sum = \"${ocSha256Sum}\"" \
| ${JQ} ".storage.fileList[1].name = \"podman-remote\"" \
| ${JQ} '.storage.fileList[1].type = "podman-executable"' \
| ${JQ} ".storage.fileList[1].size = \"${podmanSize}\"" \
| ${JQ} ".storage.fileList[1].sha256sum = \"${podmanSha256Sum}\"" \
| ${JQ} '.driverInfo.name = "libvirt"' \
>$destDir/crc-bundle-info.json
}
Expand Down Expand Up @@ -141,6 +148,8 @@ function copy_additional_files {
# Copy oc client
cp openshift-clients/linux/oc $destDir/

cp podman-remote/linux/podman-remote $destDir/

update_json_description $srcDir $destDir

eventually_add_pull_secret $destDir
Expand Down Expand Up @@ -196,9 +205,14 @@ function generate_hyperkit_bundle {
# Copy oc client
cp openshift-clients/mac/oc $destDir/

cp podman-remote/mac/podman $destDir/

ocSize=$(du -b $destDir/oc | awk '{print $1}')
ocSha256Sum=$(sha256sum $destDir/oc | awk '{print $1}')

podmanSize=$(du -b $destDir/podman | awk '{print $1}')
podmanSha256Sum=$(sha256sum $destDir/podman | awk '{print $1}')

# Update the bundle metadata info
cat $srcDir/crc-bundle-info.json \
| ${JQ} ".name = \"${destDir}\"" \
Expand All @@ -209,6 +223,10 @@ function generate_hyperkit_bundle {
| ${JQ} '.storage.fileList[0].type = "oc-executable"' \
| ${JQ} ".storage.fileList[0].size = \"${ocSize}\"" \
| ${JQ} ".storage.fileList[0].sha256sum = \"${ocSha256Sum}\"" \
| ${JQ} ".storage.fileList[1].name = \"podman\"" \
| ${JQ} '.storage.fileList[1].type = "podman-executable"' \
| ${JQ} ".storage.fileList[1].size = \"${podmanSize}\"" \
| ${JQ} ".storage.fileList[1].sha256sum = \"${podmanSha256Sum}\"" \
| ${JQ} '.driverInfo.name = "hyperkit"' \
>$destDir/crc-bundle-info.json

Expand All @@ -228,6 +246,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}')
Expand All @@ -236,6 +256,9 @@ function generate_hyperv_bundle {
ocSize=$(du -b $destDir/oc.exe | awk '{print $1}')
ocSha256Sum=$(sha256sum $destDir/oc.exe | awk '{print $1}')

podmanSize=$(du -b $destDir/podman.exe | awk '{print $1}')
podmanSha256Sum=$(sha256sum $destDir/podman.exe | awk '{print $1}')

cat $srcDir/crc-bundle-info.json \
| ${JQ} ".name = \"${destDir}\"" \
| ${JQ} ".nodes[0].diskImage = \"${CRC_VM_NAME}.vhdx\"" \
Expand All @@ -247,6 +270,10 @@ function generate_hyperv_bundle {
| ${JQ} '.storage.fileList[0].type = "oc-executable"' \
| ${JQ} ".storage.fileList[0].size = \"${ocSize}\"" \
| ${JQ} ".storage.fileList[0].sha256sum = \"${ocSha256Sum}\"" \
| ${JQ} ".storage.fileList[1].name = \"podman.exe\"" \
| ${JQ} '.storage.fileList[1].type = "podman-executable"' \
| ${JQ} ".storage.fileList[1].size = \"${podmanSize}\"" \
| ${JQ} ".storage.fileList[1].sha256sum = \"${podmanSha256Sum}\"" \
| ${JQ} '.driverInfo.name = "hyperv"' \
>$destDir/crc-bundle-info.json

Expand All @@ -258,3 +285,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-remote

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 -o 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 -o podman-remote/windows/podman.zip
${UNZIP} -o -d podman-remote/windows/ podman-remote/windows/podman.zip
fi
}
5 changes: 5 additions & 0 deletions createdisk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,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.
Expand All @@ -122,6 +124,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}"
Expand Down