stages: - checkRepository - checkFormat RebaseCheck: stage: checkRepository image: alpine tags: - docker only: refs: - merge_requests variables: - $CI_MERGE_REQUEST_PROJECT_PATH == "CbmSoft/cbmroot_geometry" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" script: # Get the upstream repository manually. I did not find any other way to have it for # comparison # Check if a rebase is needed # If a rebase is needed stop immediately - apk update && apk add git bash - ci_scripts/connect_upstream_repo.sh $CI_MERGE_REQUEST_PROJECT_URL - git fetch upstream - hash1=$(git show-ref upstream/master | cut -f1 -d' ') - hash2=$(git merge-base upstream/master HEAD) - echo "${hash1}" - echo "${hash2}" - if [ "${hash1}" = "${hash2}" ]; then - echo "No rebase required" - exit 0 - else - echo "The Merge Request is not up-to-date" - echo "Rebase is required" - exit 1 - fi LinearHistCheck: stage: checkRepository image: alpine tags: - docker only: refs: - merge_requests variables: - $CI_MERGE_REQUEST_PROJECT_PATH == "CbmSoft/cbmroot_geometry" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" script: # Get the upstream repository manually. I did not find any other way to have it for # comparison # Check if the history introduced by the MR is linear (no branch loop in fork) # If not linear stop immediately - apk update && apk add git bash - ci_scripts/connect_upstream_repo.sh $CI_MERGE_REQUEST_PROJECT_URL - git fetch upstream - count=$(git rev-list --min-parents=2 --count upstream/master..HEAD) - echo "${count}" - if [ 0 = "${count}" ]; then - echo "History introduced in fork is linear" - exit 0 - else - echo "History introduced in fork is not linear" - echo "${count} merge commits must be removed or the other new commits have to be replayed in a new branch" - exit 1 - fi FileFormatCheck: stage: checkFormat image: alpine tags: - docker only: refs: - merge_requests variables: - $CI_MERGE_REQUEST_PROJECT_PATH == "CbmSoft/cbmroot_geometry" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" script: # Get the upstream repository manually. I did not find any other way to have it for # comparison - apk update && apk add git bash file - ci_scripts/connect_upstream_repo.sh $CI_MERGE_REQUEST_PROJECT_URL - git fetch upstream - ci_scripts/check-file-format.sh upstream FileMediaCheck: stage: checkFormat image: alpine tags: - docker only: refs: - merge_requests variables: - $CI_MERGE_REQUEST_PROJECT_PATH == "CbmSoft/cbmroot_geometry" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" script: # Get the upstream repository manually. I did not find any other way to have it for # comparison - apk update && apk add git bash file gawk - ci_scripts/connect_upstream_repo.sh $CI_MERGE_REQUEST_PROJECT_URL - git fetch upstream - gawk -f ci_scripts/static_check.awk media.geo