-
Notifications
You must be signed in to change notification settings - Fork 22
Add tool to compare built ipa and master ipa initramfs #1058
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?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
1a30ce3
to
4c2b687
Compare
Signed-off-by: peppi-lotta <peppi-lotta.saari@est.tech>
4c2b687
to
9e9d4b4
Compare
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.
In general LGTM,
It is a very useful tool as I have mentioned offline.
I have one improvement proposal but it can be a later addition if you don't feel like implementing it now.
sudo mkdir -p /tmp/debug-initramfs/master-ipa-initramfs | ||
cd /tmp/debug-initramfs || exit | ||
sudo wget https://tarballs.opendev.org/openstack/ironic-python-agent/dib/ipa-centos9-master.tar.gz | ||
sudo tar -xzf ipa-centos9-master.tar.gz |
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.
It would be nice if the upstream IPA URI and tar file name could be customized same as in IPA downloader, you could actually use IPA downloader here instead of your own download logic to keep it simple .
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.
For debug tool, it might be good enough to be able to supply the URL. get-resource.sh
vs one-liner... I'd go for the latter.
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.
I am fine either way, but the url and the name of the tar file has to be customizable because otherwise only a specific master on a specific base image can be tested. I suggested to use the downloader because that has all the customization options implemented but I am fine with doing it with the one liners too.
/override metal3-ubuntu-e2e-integration-test-main |
@Rozzii: Overrode contexts on behalf of Rozzii: metal3-ubuntu-e2e-integration-test-main In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
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.
This is great addition to debug tools, thanks @peppi-lotta.
Some cleanup to do, some minor syntax things to fix and some suggestions to make it more readable and maintainable.
@@ -0,0 +1,227 @@ | |||
#!/usr/bin/env bash | |||
|
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.
We should be running with set -eu
by default.
export TEST_IN_CI="false" | ||
|
||
# Build ipa with build_ipa.sh | ||
cd "$CURRENT_SCRIPT_DIR/../jenkins/scripts/dynamic_worker_workflow" || exit |
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.
cd "$CURRENT_SCRIPT_DIR/../jenkins/scripts/dynamic_worker_workflow" || exit | |
cd "${CURRENT_SCRIPT_DIR}/../jenkins/scripts/dynamic_worker_workflow" |
|| exit 1
not needed if we're running set -e
mentioned earlier, cleans up the code.
# Unzip ironic-python-agent.initramfs | ||
sudo mkdir -p /tmp/debug-initramfs/build-ipa-initramfs | ||
sudo cp /tmp/dib/ironic-python-agent.initramfs /tmp/debug-initramfs/ | ||
cd /tmp/debug-initramfs/build-ipa-initramfs || exit |
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.
cd /tmp/debug-initramfs/build-ipa-initramfs || exit | |
cd /tmp/debug-initramfs/build-ipa-initramfs |
sudo mkdir -p /tmp/debug-initramfs/master-ipa-initramfs | ||
cd /tmp/debug-initramfs || exit | ||
sudo wget https://tarballs.opendev.org/openstack/ironic-python-agent/dib/ipa-centos9-master.tar.gz | ||
sudo tar -xzf ipa-centos9-master.tar.gz |
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.
For debug tool, it might be good enough to be able to supply the URL. get-resource.sh
vs one-liner... I'd go for the latter.
cd /tmp/debug-initramfs || exit | ||
sudo wget https://tarballs.opendev.org/openstack/ironic-python-agent/dib/ipa-centos9-master.tar.gz | ||
sudo tar -xzf ipa-centos9-master.tar.gz | ||
cd master-ipa-initramfs || exit |
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.
cd master-ipa-initramfs || exit | |
cd master-ipa-initramfs |
#the built ipa and master. | ||
# Check if packages are a part of CentOS Stream in https://pkgs.org | ||
compare_rpm_packages() { | ||
basedir1="${1:-/tmp/debug-initramfs/build-ipa-initramfs}" |
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.
Same as above for descriptive dir and files names.
common_count=$(comm -12 "${compfile1}" "${compfile2}" | wc -l) | ||
echo -e "\nNumber of common packages: ${common_count}\n" | ||
# Extract base package names and join for fuzzy matching | ||
awk -F'-[0-9]' '{print $1}' "${compfile1}" | sort > /tmp/build-ipa-base.txt |
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.
Same suggestion for tmpfile names.
lfull=$(grep -m1 "^${left}-" "${compfile1}" || echo "") | ||
rfull=$(grep -m1 "^${right}-" "${compfile2}" || echo "") | ||
# Skip printing if both lines are non-empty and exactly the same | ||
if [[ -n "${lfull}" && "${lfull}" == "${rfull}" ]]; then |
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.
if [[ -n "${lfull}" && "${lfull}" == "${rfull}" ]]; then | |
if [[ -n "${lfull}" ]] && [[ "${lfull}" == "${rfull}" ]]; then |
function_name="$1" | ||
shift | ||
|
||
# Check if function exists and call it |
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.
Why not use standard argument parsing here, much more readable and reliable?
# Usage: | ||
# ./ipa_debug_tools.sh clean_up_debug_dirs | ||
# ----------------------------------------------------------------------------- | ||
clean_up_debug_dirs() { |
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.
Cleaning up all the temp files should be done here, and the cleanup should be trapped function so it gets called even if we exit mid run.
This PR introduces a script
ipa_debug_tools.sh
that provides a set of utilities to assist with debugging and comparing IPA (ironic-python-agent) initramfs builds. The script is particularly useful for identifying differences between locally built IPA images and the official master images.This tool is meant especially for situations where built IPA size get over a certain limit limit and two file systems need to be compared.
🛠️ What's Included
set_up_debug_dirs
/tmp/debug-initramfs
jenkins/scripts/dynamic_worker_workflow/build_ipa.sh
compare_dir_sizes [path]
compare_rpm_packages
clean_up_debug_dirs