Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Circular Dependency on ECR artifact #41

Closed
lyoungblood opened this issue May 13, 2018 · 5 comments
Closed

Circular Dependency on ECR artifact #41

lyoungblood opened this issue May 13, 2018 · 5 comments

Comments

@lyoungblood
Copy link

lyoungblood commented May 13, 2018

This is such a powerful architectural pattern, @jpignata - especially with Fargate.

I just wanted to make you aware of a circular dependency issue. I couldn't figure out an elegant workaround. Since you are creating a brand new ECR repository that will have zero artifacts until you do a successful build, the ECS service will never complete creation because the task can't move from PENDING to RUNNING state until it can pull the artifact from ECR. And, the Pipeline can't create yet because it needs an ECS service to deploy to.

The workaround I am currently using is to launch the CloudFormation template, then while the ECS Service is attempting to launch, doing a manual "docker build/tag/push" to the newly created ECR repository. Once there is an artifact to pull, the ECS service goes to CREATE_COMPLETE status and the Pipeline gets created.

This probably wouldn't be an issue if you're using a pre-existing ECR repository with at least 1 artifact.

@jpignata
Copy link
Contributor

jpignata commented May 13, 2018 via email

@lyoungblood
Copy link
Author

Would you mind pointing out where in the code that workaround is? I actually rewrote this entire architecture pattern into a single template so that I didn't have that issue that others faced if they wanted to update stack (where you lose the ability to change parameters as part of a stack update, or potentially have stack updates override parameters causing unexpected behavior).

@lyoungblood
Copy link
Author

I also agree about your second statement (having a CloudFormation template in the pipeline to manage the task definition and service) - it seems somewhat against the "infrastructure as code" paradigm to have a service like CodePipeline updating the task definition for you, as opposed to versioning that in source control like everything else. Perhaps if I have enough free time I'll take a stab at it and create a pull request.

@jpignata
Copy link
Contributor

jpignata commented May 14, 2018 via email

@lyoungblood
Copy link
Author

See
#33 for
discussion on this.

Great! That actually looks like a better option, to deploy with DesiredCount 0. By merging all the nested templates into 1, I've already fixed the issue with parameter overrides in the nested templates getting overwritten by stack updates.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants