Commit ddf1ae36 authored by Stan Hu's avatar Stan Hu

Merge branch '201742-ec2-templates' into 'master'

Templates for EC2 deployment and provisioning via CF

See merge request gitlab-org/gitlab!42566
parents 5a89d7a2 d44b9d81
......@@ -14,7 +14,7 @@ class CiPlatformMetric < ApplicationRecord
numericality: { only_integer: true, greater_than: 0 }
CI_VARIABLE_KEY = 'AUTO_DEVOPS_PLATFORM_TARGET'
ALLOWED_TARGETS = %w[ECS FARGATE].freeze
ALLOWED_TARGETS = %w[ECS FARGATE EC2].freeze
def self.insert_auto_devops_platform_targets!
recorded_at = Time.zone.now
......
stages:
- provision
- review
- production
variables:
AUTO_DEVOPS_PLATFORM_TARGET: EC2
include:
- template: Jobs/CF-Provision.gitlab-ci.yml
- template: Jobs/Deploy/EC2.gitlab-ci.yml
stages:
- provision
cloud_formation:
image: 'registry.gitlab.com/gitlab-org/cloud-deploy/aws-cloudformation:latest'
stage: provision
script:
- gl-cloudformation create-stack
rules:
- if: '($AUTO_DEVOPS_PLATFORM_TARGET != "EC2") || ($AUTO_DEVOPS_PLATFORM_TARGET != "ECS")'
when: never
- if: '$CI_KUBERNETES_ACTIVE'
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
stages:
- review
- production
.push-and-deploy:
image: 'registry.gitlab.com/gitlab-org/cloud-deploy/aws-ec2:latest'
script:
- gl-ec2 push-to-s3
- gl-ec2 deploy-to-ec2
review_ec2:
extends: .push-and-deploy
stage: review
environment:
name: review/$CI_COMMIT_REF_NAME
rules:
- if: '$AUTO_DEVOPS_PLATFORM_TARGET != "EC2"'
when: never
- if: '$CI_KUBERNETES_ACTIVE'
when: never
- if: '$REVIEW_DISABLED'
when: never
- if: '$CI_COMMIT_BRANCH == "master"'
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
production_ec2:
extends: .push-and-deploy
stage: production
environment:
name: production
rules:
- if: '$AUTO_DEVOPS_PLATFORM_TARGET != "EC2"'
when: never
- if: '$CI_KUBERNETES_ACTIVE'
when: never
- if: '$CI_COMMIT_BRANCH != "master"'
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment