Commit 3de547ba authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'feat/adaptive-pipeline' into 'master'

feat: adaptive pipeline

See merge request to-be-continuous/node!24
parents 6ec103d4 4e66d5d5
Loading
Loading
Loading
Loading
+33 −21
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"
@@ -304,6 +323,10 @@ node-build:
      - $NODE_PROJECT_DIR/$NODE_BUILD_DIR
      - $NODE_PROJECT_DIR/reports/
    expire_in: 1 day
  rules:
    # always if $NODE_BUILD_DISABLED not set
    - if: '$NODE_BUILD_DISABLED != "true"'
    - !reference [.test-policy, rules]

node-lint:
  extends: .node-base
@@ -320,13 +343,11 @@ node-lint:
      - $NODE_PROJECT_DIR/reports/
    expire_in: 1 day
  rules:
    # exclude if $NODE_LINT_ENABLED not set
    # exclude if $NODE_LINT_ENABLED unset
    - if: '$NODE_LINT_ENABLED != "true"'
      when: never
    # on production or integration branches: auto
    - if: '$CI_COMMIT_REF_NAME =~ $PROD_REF || $CI_COMMIT_REF_NAME =~ $INTEG_REF'
    # else (development branches): auto & non-blocking
    - allow_failure: true
    # on production or integration branch(es): auto & failing
    - !reference [.test-policy, rules]

###############################################################################################
# Test stage: audit & outdated
@@ -352,13 +373,9 @@ node-audit:
      - $NODE_PROJECT_DIR/reports/
  rules:
    # exclude if $NODE_AUDIT_DISABLED set
    - if: $NODE_AUDIT_DISABLED == "true"
    - if: '$NODE_AUDIT_DISABLED == "true"'
      when: never
    # on production or intergation branch(es)
    - if: '$CI_COMMIT_REF_NAME =~ $PROD_REF || $CI_COMMIT_REF_NAME =~ $INTEG_REF'
    # on non-production, non-integration branches: manual & non-blocking
    - when: manual
      allow_failure: true
    - !reference [.test-policy, rules]

# outdated
node-outdated:
@@ -380,11 +397,6 @@ node-outdated:
      - $NODE_PROJECT_DIR/reports/
  rules:
    # exclude if $NODE_OUTDATED_DISABLED set
    - if: $NODE_OUTDATED_DISABLED == "true"
    - if: '$NODE_OUTDATED_DISABLED == "true"'
      when: never
    # on production or integration branch(es): auto & non-blocking
    - if: '$CI_COMMIT_REF_NAME =~ $PROD_REF || $CI_COMMIT_REF_NAME =~ $INTEG_REF'
      allow_failure: true
    # on non-production, non-integration branches: manual & non-blocking
    - when: manual
      allow_failure: true
    - !reference [.test-policy, rules]