-
Notifications
You must be signed in to change notification settings - Fork 23
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 |
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.
hack/ipa_debug_tools.sh
Outdated
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.
hack/ipa_debug_tools.sh
Outdated
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.
hack/ipa_debug_tools.sh
Outdated
# 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 |
hack/ipa_debug_tools.sh
Outdated
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.
hack/ipa_debug_tools.sh
Outdated
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 |
hack/ipa_debug_tools.sh
Outdated
#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.
hack/ipa_debug_tools.sh
Outdated
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.
hack/ipa_debug_tools.sh
Outdated
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 |
hack/ipa_debug_tools.sh
Outdated
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.
00054eb
to
7a7af56
Compare
# ----------------------------------------------------------------------------- | ||
clean_up_debug_dirs() { | ||
# Clean up debug directories | ||
sudo rm -rf "${BASE_DEBUG_DIR}" /tmp/dib ipa-file-injector.service 2> /dev/null |
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 get "${BASE_DEBUG_DIR}"
and /tmp/dib
but how does ipa-file-injector.service
end up here?
I don't see any other reference to that file, and AFAIK that is the systemd unit file of the similarly named DIB module. It could be that I am missing something here but looks like this is some leftover reference maybe.
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.
ipa-file-injector.service appears in the /tmp directory after running the build-ip.sh
. That is why I've added that to the clean up as well.
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.
okay, that might be then some sort of residue from the template rendering process. I might remove it later, but then it is fine to remove it here.
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.
IMO colors are fine, but emojis not.
Signed-off-by: peppi-lotta <[email protected]>
7a7af56
to
27494cb
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.
/lgtm
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