DAST-Default-Branch-Deploy.gitlab-ci.yml 1.6 KB
Newer Older
1
.dast-auto-deploy:
2
  image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v1.0.2"
3 4

dast_environment_deploy:
5
  extends: .dast-auto-deploy
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
  stage: review
  script:
    - auto-deploy check_kube_domain
    - auto-deploy download_chart
    - auto-deploy ensure_namespace
    - auto-deploy initialize_tiller
    - auto-deploy create_secret
    - auto-deploy deploy
    - auto-deploy persist_environment_url
  environment:
    name: dast-default
    url: http://dast-$CI_PROJECT_ID-$CI_ENVIRONMENT_SLUG.$KUBE_INGRESS_BASE_DOMAIN
    on_stop: stop_dast_environment
  artifacts:
    paths: [environment_url.txt]
21 22 23 24 25
  rules:
    - if: $CI_DEFAULT_BRANCH != $CI_COMMIT_REF_NAME
      when: never
    - if: $DAST_DISABLED || $DAST_DISABLED_FOR_DEFAULT_BRANCH
      when: never
26
    - if: $DAST_WEBSITE  # we don't need to create a review app if a URL is already given
27 28 29 30
      when: never
    - if: $CI_COMMIT_BRANCH &&
          $CI_KUBERNETES_ACTIVE &&
          $GITLAB_FEATURES =~ /\bdast\b/
31 32

stop_dast_environment:
33
  extends: .dast-auto-deploy
34 35 36 37 38 39 40 41 42 43
  stage: cleanup
  variables:
    GIT_STRATEGY: none
  script:
    - auto-deploy initialize_tiller
    - auto-deploy delete
  environment:
    name: dast-default
    action: stop
  needs: ["dast"]
44 45 46 47 48
  rules:
    - if: $CI_DEFAULT_BRANCH != $CI_COMMIT_REF_NAME
      when: never
    - if: $DAST_DISABLED || $DAST_DISABLED_FOR_DEFAULT_BRANCH
      when: never
49
    - if: $DAST_WEBSITE  # we don't need to create a review app if a URL is already given
50 51 52 53
      when: never
    - if: $CI_COMMIT_BRANCH &&
          $CI_KUBERNETES_ACTIVE &&
          $GITLAB_FEATURES =~ /\bdast\b/
54
      when: always