Loading checking_conflicts.sh +8 −27 Changes for checking_conflicts.sh: 8 added lines, 27 removed lines. Original line number Original line Diff line number Diff line Loading @@ -20,8 +20,6 @@ echo "CI_PROJECT_NAME:" $7 echo "GITLAB_USER_NAME:" $8 echo "GITLAB_USER_NAME:" $8 #$GITLAB_USER_EMAIL -> 9 #$GITLAB_USER_EMAIL -> 9 echo "GITLAB_USER_EMAIL:" $9 echo "GITLAB_USER_EMAIL:" $9 #CONFLICTING_MERGE_REQUEST -> 11 echo "CONFLICTING_MERGE_REQUEST:" $CONFLICTING_MERGE_REQUEST #echo "------ Removing previous outputs --------" #echo "------ Removing previous outputs --------" rm **/*.txt rm **/*.txt Loading @@ -47,22 +45,6 @@ echo "Checkout merge request source branch ${6} ..." git checkout -b "${6}" "origin/${6}" #Git checkout actual merge requests SOURCE BRANCHE git checkout -b "${6}" "origin/${6}" #Git checkout actual merge requests SOURCE BRANCHE git status git status if [ ! -z $CONFLICTING_MERGE_REQUEST ] ; then echo "\n------ Getting a conflicting merge request --------" mr_source_branch=${$CONFLICTING_MERGE_REQUEST} echo "Checkout conflicting merge request source branch ${mr_source_branch} ..." git checkout -b "${mr_source_branch}" "origin/${mr_source_branch}" #Git checkout other merge requests SOURCE BRANCHES echo "Run dry merge from conflicting merge request source branch ${mr_source_branch} into actual merge request source branch ${6} ..." git merge --no-commit --no-ff "${6}" #SOURCE BRANCH of the merge request result=$? if [ ! $result == 0 ] ; then echo "Merge request title: ${mr_source_branch}" >> conflicting_merge_requests.txt else echo "No conflict with Merge request title: ${mr_source_branch}" fi git merge --abort else echo "\n------ Getting all potential conflicting merge requests --------" echo "\n------ Getting all potential conflicting merge requests --------" # Get a list of open merge requests: Filter by the same Milestone and Target Branch as the actual merge request # Get a list of open merge requests: Filter by the same Milestone and Target Branch as the actual merge request Loading Loading @@ -101,14 +83,14 @@ else if [ ! $result == 0 ] ; then if [ ! $result == 0 ] ; then echo "Merge request title: ${mr_title}, Merge Request ID: ${mr_id}" >> conflicting_merge_requests.txt echo "Merge request title: ${mr_title}, Merge Request ID: ${mr_id}" >> conflicting_merge_requests.txt conflicting_merge_request_ids+=("${mr_id}") conflicting_merge_request_ids+=("${mr_id}") # Trigger pipeline for conflicting merge requests # Setting label to the merge request which is conflicting with echo "Triggering pipeline for merge request ${mr_id}" echo "Setting label to the merge request which is conflicting with: ${mr_id}" curl -X POST \ --fail \ curl --request PUT \ -F token=${10} \ --silent \ -F ref=${mr_source_branch} \ --header "PRIVATE-TOKEN: ${10}" \ -F "variables[CONFLICTING_MERGE_REQUEST]=${mr_source_branch}" \ --data "add_labels=Conflict with merge request ${5}" \ ${1}/projects/${2}/trigger/pipeline "${1}/projects/${2}/merge_requests/${mr_id}" else else echo "No conflict with Merge request title: ${mr_title}, Merge Request ID: ${mr_id}" echo "No conflict with Merge request title: ${mr_title}, Merge Request ID: ${mr_id}" fi fi Loading @@ -116,7 +98,6 @@ else fi fi done done fi if [ -f "conflicting_merge_requests.txt" ]; then if [ -f "conflicting_merge_requests.txt" ]; then echo "List of conflicting merge requests:" echo "List of conflicting merge requests:" Loading generateChangemarks/.gitlab-ci.yml +1 −3 Changes for generateChangemarks/.gitlab-ci.yml: 1 added line, 3 removed lines. Original line number Original line Diff line number Diff line Loading @@ -26,8 +26,6 @@ Checking conflicts: rules: rules: - if: $CI_MERGE_REQUEST_TITLE !~ /v.*_baseline$/ && $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_MERGE_REQUEST_TITLE !~ /v.*_baseline$/ && $CI_PIPELINE_SOURCE == "merge_request_event" when: always when: always - if: $CI_MERGE_REQUEST_TITLE !~ /v.*_baseline$/ && $CI_PIPELINE_SOURCE == "trigger" when: always allow_failure: true allow_failure: true image: python:3.9.18-slim-bullseye image: python:3.9.18-slim-bullseye tags: tags: Loading @@ -41,7 +39,7 @@ Checking conflicts: - git clone "https://$CI_SERVER_HOST/$CI_PROJECT_PATH.git" ${CI_PROJECT_NAME} - git clone "https://$CI_SERVER_HOST/$CI_PROJECT_PATH.git" ${CI_PROJECT_NAME} script: script: - echo 'Checking conflicts' - echo 'Checking conflicts' - ./checking_conflicts.sh ${CI_API_V4_URL} ${CI_MERGE_REQUEST_PROJECT_ID} ${CI_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 $CHECKING_CONFLICTS_TOKEN $CONFLICTING_MERGE_REQUEST - ./checking_conflicts.sh ${CI_API_V4_URL} ${CI_MERGE_REQUEST_PROJECT_ID} ${CI_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 artifacts: artifacts: when: on_failure when: on_failure paths: paths: Loading Loading
checking_conflicts.sh +8 −27 Changes for checking_conflicts.sh: 8 added lines, 27 removed lines. Original line number Original line Diff line number Diff line Loading @@ -20,8 +20,6 @@ echo "CI_PROJECT_NAME:" $7 echo "GITLAB_USER_NAME:" $8 echo "GITLAB_USER_NAME:" $8 #$GITLAB_USER_EMAIL -> 9 #$GITLAB_USER_EMAIL -> 9 echo "GITLAB_USER_EMAIL:" $9 echo "GITLAB_USER_EMAIL:" $9 #CONFLICTING_MERGE_REQUEST -> 11 echo "CONFLICTING_MERGE_REQUEST:" $CONFLICTING_MERGE_REQUEST #echo "------ Removing previous outputs --------" #echo "------ Removing previous outputs --------" rm **/*.txt rm **/*.txt Loading @@ -47,22 +45,6 @@ echo "Checkout merge request source branch ${6} ..." git checkout -b "${6}" "origin/${6}" #Git checkout actual merge requests SOURCE BRANCHE git checkout -b "${6}" "origin/${6}" #Git checkout actual merge requests SOURCE BRANCHE git status git status if [ ! -z $CONFLICTING_MERGE_REQUEST ] ; then echo "\n------ Getting a conflicting merge request --------" mr_source_branch=${$CONFLICTING_MERGE_REQUEST} echo "Checkout conflicting merge request source branch ${mr_source_branch} ..." git checkout -b "${mr_source_branch}" "origin/${mr_source_branch}" #Git checkout other merge requests SOURCE BRANCHES echo "Run dry merge from conflicting merge request source branch ${mr_source_branch} into actual merge request source branch ${6} ..." git merge --no-commit --no-ff "${6}" #SOURCE BRANCH of the merge request result=$? if [ ! $result == 0 ] ; then echo "Merge request title: ${mr_source_branch}" >> conflicting_merge_requests.txt else echo "No conflict with Merge request title: ${mr_source_branch}" fi git merge --abort else echo "\n------ Getting all potential conflicting merge requests --------" echo "\n------ Getting all potential conflicting merge requests --------" # Get a list of open merge requests: Filter by the same Milestone and Target Branch as the actual merge request # Get a list of open merge requests: Filter by the same Milestone and Target Branch as the actual merge request Loading Loading @@ -101,14 +83,14 @@ else if [ ! $result == 0 ] ; then if [ ! $result == 0 ] ; then echo "Merge request title: ${mr_title}, Merge Request ID: ${mr_id}" >> conflicting_merge_requests.txt echo "Merge request title: ${mr_title}, Merge Request ID: ${mr_id}" >> conflicting_merge_requests.txt conflicting_merge_request_ids+=("${mr_id}") conflicting_merge_request_ids+=("${mr_id}") # Trigger pipeline for conflicting merge requests # Setting label to the merge request which is conflicting with echo "Triggering pipeline for merge request ${mr_id}" echo "Setting label to the merge request which is conflicting with: ${mr_id}" curl -X POST \ --fail \ curl --request PUT \ -F token=${10} \ --silent \ -F ref=${mr_source_branch} \ --header "PRIVATE-TOKEN: ${10}" \ -F "variables[CONFLICTING_MERGE_REQUEST]=${mr_source_branch}" \ --data "add_labels=Conflict with merge request ${5}" \ ${1}/projects/${2}/trigger/pipeline "${1}/projects/${2}/merge_requests/${mr_id}" else else echo "No conflict with Merge request title: ${mr_title}, Merge Request ID: ${mr_id}" echo "No conflict with Merge request title: ${mr_title}, Merge Request ID: ${mr_id}" fi fi Loading @@ -116,7 +98,6 @@ else fi fi done done fi if [ -f "conflicting_merge_requests.txt" ]; then if [ -f "conflicting_merge_requests.txt" ]; then echo "List of conflicting merge requests:" echo "List of conflicting merge requests:" Loading
generateChangemarks/.gitlab-ci.yml +1 −3 Changes for generateChangemarks/.gitlab-ci.yml: 1 added line, 3 removed lines. Original line number Original line Diff line number Diff line Loading @@ -26,8 +26,6 @@ Checking conflicts: rules: rules: - if: $CI_MERGE_REQUEST_TITLE !~ /v.*_baseline$/ && $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_MERGE_REQUEST_TITLE !~ /v.*_baseline$/ && $CI_PIPELINE_SOURCE == "merge_request_event" when: always when: always - if: $CI_MERGE_REQUEST_TITLE !~ /v.*_baseline$/ && $CI_PIPELINE_SOURCE == "trigger" when: always allow_failure: true allow_failure: true image: python:3.9.18-slim-bullseye image: python:3.9.18-slim-bullseye tags: tags: Loading @@ -41,7 +39,7 @@ Checking conflicts: - git clone "https://$CI_SERVER_HOST/$CI_PROJECT_PATH.git" ${CI_PROJECT_NAME} - git clone "https://$CI_SERVER_HOST/$CI_PROJECT_PATH.git" ${CI_PROJECT_NAME} script: script: - echo 'Checking conflicts' - echo 'Checking conflicts' - ./checking_conflicts.sh ${CI_API_V4_URL} ${CI_MERGE_REQUEST_PROJECT_ID} ${CI_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 $CHECKING_CONFLICTS_TOKEN $CONFLICTING_MERGE_REQUEST - ./checking_conflicts.sh ${CI_API_V4_URL} ${CI_MERGE_REQUEST_PROJECT_ID} ${CI_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 artifacts: artifacts: when: on_failure when: on_failure paths: paths: Loading