Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e3135392
Commit
e3135392
authored
Jul 06, 2020
by
Etienne Baqué
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Fargate related jobs
Extended Deploy/ECS template. Added rspecs accordingly. Updated documentation.
parent
d20e41ca
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
17 deletions
+67
-17
changelogs/unreleased/218841-extend-ecs-for-fargate.yml
changelogs/unreleased/218841-extend-ecs-for-fargate.yml
+5
-0
doc/topics/autodevops/requirements.md
doc/topics/autodevops/requirements.md
+3
-3
lib/gitlab/ci/templates/Jobs/Deploy/ECS.gitlab-ci.yml
lib/gitlab/ci/templates/Jobs/Deploy/ECS.gitlab-ci.yml
+36
-6
spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb
...ib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb
+23
-8
No files found.
changelogs/unreleased/218841-extend-ecs-for-fargate.yml
0 → 100644
View file @
e3135392
---
title
:
Extend ECS Deploy template with Fargate jobs
merge_request
:
35173
author
:
type
:
added
doc/topics/autodevops/requirements.md
View file @
e3135392
...
...
@@ -112,9 +112,9 @@ Variable. To do so, follow these steps:
section.
1.
Specify which AWS platform to target during the Auto DevOps deployment
by adding the
`AUTO_DEVOPS_PLATFORM_TARGET`
variable
.
1.
Give this variable the value
`ECS`
before saving it
.
by adding the
`AUTO_DEVOPS_PLATFORM_TARGET`
variable
with one of the following values:
-
`FARGATE`
if the service you're targeting must be of launch type FARGATE.
-
`ECS`
if you're not enforcing any launch type check when deploying to ECS
.
When you trigger a pipeline, if Auto DevOps is enabled and if you've correctly
[
entered AWS credentials as environment variables
](
../../ci/cloud_deployment/index.md#deploy-your-application-to-the-aws-elastic-container-service-ecs
)
,
...
...
lib/gitlab/ci/templates/Jobs/Deploy/ECS.gitlab-ci.yml
View file @
e3135392
...
...
@@ -13,11 +13,20 @@
script
:
-
ecs update-task-definition
review_ecs
:
extends
:
.deploy_to_ecs
.review_ecs_base
:
stage
:
review
extends
:
.deploy_to_ecs
environment
:
name
:
review/$CI_COMMIT_REF_NAME
.production_ecs_base
:
stage
:
production
extends
:
.deploy_to_ecs
environment
:
name
:
production
review_ecs
:
extends
:
.review_ecs_base
rules
:
-
if
:
'
$AUTO_DEVOPS_PLATFORM_TARGET
!=
"ECS"'
when
:
never
...
...
@@ -29,11 +38,21 @@ review_ecs:
when
:
never
-
if
:
'
$CI_COMMIT_TAG
||
$CI_COMMIT_BRANCH'
review_fargate
:
extends
:
.review_ecs_base
rules
:
-
if
:
'
$AUTO_DEVOPS_PLATFORM_TARGET
!=
"FARGATE"'
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_ecs
:
extends
:
.deploy_to_ecs
stage
:
production
environment
:
name
:
production
extends
:
.production_ecs_base
rules
:
-
if
:
'
$AUTO_DEVOPS_PLATFORM_TARGET
!=
"ECS"'
when
:
never
...
...
@@ -42,3 +61,14 @@ production_ecs:
-
if
:
'
$CI_COMMIT_BRANCH
!=
"master"'
when
:
never
-
if
:
'
$CI_COMMIT_TAG
||
$CI_COMMIT_BRANCH'
production_fargate
:
extends
:
.production_ecs_base
rules
:
-
if
:
'
$AUTO_DEVOPS_PLATFORM_TARGET
!=
"FARGATE"'
when
:
never
-
if
:
'
$CI_KUBERNETES_ACTIVE'
when
:
never
-
if
:
'
$CI_COMMIT_BRANCH
!=
"master"'
when
:
never
-
if
:
'
$CI_COMMIT_TAG
||
$CI_COMMIT_BRANCH'
spec/lib/gitlab/ci/templates/auto_devops_gitlab_ci_yaml_spec.rb
View file @
e3135392
...
...
@@ -37,6 +37,7 @@ RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do
context
'when the project is set for deployment to AWS'
do
let
(
:platform_value
)
{
'ECS'
}
let
(
:review_prod_build_names
)
{
build_names
.
select
{
|
n
|
n
.
include?
(
'review'
)
||
n
.
include?
(
'production'
)}
}
before
do
create
(
:ci_variable
,
project:
project
,
key:
'AUTO_DEVOPS_PLATFORM_TARGET'
,
value:
platform_value
)
...
...
@@ -67,8 +68,15 @@ RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do
end
it
'creates an ECS deployment job for production only'
do
expect
(
build_names
).
not_to
include
(
'review_ecs'
)
expect
(
build_names
).
to
include
(
'production_ecs'
)
expect
(
review_prod_build_names
).
to
contain_exactly
(
'production_ecs'
)
end
context
'with FARGATE as a launch type'
do
let
(
:platform_value
)
{
'FARGATE'
}
it
'creates a FARGATE deployment job for production only'
do
expect
(
review_prod_build_names
).
to
contain_exactly
(
'production_fargate'
)
end
end
context
'and we are not on the default branch'
do
...
...
@@ -79,15 +87,22 @@ RSpec.describe 'Auto-DevOps.gitlab-ci.yml' do
project
.
repository
.
create_branch
(
pipeline_branch
)
end
it_behaves_like
'no ECS job when AUTO_DEVOPS_PLATFORM_TARGET is not present'
do
let
(
:job_name
)
{
'review_ecs'
}
%w(review_ecs review_fargate)
.
each
do
|
job
|
it_behaves_like
'no ECS job when AUTO_DEVOPS_PLATFORM_TARGET is not present'
do
let
(
:job_name
)
{
job
}
end
end
it
'creates an ECS deployment job for review only'
do
expect
(
build_names
).
to
include
(
'review_ecs'
)
expect
(
build_names
).
not_to
include
(
'production_ecs'
)
expect
(
build_names
).
not_to
include
(
'review'
)
expect
(
build_names
).
not_to
include
(
'production'
)
expect
(
review_prod_build_names
).
to
contain_exactly
(
'review_ecs'
)
end
context
'with FARGATE as a launch type'
do
let
(
:platform_value
)
{
'FARGATE'
}
it
'creates an FARGATE deployment job for review only'
do
expect
(
review_prod_build_names
).
to
contain_exactly
(
'review_fargate'
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment