Commit 28aa6cb3 authored by Clemens Lange's avatar Clemens Lange
Browse files

Merge branch 'duplicate#32' into 'master'

Update check.sh to remove duplicates

Closes #32

See merge request cms-cloud/cmssw-docker!38
parents ea2a9254 64516df4
#!/bin/bash
files=$(git diff-tree --no-commit-id --name-only -r -m $CI_COMMIT_SHA) # Get path to files changed in commit
for file in $files; do
dir=${file%/*} # Get directory from path
regexp="cc7-cms\|cc7-cvmfs\|slc6-cms\|slc6-cvmfs\|slc5-cms"
if [[ ! -z $CI_COMMIT_BRANCH ]]; then
regexp="${regexp}\|standalone"
fi
echo "Changes in $dir directory"
dir_wo_duplicates=$(echo $files | grep -o $regexp | sort | uniq | tr '\n' ' ' | sed -e 's/[[:space:]]*$//') # Directories without duplicates
for dir in $dir_wo_duplicates; do
if [[ "$dir" =~ ^(cc7-cms|cc7-cvmfs|slc6-cms|slc6-cvmfs|slc5-cms)$ ]] && [[ -z $CI_COMMIT_BRANCH ]]; then # $CI_COMMIT_BRANCH is the commit branch name. Present only when building branches.
if [[ -z $CI_COMMIT_BRANCH ]]; then # $CI_COMMIT_BRANCH is the commit branch name. Present only when building branches.
# For production on master
echo "On master"
......@@ -18,7 +21,7 @@ for file in $files; do
--form "variables[IMAGE_NAME]=$dir" \
https://gitlab.cern.ch/api/v4/projects/$CI_PROJECT_ID/trigger/pipeline
elif [[ "$dir" =~ ^(cc7-cms|cc7-cvmfs|slc6-cms|slc6-cvmfs|slc5-cms|standalone)$ ]] && [[ ! -z $CI_COMMIT_BRANCH ]]; then
elif [[ ! -z $CI_COMMIT_BRANCH ]]; then
# For testing on branches
echo "On branch $CI_COMMIT_BRANCH"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment