Commit d621ca2e authored by Jan Kiene's avatar Jan Kiene
Browse files

add additional info to printout + remove duplicates

parent c5844b6a
Loading
Loading
Loading
Loading
Loading
+1 −42
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ stages:
  - if [ -f $MERGE_TARGET_COMMIT_FILE ]; then
  -   MERGE_REQUEST_TARGET="$(cat "$MERGE_TARGET_COMMIT_FILE")"
  - else
  -   echo "MERGE_TARGET_COMMIT_FILE does not exist, exiting!"
  -   echo "MERGE_TARGET_COMMIT_FILE ($MERGE_TARGET_COMMIT_FILE) does not exist, exiting!"
  -   exit 1
  - fi
  - git checkout $MERGE_REQUEST_TARGET
@@ -1051,47 +1051,6 @@ uninterruptible:
# Validation jobs
# ---------------------------------------------------------------

branch-is-up-to-date-with-target-pre:
  extends:
    - .rules-merge-request-to-main-pc
  stage: prevalidate
  needs: []
  tags:
    - ivas-linux
  script:
    - *get-commits-behind-count
    - echo $commits_behind_count
    - |
      if [ $commits_behind_count -ne 0 ]; then
        echo "Your branch is behind the target branch, run 'git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME' to update."
        exit 1
      fi
    - git fetch origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
    - TARGET_COMMIT="$(git rev-parse "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME")"
    - echo "TARGET_COMMIT is $TARGET_COMMIT"
    - echo "$TARGET_COMMIT" > "$MERGE_TARGET_COMMIT_FILE"
  artifacts:
    paths:
      - $MERGE_TARGET_COMMIT_FILE

branch-is-up-to-date-with-target-post:
  extends:
    - .rules-merge-request-to-main-pc
  stage: postvalidate
  tags:
    - ivas-linux
  script:
    - *get-commits-behind-count
    - echo $commits_behind_count
    - |
      if [ $commits_behind_count -ne 0 ]; then
        echo "Your branch is behind the target branch, possibly main changed during your pipeline run, run 'git pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME' to update."
        exit 123
      fi
  allow_failure:
    exit_codes:
      - 123

# fail pipeline in the final stage for pipelines on Draft MRs
# this also only runs on Draft MRs, so should always fail
fail-pipeline-if-in-draft: