Commit 4b7574d6 authored by Jan Kiene's avatar Jan Kiene
Browse files

add pre and post check for being up-to-date with target

parent 556377cb
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ stages:
  - build
  - check-be
  - test
  - postvalidate
  - deploy

# ---------------------------------------------------------------
@@ -229,6 +230,13 @@ stages:
  - (Get-Content -Path "CMakeLists.txt") -replace '# \(add_compile_options\("\/WX"\)\)', '$1' | Set-Content -Path "CMakeLists.txt"
  - Get-ChildItem -Path "Workspace_msvc" -Filter "*.vcxproj" | ForEach-Object { (Get-Content -Path $_.FullName) -replace '<TreatWarningAsError>false', '<TreatWarningAsError>true' | Set-Content -Path $_.FullName }

.rules-merge-request:
  extends: .rules-basis
  rules:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
    - if: $CI_PIPELINE_SOURCE == 'push'
      when: never

.rules-pytest-to-ref-short:
  rules:
    - if: $CI_PIPELINE_SOURCE == 'web' && $MANUAL_PIPELINE_TYPE == "pytest-compare"
@@ -774,6 +782,35 @@ uninterruptible:
# verification jobs
# ---------------------------------------------------------------

branch-is-up-to-date-with-target-pre:
  extends:
    - .rules-merge-request
  stage: prevalidate
  needs: []
  tags:
    - ivas-basop-linux
  script:
    - *get-commits-behind-count
    - |
      if [ $commits_behind_count -ne 0 ]; then
        echo -e "Your branch is $commits_behind_count commits behind the target branch, run\n\tgit pull origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME\nto update."
        exit 1
      fi

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

clang-format-check:
  extends:
    - .test-job-linux