From 2e3bdafe616fe7551eba612b4b2d3db9a5add6cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= <91831478+lemeurherve@users.noreply.github.com> Date: Wed, 15 Mar 2023 16:09:51 +0100 Subject: [PATCH 1/2] fix(gha): keep comments in plugins.txt --- bin/update-plugins.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/update-plugins.sh b/bin/update-plugins.sh index c929fc1a..629e1f30 100755 --- a/bin/update-plugins.sh +++ b/bin/update-plugins.sh @@ -23,6 +23,16 @@ java -jar "${TMP_DIR}/jenkins-plugin-manager.jar" -f plugins.txt --available-upd mv plugins2.txt plugins.txt +# Generate a patch without comments removal(s) +# the first sed removes the comments removal(s) from the patch +# the second sed fixes the patch by keeping the same amount of context before and after, since plugins are only updated and not removed with this script +git diff -p --stat plugins.txt | sed -r 's/-#/ #/' | sed -r 's/@@ -([0-9]+),([0-9]+) \+([0-9]+),[0-9]+/@@ -\1,\2 +\3,\2/' > patch-plugin-only.txt +# Restore plugins.txt and apply the modified patch +git restore plugins.txt +git apply patch-plugin-only.txt +# Remove the patch +rm patch-plugin-only.txt + git diff plugins.txt echo "Updating plugins complete" From dff4169ecbc14f9ba8ddf2012feb0c5fc5540259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= <91831478+lemeurherve@users.noreply.github.com> Date: Wed, 15 Mar 2023 16:17:44 +0100 Subject: [PATCH 2/2] nits --- bin/update-plugins.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/update-plugins.sh b/bin/update-plugins.sh index 629e1f30..3cf17eb7 100755 --- a/bin/update-plugins.sh +++ b/bin/update-plugins.sh @@ -23,15 +23,15 @@ java -jar "${TMP_DIR}/jenkins-plugin-manager.jar" -f plugins.txt --available-upd mv plugins2.txt plugins.txt -# Generate a patch without comments removal(s) +## Generate a patch without comments removal(s) # the first sed removes the comments removal(s) from the patch # the second sed fixes the patch by keeping the same amount of context before and after, since plugins are only updated and not removed with this script -git diff -p --stat plugins.txt | sed -r 's/-#/ #/' | sed -r 's/@@ -([0-9]+),([0-9]+) \+([0-9]+),[0-9]+/@@ -\1,\2 +\3,\2/' > patch-plugin-only.txt +git diff -p --stat plugins.txt | sed -r 's/-#/ #/' | sed -r 's/@@ -([0-9]+),([0-9]+) \+([0-9]+),[0-9]+/@@ -\1,\2 +\3,\2/' > patch-plugins-only.txt # Restore plugins.txt and apply the modified patch git restore plugins.txt -git apply patch-plugin-only.txt +git apply patch-plugins-only.txt # Remove the patch -rm patch-plugin-only.txt +rm patch-plugins-only.txt git diff plugins.txt