Skip to content
Snippets Groups Projects
.gitlab-ci.yml 4.1 KiB
Newer Older
  • Learn to ignore specific revisions
  •     DOCKER_HOST: "tcp://docker-dind.gitlab-suma:2375"
    
        AUTO_DEVOPS_BUILD_IMAGE_EXTRA_ARGS: "--network host"
    
        POSTGRES_ENABLED: "false"
        CODE_QUALITY_DISABLED: "true"
        CONTAINER_SCANNING_DISABLED: "true"
        DAST_DISABLED: "true"
        DEPENDENCY_SCANNING_DISABLED: "true"
        LICENSE_MANAGEMENT_DISABLED: "true"
        PERFORMANCE_DISABLED: "true"
        SAST_DISABLED: "true"
        TEST_DISABLED: "true"
    
    
    Dominik Hebeler's avatar
    Dominik Hebeler committed
    include:
      - template: Jobs/Build.gitlab-ci.yml
    
      - template: Jobs/Deploy.gitlab-ci.yml
    
    Dominik Hebeler's avatar
    Dominik Hebeler committed
      - build
    
      - deploy  # dummy stage to follow the template guidelines
      - review
      - dast
      - staging
      - canary
    
      - production
      - incremental rollout 10%
      - incremental rollout 25%
      - incremental rollout 50%
      - incremental rollout 100%
    
      - performance
    
      - integrationtest
    
      - cleanup
    
    
    Dominik Hebeler's avatar
    Dominik Hebeler committed
    .auto-deploy:
      image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v1.0.6"
    
    Dominik Hebeler's avatar
    Dominik Hebeler committed
    build:
      services:
    
    
    prepare_node:
      stage: prepare
      image: node:10
      before_script:
        - npm install
      script:
        - npm run prod
      artifacts:
        paths:
          - public/js/
          - public/css/
    
    Dominik Hebeler's avatar
    Dominik Hebeler committed
          - public/mix-manifest.json
    
      cache:
        # Cache per Branch
        key: "node-$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
        paths:
          - node_modules
      only:
    
        - branches
        - tags
    
    Dominik Hebeler's avatar
    Dominik Hebeler committed
    prepare_composer:
      stage: prepare
      image: prooph/composer:7.3
      script:
    
        - composer install --no-dev
    
    Dominik Hebeler's avatar
    Dominik Hebeler committed
      artifacts:
        paths:
          - vendor
      cache:
        key: "composer-$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
        paths:
    
          - vendor
    
    review:
      variables:
    
        HELM_UPGRADE_VALUES_FILE: .gitlab/review-apps-values.yaml
    
        ROLLOUT_RESOURCE_TYPE: deployment
    
    Dominik Hebeler's avatar
    Dominik Hebeler committed
      rules:
        - if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
          when: never
        - if: '$CI_COMMIT_BRANCH == "master"'
          when: never
        - if: '$CI_COMMIT_BRANCH == "development"'
          when: never
        - if: '$REVIEW_DISABLED'
          when: never
        - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
    
    Dominik Hebeler's avatar
    Dominik Hebeler committed
      rules:
        - if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
          when: never
        - if: '$CI_COMMIT_BRANCH == "master"'
          when: never
        - if: '$CI_COMMIT_BRANCH == "development"'
          when: never
        - if: '$REVIEW_DISABLED'
          when: never
        - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
    
    Dominik Hebeler's avatar
    Dominik Hebeler committed
    
    
    
    .development: &development_template
      extends: .auto-deploy
      stage: development
      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 delete canary
        - auto-deploy delete rollout
        - auto-deploy persist_environment_url
    
      variables:
    
        ADDITIONAL_HOSTS: "www.metager3.de"
    
        HELM_UPGRADE_VALUES_FILE: .gitlab/development-values.yaml
        ROLLOUT_RESOURCE_TYPE: deployment
    
      environment:
        name: development
    
        url: https://metager3.de
    
      artifacts:
        paths: [environment_url.txt]
    
    development:
      <<: *development_template
      only:
        refs:
          - development
        kubernetes: active
      except:
        variables:
          - $STAGING_ENABLED
          - $CANARY_ENABLED
          - $INCREMENTAL_ROLLOUT_ENABLED
          - $INCREMENTAL_ROLLOUT_MODE
    
    
    production:
      variables:
    
        ADDITIONAL_HOSTS: "www.metager.de,metager.org,www.metager.org,metager.es,www.metager.es,klassik.metager.org"
    
        HELM_UPGRADE_VALUES_FILE: .gitlab/production-values.yaml
    
        ROLLOUT_RESOURCE_TYPE: deployment
      environment:
    
        url: https://metager.de
    
    
    integrationtest:
      stage: integrationtest
      image: 
        name: prooph/composer:7.3
        entrypoint: ["/bin/sh"]
      script:
        # Install Dev Dependencies
        - composer install
    
        - cp .env.example .env
    
        - echo "WEBDRIVER_USER=\"$WEBDRIVER_KEY\"" >> .env
    
    Dominik Hebeler's avatar
    Dominik Hebeler committed
        - echo "WEBDRIVER_URL=\"$WEBDRIVER_URL\"" >> .env
        - echo "WEBDRIVER_KEY=\"$WEBDRIVER_USER\"" >> .env
    
        - php artisan key:generate
    
        - URL=$(cat environment_url.txt | tr -d '\n')
        - sed -i "s#^APP_URL=.*#APP_URL=$URL#g" .env
        - sed -i "s#^BRANCH_NAME=.*#BRANCH_NAME=$CI_COMMIT_REF_NAME#g" .env
        - sed -i "s#^COMMIT_NAME=.*#COMMIT_NAME=$CI_COMMIT_REF_SLUG#g" .env
    
    Dominik Hebeler's avatar
    Dominik Hebeler committed
        - php artisan dusk