Commit 6bbe6cfc authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat: adaptive pipeline

BREAKING CHANGE: change default workflow from Branch pipeline to MR pipeline
parent d5fe180f
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -37,15 +37,23 @@
      "description": "Angular [ng test](https://angular.io/cli/test) arguments",
      "default": "test --code-coverage --reporters progress,junit",
      "advanced": true
    },
    }
  ],
  "features": [
    {
      "id": "lint",
      "name": "Angular lint",
      "description": "Angular lint analysis",
      "disable_with": "NG_LINT_DISABLED",
      "variables": [
        {
          "name": "NG_LINT_ARGS",
          "description": "Angular [ng lint](https://angular.io/cli/lint) arguments",
          "default": "lint",
          "advanced": true
        }
  ],
  "features": [
      ]
    },
    {
      "id": "publish",
      "name": "Publish",
+29 −10
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"
@@ -434,10 +453,9 @@ ng-lint:
      - $NG_WORKSPACE_DIR/reports
    expire_in: 1 day
  rules:
    # 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
    - if: '$NG_LINT_DISABLED == "true"'
      when: never
    - !reference [.test-policy, rules]

###############################################################################################
#                                      build stage:                                           #
@@ -485,12 +503,13 @@ ng-e2e:
  rules:
    # only run if feature is enabled
    - if: '$NG_E2E_ENABLED == "true"'
    - !reference [.test-policy, rules]

###############################################################################################
#                                      publish stage:                                         #
#                                        - npm-publish                                        #
###############################################################################################
npm-publish:
ng-publish:
  extends: .ng-cli-base
  stage: publish
  before_script: