Commit 16b078dd authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge branch '128-add-a-test-to-merge-pipeline-for-commits-behind-target-branch' into 'main'

Implement 128: add a test to merge pipeline for commits behind target branch

See merge request !163
parents 52f6c004 079480b4
Loading
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ stages:
  - build
  - test
  - compare
  - validate

# ---------------------------------------------------------------
# Generic script anchors
@@ -107,6 +108,25 @@ stages:
      - 123


# ---------------------------------------------------------------
# Validation jobs
# ---------------------------------------------------------------

check-if-branch-is-up-to-date-with-main:
  extends:
    - .rules-merge-request
  stage: validate
  needs: []
  tags:
    - ivas-linux
  script:
    - echo $CI_COMMIT_SHA
    - echo $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
    - commits_behind_count=$(git rev-list --count $CI_COMMIT_SHA..origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME)
    - echo $commits_behind_count
    - if [ $commits_behind_count -eq 0 ]; then exit 0; else exit 1; fi;


# ---------------------------------------------------------------
# Build jobs
# ---------------------------------------------------------------