From: Don Zickus <dzickus@xxxxxxxxxx> Fix fedora-only config updates After every scheduled upstream merge, a script is run to find new configs, generate pending-* files for them and for ark, create branches to push MRs. However, there is a case where new Fedora configs are found but not new ARK configs. This case had issues. When the merge is done, make dist-configs-commit is called for Fedora and RHEL. This results in a possible new commit if configs are found. The command is run twice and creates the following matrix: 1. Both Fedora and RHEL have new configs. 2. Neither Fedora nor RHEL have new configs. 3. Fedora does not have new configs, but RHEL does. 4. Fedora has new configs, bug RHEL does not. 1 and 2 are common and 1-3 are handled correctly. Scenario 4 is not. When the configs are committed, the next script gen_config_patches.sh looks for a special commit 'AUTOMATIC'. It doesn't care if that commit comes from Fedora or RHEL. The gen_config_patches.sh can not handle pending-fedora changes, so those changes are filtered in the script. In scenario 4 that leaves an empty file to process, which the script aborts on. Further no print out was displayed which slowed down debugging. The are multiple ways to address this. This patch does multiple things. * Adds a print statement on the failure for future debugging. * Exits on success if there are no changes to process after filtering. * Reduces the risk of calling gen_config_patches.sh by only calling the script when RHEL adds new configs. Tested scenario 4 with last week's os-build HEAD. Signed-off-by: Don Zickus <dzickus@xxxxxxxxxx> diff --git a/redhat/gen_config_patches.sh b/redhat/gen_config_patches.sh index blahblah..blahblah 100755 --- a/redhat/gen_config_patches.sh +++ b/redhat/gen_config_patches.sh @@ -26,6 +26,11 @@ trap cleanup EXIT # Not interested in Fedora configs git diff --name-only HEAD HEAD^ | grep -v "pending-fedora" > "$tmpdir"/new_config_files +if [ ! -s "$tmpdir"/new_config_files ]; then + echo "No config changes after filtering" + exit 0 +fi + while read -r line; do # Read all the files and split up by file path of each config item. # ethernet and net get handled separately others can be added as needed @@ -89,7 +94,10 @@ done < "$tmpdir"/new_config_files # $config_bundles_dir now contains files containing a list of configs per file path for f in "$config_bundles_dir"/*; do - [[ -e "$f" ]] || exit 1 # No files in config_bundles_dir, abort + if [ ! -e "$f" ]; then + echo "Missing generated config file: $f" + exit 1 # No files in config_bundles_dir, abort + fi # we had to change to : for the file name so switch it back _f=$(basename "$f" | sed -e 's/:/\//g') # Commit subject diff --git a/redhat/scripts/ci/ark-update-configs.sh b/redhat/scripts/ci/ark-update-configs.sh index blahblah..blahblah 100755 --- a/redhat/scripts/ci/ark-update-configs.sh +++ b/redhat/scripts/ci/ark-update-configs.sh @@ -49,13 +49,18 @@ if ! git merge -m "Merge '$UPSTREAM_REF' into '$BRANCH'" "$UPSTREAM_REF"; then fi # Generates and commits all the pending configs + make FLAVOR=fedora dist-configs-commit +# Skip executing gen_config_patches.sh for new Fedora configs + +old_head="$(git rev-parse HEAD)" make FLAVOR=rhel dist-configs-commit +new_head="$(git rev-parse HEAD)" # Converts each new pending config from above into its finalized git # configs/<date>/<config> branch. These commits are used for Merge # Requests. -if git show -s --oneline HEAD | grep -q "AUTOMATIC: New configs"; then +if [ "$old_head" != "$new_head" ]; then ./redhat/gen_config_patches.sh else printf "No new configuration values exposed from merging %s into $BRANCH\n" "$UPSTREAM_REF" -- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1263 _______________________________________________ kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure