Commit 22e16aeb authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

fix(score): replace parallel:matrix job impl with explicit inheritance to...

fix(score): replace parallel:matrix job impl with explicit inheritance to allow user multi-template instantiation
parent f37db7a8
Loading
Loading
Loading
Loading
+64 −20
Original line number Diff line number Diff line
@@ -890,8 +890,11 @@ stages:
    - !reference [.k8s-scripts]
    - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"

# Kube-Score job as parallel matrix
k8s-score:
# Kube Score job prototype
# Can be extended for each concrete environment
#
# @arg ENV_TYPE      : environment type
.k8s-score:
  extends: .k8s-base
  stage: package-test
  image:
@@ -899,12 +902,12 @@ k8s-score:
    entrypoint: [""]
  script:
    - k8s_score
  parallel:
    matrix:
      - ENV_TYPE: review
      - ENV_TYPE: integration
      - ENV_TYPE: staging
      - ENV_TYPE: production

k8s-score-review:
  extends: .k8s-score
  variables:
    ENV_TYPE: review
    ENV_VALUES: "$K8S_REVIEW_VALUES"
  rules:
    # exclude tags
    - if: $CI_COMMIT_TAG
@@ -912,26 +915,67 @@ k8s-score:
    # exclude when $K8S_SCORE_DISABLED is set
    - if: '$K8S_SCORE_DISABLED == "true"'
      when: never
    # exclude review if $K8S_REVIEW_SPACE unset
    - if: '$ENV_TYPE == "review" && ($K8S_REVIEW_SPACE == null || $K8S_REVIEW_SPACE == "")'
    # exclude if $K8S_REVIEW_SPACE unset
    - if: '$K8S_REVIEW_SPACE == null || $K8S_REVIEW_SPACE == ""'
      when: never
    # exclude review on integration or prod branch
    - if: '$ENV_TYPE == "review" && ($CI_COMMIT_REF_NAME =~ $INTEG_REF || $CI_COMMIT_REF_NAME =~ $PROD_REF)'
    # exclude on integration or prod branch
    - if: '$CI_COMMIT_REF_NAME =~ $INTEG_REF || $CI_COMMIT_REF_NAME =~ $PROD_REF'
      when: never
    # exclude integration if $K8S_INTEG_SPACE unset
    - if: '$ENV_TYPE == "integration" && ($K8S_INTEG_SPACE == null || $K8S_INTEG_SPACE == "")'
    - !reference [.test-policy, rules]

k8s-score-integration:
  extends: .k8s-score
  variables:
    ENV_TYPE: integration
    ENV_VALUES: "$K8S_INTEG_VALUES"
  rules:
    # exclude tags
    - if: $CI_COMMIT_TAG
      when: never
    # exclude when $K8S_SCORE_DISABLED is set
    - if: '$K8S_SCORE_DISABLED == "true"'
      when: never
    # exclude integration on prod branch
    - if: '$ENV_TYPE == "integration" && $CI_COMMIT_REF_NAME =~ $PROD_REF'
    # exclude if $K8S_INTEG_SPACE unset
    - if: '$K8S_INTEG_SPACE == null || $K8S_INTEG_SPACE == ""'
      when: never
    # exclude on prod branch
    - if: '$CI_COMMIT_REF_NAME =~ $PROD_REF'
      when: never
    - !reference [.test-policy, rules]

k8s-score-staging:
  extends: .k8s-score
  variables:
    ENV_TYPE: staging
    ENV_VALUES: "$K8S_STAGING_VALUES"
  rules:
    # exclude tags
    - if: $CI_COMMIT_TAG
      when: never
    # exclude staging if $K8S_STAGING_SPACE unset
    - if: '$ENV_TYPE == "staging" && ($K8S_STAGING_SPACE == null || $K8S_STAGING_SPACE == "")'
    # exclude when $K8S_SCORE_DISABLED is set
    - if: '$K8S_SCORE_DISABLED == "true"'
      when: never
    # exclude production if $K8S_PROD_SPACE unset
    - if: '$ENV_TYPE == "production" && ($K8S_PROD_SPACE == null || $K8S_PROD_SPACE == "")'
    # exclude if $K8S_STAGING_SPACE unset
    - if: '$K8S_STAGING_SPACE == null || $K8S_STAGING_SPACE == ""'
      when: never
    - !reference [.test-policy, rules]

k8s-score-production:
  extends: .k8s-score
  variables:
    ENV_TYPE: production
    ENV_VALUES: "$K8S_PROD_VALUES"
  rules:
    # exclude tags
    - if: $CI_COMMIT_TAG
      when: never
    # exclude when $K8S_SCORE_DISABLED is set
    - if: '$K8S_SCORE_DISABLED == "true"'
      when: never
    # exclude if $K8S_PROD_SPACE unset
    - if: '$K8S_PROD_SPACE == null || $K8S_PROD_SPACE == ""'
      when: never
    - !reference [.test-policy, rules]

# Deploy job prototype
# Can be extended to define a concrete environment