From 610582513ff4d7703e3fee1529aac4f27c886f3a Mon Sep 17 00:00:00 2001 From: Spyridon Argyropoulos Date: Fri, 20 Dec 2019 10:04:26 +0100 Subject: [PATCH 1/3] Compare to origin/master \#54 [skip modfiles] --- scripts/check_added_files.sh | 2 +- scripts/check_grid_file_atlcvmfs.sh | 2 +- scripts/check_grid_file_size.sh | 2 +- scripts/check_jo_consistency_main.py | 2 +- scripts/check_logParser.sh | 2 +- scripts/check_unique_physicsShort.sh | 2 +- scripts/commit_new_dsid.sh | 6 ++---- scripts/run_athena.sh | 2 +- 8 files changed, 9 insertions(+), 11 deletions(-) diff --git a/scripts/check_added_files.sh b/scripts/check_added_files.sh index de05dc226..7995f1eb4 100755 --- a/scripts/check_added_files.sh +++ b/scripts/check_added_files.sh @@ -47,7 +47,7 @@ echo "Find files that have been added in last commit..." # Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -files=($(git diff-tree --no-commit-id --name-only -r HEAD --diff-filter=A)) +files=($(git diff-tree --no-commit-id --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=A)) if (( ${#files[@]} == 0 )) ; then echo "No files added" diff --git a/scripts/check_grid_file_atlcvmfs.sh b/scripts/check_grid_file_atlcvmfs.sh index b00e3d3e5..5dbcbf1f6 100755 --- a/scripts/check_grid_file_atlcvmfs.sh +++ b/scripts/check_grid_file_atlcvmfs.sh @@ -8,7 +8,7 @@ echo "Find links added in the last commit..." # Added(A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -changed=($(git diff-tree --name-only -r HEAD --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) +changed=($(git diff-tree --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) if (( ${#changed[@]} == 0 )) ; then echo "No GRID.tar.gz files added/modified since last commit" diff --git a/scripts/check_grid_file_size.sh b/scripts/check_grid_file_size.sh index 2bec1ffd4..937e6b915 100755 --- a/scripts/check_grid_file_size.sh +++ b/scripts/check_grid_file_size.sh @@ -8,7 +8,7 @@ echo "Find links added in the last commit..." # Added(A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -changed=($(git diff-tree --name-only -r HEAD --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) +changed=($(git diff-tree --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) if (( ${#changed[@]} == 0 )) ; then echo "No GRID.tar.gz files added/modified since last commit" diff --git a/scripts/check_jo_consistency_main.py b/scripts/check_jo_consistency_main.py index d18160d5a..7a8abc0ef 100755 --- a/scripts/check_jo_consistency_main.py +++ b/scripts/check_jo_consistency_main.py @@ -5,7 +5,7 @@ from check_jo_consistency import * def main(): print("\n===> Checking jobOption consistency...\n") # Get job options - command="git diff-tree --name-only -r HEAD --diff-filter=AMDCRTUXB | grep -E \"mc.*.py\"" + command="git diff-tree --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=AMDCRTUXB | grep -E \"mc.*.py\"" # Filter list of strings obtained from git diff-tree command to remove empty strings (no file modified) files=list(filter(None,os.popen(command).read().strip().split("\n"))) if files: diff --git a/scripts/check_logParser.sh b/scripts/check_logParser.sh index eea08bd0f..ae4c9eaa3 100755 --- a/scripts/check_logParser.sh +++ b/scripts/check_logParser.sh @@ -8,7 +8,7 @@ set +e # grep will look for DSID directories named like NNNxxx # awk will split the paths by slashes and will print the path except the last field which is the filename (NF="") # Then we only keep one such path (uniq) removing the trailing slash with sed -dirs=($(git diff-tree --name-only -r HEAD --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) +dirs=($(git diff-tree --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) if (( ${#dirs[@]} == 0 )) ; then echo "No jO files added/modified since last commit" diff --git a/scripts/check_unique_physicsShort.sh b/scripts/check_unique_physicsShort.sh index 70e9d0879..33e4d69f7 100755 --- a/scripts/check_unique_physicsShort.sh +++ b/scripts/check_unique_physicsShort.sh @@ -6,7 +6,7 @@ set +e unique=true # Get the files modified in the last commit -modified=($(git diff-tree --name-only -r HEAD --diff-filter=A | grep -E "mc.*py")) +modified=($(git diff-tree --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=A | grep -E "mc.*py")) if [[ "${#modified[@]}" > 0 ]] ; then echo "jO files modified in the latest commit: ${#modified[@]}" diff --git a/scripts/commit_new_dsid.sh b/scripts/commit_new_dsid.sh index c3615da3f..9afa0fa5f 100755 --- a/scripts/commit_new_dsid.sh +++ b/scripts/commit_new_dsid.sh @@ -250,12 +250,10 @@ if $git ; then printError "ERROR: nothing added to the commit. Please check error messages above." else git commit -q -m "Adding new DSID ${newDSID[0]} $commitMessage" - echo "" - printInfo "You have prepared branch $(git rev-parse --abbrev-ref HEAD)." + printInfo -f "\nYou have prepared branch $(git rev-parse --abbrev-ref HEAD)." printInfo "This contains the following changes:" git diff --stat master HEAD - echo "" - printInfo "If this looks good, you should now run 'git push' to upload." + printInfo "\nIf this looks good, you should now run 'git push' to upload." fi fi diff --git a/scripts/run_athena.sh b/scripts/run_athena.sh index 49fb90a4d..f35c27415 100755 --- a/scripts/run_athena.sh +++ b/scripts/run_athena.sh @@ -8,7 +8,7 @@ set +e # grep will look for DSID directories named like NNNxxx # awk will split the paths by slashes and will print the path except the last field which is the filename (NF="") # Then we only keep one such path (uniq) removing the trailing slash with sed -dirs=($(git diff-tree --name-only -r HEAD --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) +dirs=($(git diff-tree --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) if (( ${#dirs[@]} == 0 )) ; then echo "No jO files added/modified since last commit" -- GitLab From 1012c5d6123ec08800b3177fa8abfb5f628ecbb8 Mon Sep 17 00:00:00 2001 From: Spyridon Argyropoulos Date: Fri, 20 Dec 2019 10:18:11 +0100 Subject: [PATCH 2/3] Also allow local running of scripts for debugging [skip modfiles] --- scripts/check_added_files.sh | 4 +++- scripts/check_grid_file_atlcvmfs.sh | 4 +++- scripts/check_grid_file_size.sh | 4 +++- scripts/check_logParser.sh | 4 +++- scripts/check_modified_files.sh | 8 +++++--- scripts/check_unique_physicsShort.sh | 4 +++- scripts/run_athena.sh | 4 +++- 7 files changed, 23 insertions(+), 9 deletions(-) diff --git a/scripts/check_added_files.sh b/scripts/check_added_files.sh index 7995f1eb4..901e962f6 100755 --- a/scripts/check_added_files.sh +++ b/scripts/check_added_files.sh @@ -47,7 +47,9 @@ echo "Find files that have been added in last commit..." # Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -files=($(git diff-tree --no-commit-id --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=A)) +branch=HEAD # for running the script locally (for debugging) +if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI +files=($(git diff-tree --no-commit-id --name-only -r origin/master...origin/$branch --diff-filter=A)) if (( ${#files[@]} == 0 )) ; then echo "No files added" diff --git a/scripts/check_grid_file_atlcvmfs.sh b/scripts/check_grid_file_atlcvmfs.sh index 5dbcbf1f6..9570a2577 100755 --- a/scripts/check_grid_file_atlcvmfs.sh +++ b/scripts/check_grid_file_atlcvmfs.sh @@ -8,7 +8,9 @@ echo "Find links added in the last commit..." # Added(A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -changed=($(git diff-tree --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) +branch=HEAD # for running the script locally (for debugging) +if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI +changed=($(git diff-tree --name-only -r origin/master...origin/$branch --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) if (( ${#changed[@]} == 0 )) ; then echo "No GRID.tar.gz files added/modified since last commit" diff --git a/scripts/check_grid_file_size.sh b/scripts/check_grid_file_size.sh index 937e6b915..771d4ed80 100755 --- a/scripts/check_grid_file_size.sh +++ b/scripts/check_grid_file_size.sh @@ -8,7 +8,9 @@ echo "Find links added in the last commit..." # Added(A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -changed=($(git diff-tree --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) +branch=HEAD # for running the script locally (for debugging) +if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI +changed=($(git diff-tree --name-only -r origin/master...origin/$branch --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) if (( ${#changed[@]} == 0 )) ; then echo "No GRID.tar.gz files added/modified since last commit" diff --git a/scripts/check_logParser.sh b/scripts/check_logParser.sh index ae4c9eaa3..7d73e9198 100755 --- a/scripts/check_logParser.sh +++ b/scripts/check_logParser.sh @@ -8,7 +8,9 @@ set +e # grep will look for DSID directories named like NNNxxx # awk will split the paths by slashes and will print the path except the last field which is the filename (NF="") # Then we only keep one such path (uniq) removing the trailing slash with sed -dirs=($(git diff-tree --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) +branch=HEAD # for running the script locally (for debugging) +if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI +dirs=($(git diff-tree --name-only -r origin/master...origin/$branch --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) if (( ${#dirs[@]} == 0 )) ; then echo "No jO files added/modified since last commit" diff --git a/scripts/check_modified_files.sh b/scripts/check_modified_files.sh index b239d9b94..866aa7c0a 100755 --- a/scripts/check_modified_files.sh +++ b/scripts/check_modified_files.sh @@ -10,13 +10,15 @@ pass=true # Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -nchanged=$(git diff --name-status origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=MDCRTUXB | wc -l) +branch=HEAD # for running the script locally (for debugging) +if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI +nchanged=$(git diff --name-status origin/master...origin/$branch --diff-filter=MDCRTUXB | wc -l) if [ $nchanged -eq 0 ] ; then echo "OK: No file modified." else echo "ERROR: Your commit has modified or deleted pre-existing files: " - git diff --name-status origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=MDCRTUXB + git diff --name-status origin/master...origin/$branch --diff-filter=MDCRTUXB echo "This is not allowed!" pass=false fi @@ -24,7 +26,7 @@ fi # Find number of files that have been added in directories that # already existed (this would also modify the physics output) echo -e "\nWill now check whether files have been added in pre-existing DSID directories" -added=($(git diff --name-only origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=A)) +added=($(git diff --name-only origin/master...origin/$branch --diff-filter=A)) if [[ "${#added[@]}" > 0 ]] ; then # We also need to get a list of DSID directories present in the previous commit # First find the hash of the previous commit diff --git a/scripts/check_unique_physicsShort.sh b/scripts/check_unique_physicsShort.sh index 33e4d69f7..ec35b9537 100755 --- a/scripts/check_unique_physicsShort.sh +++ b/scripts/check_unique_physicsShort.sh @@ -6,7 +6,9 @@ set +e unique=true # Get the files modified in the last commit -modified=($(git diff-tree --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=A | grep -E "mc.*py")) +branch=HEAD # for running the script locally (for debugging) +if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI +modified=($(git diff-tree --name-only -r origin/master...origin/$branch --diff-filter=A | grep -E "mc.*py")) if [[ "${#modified[@]}" > 0 ]] ; then echo "jO files modified in the latest commit: ${#modified[@]}" diff --git a/scripts/run_athena.sh b/scripts/run_athena.sh index f35c27415..17d45b9fb 100755 --- a/scripts/run_athena.sh +++ b/scripts/run_athena.sh @@ -8,7 +8,9 @@ set +e # grep will look for DSID directories named like NNNxxx # awk will split the paths by slashes and will print the path except the last field which is the filename (NF="") # Then we only keep one such path (uniq) removing the trailing slash with sed -dirs=($(git diff-tree --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) +branch=HEAD # for running the script locally (for debugging) +if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI +dirs=($(git diff-tree --name-only -r origin/master...origin/$branch --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) if (( ${#dirs[@]} == 0 )) ; then echo "No jO files added/modified since last commit" -- GitLab From 33e35b133fbf0dfbad5b64bcd901049797dd833b Mon Sep 17 00:00:00 2001 From: Spyridon Argyropoulos Date: Fri, 20 Dec 2019 11:36:00 +0100 Subject: [PATCH 3/3] Fix how diffs are done [skip modfiles] --- scripts/check_added_files.sh | 41 +--------------------------- scripts/check_grid_file_atlcvmfs.sh | 4 +-- scripts/check_grid_file_size.sh | 4 +-- scripts/check_jo_consistency_main.py | 2 +- scripts/check_logParser.sh | 4 +-- scripts/check_modified_files.sh | 8 ++---- scripts/check_unique_physicsShort.sh | 6 ++-- scripts/run_athena.sh | 4 +-- 8 files changed, 11 insertions(+), 62 deletions(-) diff --git a/scripts/check_added_files.sh b/scripts/check_added_files.sh index 901e962f6..f09a53257 100755 --- a/scripts/check_added_files.sh +++ b/scripts/check_added_files.sh @@ -1,43 +1,6 @@ #!/bin/bash source scripts/whitelist.sh -# Function to check if a file is in the whitelist of files -# that are allowed to be added in a commit -checkWhiteList() { - if [ -f $1 ] ; then - if [[ !($1 == */*/mc.*.py) && - !($1 == */*/log.generate.short) && - !($1 == */*/MadGraphControl/*.py) && - !($1 == */*/PowhegControl/*.py) && - !($1 == */*/Herwig7_i/*.py) && - !($1 == */*/Pythia8_i/*.py) && - !($1 == */*/Sherpa_i/*.py) ]] ; then - return 1 #false - else - return 0 #true - fi - elif [ -d $1 ] ; then - if [[ !($1 == */*/MadGraphControl) && - !($1 == */*/PowhegControl) && - !($1 == */*/Herwig7_i) && - !($1 == */*/Pythia8_i) && - !($1 == */*/Sherpa_i) ]] ; then - return 1 #false - else - return 0 #true - fi - elif [ -L $1 ] ; then - if [[ !($1 == */*/mc_*TeV.*.GRID.tar.gz) ]] ; then - return 1 #false - else - return 0 #true - fi - else - echo "Unknown file/filetype: $1" - return 1 - fi -} - # Make sure that if a command fails the script will continue set +e @@ -47,9 +10,7 @@ echo "Find files that have been added in last commit..." # Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -branch=HEAD # for running the script locally (for debugging) -if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI -files=($(git diff-tree --no-commit-id --name-only -r origin/master...origin/$branch --diff-filter=A)) +files=($(git diff-tree --no-commit-id --name-only -r origin/master..HEAD --diff-filter=A)) if (( ${#files[@]} == 0 )) ; then echo "No files added" diff --git a/scripts/check_grid_file_atlcvmfs.sh b/scripts/check_grid_file_atlcvmfs.sh index 9570a2577..be7cc4d48 100755 --- a/scripts/check_grid_file_atlcvmfs.sh +++ b/scripts/check_grid_file_atlcvmfs.sh @@ -8,9 +8,7 @@ echo "Find links added in the last commit..." # Added(A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -branch=HEAD # for running the script locally (for debugging) -if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI -changed=($(git diff-tree --name-only -r origin/master...origin/$branch --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) +changed=($(git diff-tree --name-only -r origin/master..HEAD --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) if (( ${#changed[@]} == 0 )) ; then echo "No GRID.tar.gz files added/modified since last commit" diff --git a/scripts/check_grid_file_size.sh b/scripts/check_grid_file_size.sh index 771d4ed80..5551261de 100755 --- a/scripts/check_grid_file_size.sh +++ b/scripts/check_grid_file_size.sh @@ -8,9 +8,7 @@ echo "Find links added in the last commit..." # Added(A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -branch=HEAD # for running the script locally (for debugging) -if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI -changed=($(git diff-tree --name-only -r origin/master...origin/$branch --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) +changed=($(git diff-tree --name-only -r origin/master..HEAD --diff-filter=AMCRTUXB | grep 'GRID.tar.gz')) if (( ${#changed[@]} == 0 )) ; then echo "No GRID.tar.gz files added/modified since last commit" diff --git a/scripts/check_jo_consistency_main.py b/scripts/check_jo_consistency_main.py index 7a8abc0ef..37b870a6b 100755 --- a/scripts/check_jo_consistency_main.py +++ b/scripts/check_jo_consistency_main.py @@ -5,7 +5,7 @@ from check_jo_consistency import * def main(): print("\n===> Checking jobOption consistency...\n") # Get job options - command="git diff-tree --name-only -r origin/master...origin/$CI_COMMIT_REF_NAME --diff-filter=AMDCRTUXB | grep -E \"mc.*.py\"" + command="git diff-tree --name-only -r origin/master..HEAD --diff-filter=AMDCRTUXB | grep -E \"mc.*.py\"" # Filter list of strings obtained from git diff-tree command to remove empty strings (no file modified) files=list(filter(None,os.popen(command).read().strip().split("\n"))) if files: diff --git a/scripts/check_logParser.sh b/scripts/check_logParser.sh index 7d73e9198..bc716ccd7 100755 --- a/scripts/check_logParser.sh +++ b/scripts/check_logParser.sh @@ -8,9 +8,7 @@ set +e # grep will look for DSID directories named like NNNxxx # awk will split the paths by slashes and will print the path except the last field which is the filename (NF="") # Then we only keep one such path (uniq) removing the trailing slash with sed -branch=HEAD # for running the script locally (for debugging) -if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI -dirs=($(git diff-tree --name-only -r origin/master...origin/$branch --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) +dirs=($(git diff-tree --name-only -r origin/master..HEAD --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) if (( ${#dirs[@]} == 0 )) ; then echo "No jO files added/modified since last commit" diff --git a/scripts/check_modified_files.sh b/scripts/check_modified_files.sh index 866aa7c0a..9e375ccb6 100755 --- a/scripts/check_modified_files.sh +++ b/scripts/check_modified_files.sh @@ -10,15 +10,13 @@ pass=true # Copied (C), Deleted (D), Modified (M), Renamed (R), have their type # (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), # are Unknown (X), or have had their pairing Broken (B). -branch=HEAD # for running the script locally (for debugging) -if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI -nchanged=$(git diff --name-status origin/master...origin/$branch --diff-filter=MDCRTUXB | wc -l) +nchanged=$(git diff --name-status origin/master..HEAD --diff-filter=MDCRTUXB | wc -l) if [ $nchanged -eq 0 ] ; then echo "OK: No file modified." else echo "ERROR: Your commit has modified or deleted pre-existing files: " - git diff --name-status origin/master...origin/$branch --diff-filter=MDCRTUXB + git diff --name-status origin/master..HEAD --diff-filter=MDCRTUXB echo "This is not allowed!" pass=false fi @@ -26,7 +24,7 @@ fi # Find number of files that have been added in directories that # already existed (this would also modify the physics output) echo -e "\nWill now check whether files have been added in pre-existing DSID directories" -added=($(git diff --name-only origin/master...origin/$branch --diff-filter=A)) +added=($(git diff --name-only origin/master..HEAD --diff-filter=A)) if [[ "${#added[@]}" > 0 ]] ; then # We also need to get a list of DSID directories present in the previous commit # First find the hash of the previous commit diff --git a/scripts/check_unique_physicsShort.sh b/scripts/check_unique_physicsShort.sh index ec35b9537..709ba437a 100755 --- a/scripts/check_unique_physicsShort.sh +++ b/scripts/check_unique_physicsShort.sh @@ -5,10 +5,8 @@ set +e unique=true -# Get the files modified in the last commit -branch=HEAD # for running the script locally (for debugging) -if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI -modified=($(git diff-tree --name-only -r origin/master...origin/$branch --diff-filter=A | grep -E "mc.*py")) +# Get the files modified in the last commit wrt origin/master +modified=($(git diff-tree --name-only -r origin/master..HEAD --diff-filter=A | grep -E "mc.*py")) if [[ "${#modified[@]}" > 0 ]] ; then echo "jO files modified in the latest commit: ${#modified[@]}" diff --git a/scripts/run_athena.sh b/scripts/run_athena.sh index 17d45b9fb..c34330dc3 100755 --- a/scripts/run_athena.sh +++ b/scripts/run_athena.sh @@ -8,9 +8,7 @@ set +e # grep will look for DSID directories named like NNNxxx # awk will split the paths by slashes and will print the path except the last field which is the filename (NF="") # Then we only keep one such path (uniq) removing the trailing slash with sed -branch=HEAD # for running the script locally (for debugging) -if [ ! -z $CI_COMMIT_REF_NAME ] ; then branch=$CI_COMMIT_REF_NAME ; fi # for running in CI -dirs=($(git diff-tree --name-only -r origin/master...origin/$branch --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) +dirs=($(git diff-tree --name-only -r origin/master..HEAD --diff-filter=AMDCRTUXB | grep -E '[0-9]{3}xxx/[0-9]{6}/mc.*.py' | awk 'BEGIN {FS=OFS="/"} {$NF="" ; print $0}' | uniq | sed 's|/$||')) if (( ${#dirs[@]} == 0 )) ; then echo "No jO files added/modified since last commit" -- GitLab