Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(pipelines): add example of the modern API with an ECS deployment #18042

Closed
wants to merge 5 commits into from

Conversation

tobytipton
Copy link
Contributor

Provides tests as examples to #17558 for deploy ECS with the modern CDK pipeline API.

closes #17558

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Dec 15, 2021

@github-actions github-actions bot added the @aws-cdk/aws-codepipeline Related to AWS CodePipeline label Dec 15, 2021
@mergify
Copy link
Contributor

mergify bot commented Dec 15, 2021

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@tobytipton tobytipton changed the title chore(CodePipeline) add modern cdk pipeline api ecs deploy test examples chore(CodePipeline): add modern cdk pipeline api ecs deploy test examples Dec 15, 2021
@tobytipton
Copy link
Contributor Author

Doesn't look the failed code build is related to my change.

aws-cdk: FAIL test/version.test.js (25.919 s)
aws-cdk:   â—� Return later version when exists & skip recent re-check
aws-cdk:     thrown: "Exceeded timeout of 10000 ms for a test.
aws-cdk:     Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."
aws-cdk:       45 | });
aws-cdk:       46 |
aws-cdk:     > 47 | test('Return later version when exists & skip recent re-check', async () => {
aws-cdk:          | ^
aws-cdk:       48 |   const cache = new VersionCheckTTL(tmpfile(), 100);
aws-cdk:       49 |   const result = await latestVersionIfHigher('0.0.0', cache);
aws-cdk:       50 |   expect(result).not.toBeNull();
aws-cdk:       at Object.<anonymous> (test/version.test.ts:47:1)
aws-cdk:   â—� Return null if version is higher than npm
aws-cdk:     thrown: "Exceeded timeout of 10000 ms for a test.
aws-cdk:     Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."
aws-cdk:       55 | });
aws-cdk:       56 |
aws-cdk:     > 57 | test('Return null if version is higher than npm', async () => {
aws-cdk:          | ^
aws-cdk:       58 |   const cache = new VersionCheckTTL(tmpfile(), 100);
aws-cdk:       59 |   const result = await latestVersionIfHigher('100.100.100', cache);
aws-cdk:       60 |   expect(result).toBeNull();
aws-cdk:       at Object.<anonymous> (test/version.test.ts:57:1)
aws-cdk: A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.
aws-cdk: =============================== Coverage summary ===============================

@skinny85 skinny85 changed the title chore(CodePipeline): add modern cdk pipeline api ecs deploy test examples chore(pipelines): add example of the modern API with an ECS deployment Dec 16, 2021
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Dec 16, 2021
@skinny85 skinny85 removed their assignment Dec 16, 2021
@skinny85
Copy link
Contributor

@rix0rrr you want to take this one?

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 98096f0
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@tobytipton tobytipton mentioned this pull request Dec 21, 2021
2 tasks
@rix0rrr
Copy link
Contributor

rix0rrr commented Jan 3, 2022

I'm sorry, but this is not how CDK pipelines is intended to be used.

In CDK pipelines, we deploy all changes via CloudFormation: that includes updates to your ECS service. If you want to deploy other scenarios, you can build whatever shape of pipeline you prefer with full control by using the aws-codepipeline module directly.

Yes, you can use the custom step facility of CDK pipelines and use it as a convenient front-end over the CodePipeline module, and get pretty close to arbitrary pipelines. But this is not how we recommend you use the library, and so we will not include how-tos on how to achieve that into the upstream repository.

@rix0rrr rix0rrr closed this Jan 3, 2022
@shawnwang-avl
Copy link

shawnwang-avl commented Dec 13, 2022

Troubleshooting why my ECS is not deploying led me to here. Using CloudFormation to deploy ECS is indeed easier than rigging your own ECS deployment step/action.

There are however 2 important things I wish CDK docs would call out:

  1. ECS service must use DockerImageAsset
  2. Using DockerImageAsset imply your source code building must be self-contained in Dockerfile.

We previously built our own ECR image with Codebuild step and had part of the build cmds in CodeBuild step, and took significant time to refactor this. It is also not a perfect solution - we are no longer able to retrieve Github SSH key from Secrets Manager for instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline @aws-cdk/pipelines CDK Pipelines library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(aws-codepipeline-actions): Support cross-account ECS deployments with codepipeline actions
5 participants