Commit bc02d62e authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Adding more details to the conflict log file

parent 50219adb
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -55,9 +55,9 @@ echo "\n------ Getting all potential conflicting merge requests --------"
# Initialize an empty array to store conflicting merge requests
conflicting_merge_request_ids=()
if [ ${3} == "all" ] ; then
  merge_requests=$(curl "${1}/projects/${2}/merge_requests?state=opened&target_branch=${4}")
  merge_requests=$(curl --header "PRIVATE-TOKEN: ${10}" "${1}/projects/${2}/merge_requests?state=opened&target_branch=${4}")
else
  merge_requests=$(curl "${1}/projects/${2}/merge_requests?state=opened&milestone=${3}&target_branch=${4}")
  merge_requests=$(curl --header "PRIVATE-TOKEN: ${10}" "${1}/projects/${2}/merge_requests?state=opened&milestone=${3}&target_branch=${4}")
fi
echo "${merge_requests}" | jq -c '.[]' | while read mr; do
  mr_id=$(echo "$mr" | jq '.iid')
@@ -86,6 +86,14 @@ echo "${merge_requests}" | jq -c '.[]' | while read mr; do
    result=$?
    if [ ! $result == 0 ] ; then
      echo "Merge request title: ${mr_title}, Merge Request ID: ${mr_id}" >> conflicting_merge_requests.txt
      spec=$(git diff --name-only --diff-filter=U | grep -E "(TS|TR)")
      sed -n '
        /^<<<<<<< /,/^>>>>>>> / {
          /^<<<<<<<\|^>>>>>>>/!{=;p}
          /^>>>>>>> /a\

        }
      ' ${spec} >> conflicting_merge_requests.txt
      conflicting_merge_request_ids+=("${mr_id}")
      # Setting label to the merge request which is conflicting with
      echo "Setting label to the merge request which is conflicting with: ${mr_id}"
+3 −3
Original line number Diff line number Diff line
@@ -40,12 +40,12 @@ Checking conflicts:
    # Installation of required software
    - apt-get update -qq && apt-get -qq install -y git curl jq > /dev/null
    - |
     curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/checking_conflicts%2Esh/raw?ref=master" >> checking_conflicts.sh
     curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/checking_conflicts%2Esh/raw?ref=detailsConflicts" >> checking_conflicts.sh
    - chmod +x checking_conflicts.sh
    - git clone "https://$CI_SERVER_HOST/$CI_PROJECT_PATH.git" ${CI_PROJECT_NAME}
    - git clone "https://oauth2:${PIPELINE_ACCESS_TOKEN}@$CI_SERVER_HOST/$CI_PROJECT_PATH.git" ${CI_PROJECT_NAME}
  script:
    - echo 'Checking conflicts'
    - ./checking_conflicts.sh ${CI_API_V4_URL} ${CI_MERGE_REQUEST_PROJECT_ID} ${MERGE_REQUEST_MILESTONE} ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME} ${CI_MERGE_REQUEST_IID} ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} ${CI_PROJECT_NAME} "$GITLAB_USER_NAME" $GITLAB_USER_EMAIL $MIKE_ACCESS_TOKEN
    - ./checking_conflicts.sh ${CI_API_V4_URL} ${CI_MERGE_REQUEST_PROJECT_ID} ${MERGE_REQUEST_MILESTONE} ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME} ${CI_MERGE_REQUEST_IID} ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} ${CI_PROJECT_NAME} "$GITLAB_USER_NAME" $GITLAB_USER_EMAIL $PIPELINE_ACCESS_TOKEN
  artifacts:
    when: on_failure
    paths: