Commit 0c7bffa2 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat: implement adaptive pipeline

parent 8962c25d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ It uses the following variables:
| Name                  | description                                | default value     |
| --------------------- | ------------------------------------------ | ----------------- |
| `XXX_LINT_IMAGE`      | The Docker image used to run the lint tool | `xxx-lint:latest` |
| `XXX_LINT_DISABLED`   | Set to `true` to disable the `lint` analysis| _none_ (enabled) |
| `XXX_LINT_ARGS`       | Lint [options and arguments](link-to-the-cli-options) | `--serevity=medium` |

### `xxx-depcheck` job
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
      "id": "lint",
      "name": "XXX lint",
      "description": "[XXX lint](link-to-the-tool) analysis",
      "disable_with": "XXX_LINT_DISABLED",
      "variables": [
        {
          "name": "XXX_LINT_IMAGE",
+32 −15
Original line number Diff line number Diff line
@@ -13,14 +13,33 @@
# program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 
# Floor, Boston, MA  02110-1301, USA.
# =========================================================================================
# default workflow rules
# default workflow rules: Merge Request pipelines
workflow:
  rules:
    # exclude merge requests
    - if: $CI_MERGE_REQUEST_ID
    # prevent branch pipeline when an MR is open (prefer MR pipeline)
    - if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
      when: never
    - when: always

# test job prototype: implement adaptive pipeline rules
.test-policy:
  rules:
    # on tag: auto & failing
    - if: $CI_COMMIT_TAG
    # on ADAPTIVE_PIPELINE_DISABLED: auto & failing
    - if: '$ADAPTIVE_PIPELINE_DISABLED == "true"'
    # on production or integration branch(es): auto & failing
    - if: '$CI_COMMIT_REF_NAME =~ $PROD_REF || $CI_COMMIT_REF_NAME =~ $INTEG_REF'
    # early stage (dev branch, no MR): manual & non-failing
    - if: '$CI_MERGE_REQUEST_ID == null && $CI_OPEN_MERGE_REQUESTS == null'
      when: manual
      allow_failure: true
    # Draft MR: auto & non-failing
    - if: '$CI_MERGE_REQUEST_TITLE =~ /^Draft:.*/'
      allow_failure: true
    # else (Ready MR): auto & failing
    - when: on_success

variables:
  # variabilized tracking image
  TBC_TRACKING_IMAGE: "$CI_REGISTRY/to-be-continuous/tools/tracking:master"
@@ -279,7 +298,6 @@ stages:
    fi
  }


  function output_coverage() {
    echo "[TODO]: compute and output global coverage result"
    echo "11% covered"
@@ -349,11 +367,11 @@ xxx-lint:
    paths:
      - reports/
  rules:
    # on production or integration branches: auto
    - if: '$CI_COMMIT_REF_NAME =~ $PROD_REF || $CI_COMMIT_REF_NAME =~ $INTEG_REF'
    # else (development branches): manual & non-blocking
    - when: manual
      allow_failure: true
    # exclude if $XXX_LINT_DISABLED
    - if: '$XXX_LINT_DISABLED == "true"'
      when: never
    # .test-policy rules
    - !reference [.test-policy, rules]

# (example) dependency check job
xxx-depcheck:
@@ -392,11 +410,10 @@ xxx-publish:
  script:
    - xxx $XXX_PUBLISH_ARGS
  rules:
    # on production branch(es): manual & non-blocking if $XXX_PUBLISH_ENABLED is set
    - if: '$XXX_PUBLISH_ENABLED == "true" && $CI_COMMIT_REF_NAME =~ $PROD_REF'
      when: manual
      allow_failure: true
    # on integration branch(es): manual & non-blocking if $XXX_PUBLISH_ENABLED is set
    - if: '$XXX_PUBLISH_ENABLED == "true" && $CI_COMMIT_REF_NAME =~ $INTEG_REF'
    # exclude if $XXX_PUBLISH_ENABLED unset
    - if: '$XXX_PUBLISH_ENABLED != "true"'
      when: never
    # on integration or production branch(es): manual & non-blocking
    - if: '$CI_COMMIT_REF_NAME =~ $INTEG_REF || $CI_COMMIT_REF_NAME =~ $PROD_REF'
      when: manual
      allow_failure: true