diff --git a/backend/docker_backend.go b/backend/docker_backend.go index 6616121..51876f1 100644 --- a/backend/docker_backend.go +++ b/backend/docker_backend.go @@ -164,6 +164,10 @@ func (backend *dockerBackend) BuildRecipe(stagingGuid string, request cc_message } logger.Debug("staging-task-request") + if request.IsolationSegment != "" { + taskDefinition.PlacementTags = []string{request.IsolationSegment} + } + return taskDefinition, stagingGuid, backend.config.TaskDomain, nil } diff --git a/backend/docker_backend_test.go b/backend/docker_backend_test.go index 84616ca..f087b35 100644 --- a/backend/docker_backend_test.go +++ b/backend/docker_backend_test.go @@ -273,6 +273,26 @@ var _ = Describe("DockerBackend", func() { Expect(taskDef.TrustedSystemCertificatesPath).To(Equal(backend.TrustedSystemCertificatesPath)) }) + It("does not set any Isolation Segments", func() { + taskDef, _, _, err := docker.BuildRecipe("staging-guid", stagingRequest) + Expect(err).NotTo(HaveOccurred()) + + Expect(taskDef.PlacementTags).To(BeEmpty()) + }) + + Context("When the request has an Isolation Segment", func() { + JustBeforeEach(func() { + stagingRequest.IsolationSegment = "foo" + }) + + It("sets the Isolation Segment on the task definition", func() { + taskDef, _, _, err := docker.BuildRecipe("staging-guid", stagingRequest) + Expect(err).NotTo(HaveOccurred()) + + Expect(taskDef.PlacementTags).To(ContainElement("foo")) + }) + }) + Context("with a missing app id", func() { BeforeEach(func() { appID = ""