diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 067e5cec3dd5a0980e51cd55b0f5c40eb881dbdc..7472eaee9392743209016fd6cdf4e30739e650dc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,13 +9,28 @@ stages: - integration include: - - project: distro/oniro - file: - - .oniro-ci/dco.yaml - template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml' dco: - extends: .dco + interruptible: true + stage: compliance + image: christophebedard/dco-check:latest + rules: + - if: $CI_MERGE_REQUEST_ID + - if: $CI_EXTERNAL_PULL_REQUEST_IID + - if: $CI_COMMIT_BRANCH == '$CI_DEFAULT_BRANCH' + script: + # Work around a bug in dco-check affecting pipelines for merge requests. + # https://github.com/christophebedard/dco-check/issues/104 + - | + if [ "${CI_MERGE_REQUEST_EVENT_TYPE:-}" = detached ]; then + git fetch -a # so that we can resolve branch names below + export CI_COMMIT_BRANCH="$CI_COMMIT_REF_NAME"; + export CI_COMMIT_BEFORE_SHA="$CI_MERGE_REQUEST_DIFF_BASE_SHA"; + export CI_MERGE_REQUEST_SOURCE_BRANCH_SHA="$(git rev-parse "origin/$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME")"; + export CI_MERGE_REQUEST_TARGET_BRANCH_SHA="$(git rev-parse "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME")"; + fi + - dco-check --default-branch-from-remote --verbose reuse: interruptible: true