GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test(e2e): clean redundant task stack for task e2e test by iamhopaul123 · Pull Request #1267 · aws/copilot-cli

This repository was archived by the owner on Jun 22, 2026. It is now read-only.

Conversation

@iamhopaul123

@iamhopaul123 iamhopaul123 commented Aug 13, 2020

Copy link
Copy Markdown
Contributor

Currently our task e2e test doesn't delete the task stack after running the task e2e test. And the task stack is very difficult to remove because the CFN Execution Role that used to manage the task stack is deleted when we delete copilot environment. Also, the remaining task stacks piles up in our Copilot pipeline account.

This PR fixes this issue by removing task stack before we delete copilot app/env.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@iamhopaul123
iamhopaul123 requested a review from a team as a code owner August 13, 2020 19:28
@iamhopaul123
iamhopaul123 requested a review from kohidave August 13, 2020 19:28
@amazon-ecs-cli-v2-pr-manager
amazon-ecs-cli-v2-pr-manager requested a review from huanjani August 13, 2020 19:28
@iamhopaul123 iamhopaul123 added the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label Aug 13, 2020
@huanjani

huanjani commented Aug 13, 2020

Copy link
Copy Markdown
Contributor

Does the env get deleted, too?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iamhopaul123

iamhopaul123 commented Aug 13, 2020

Copy link
Copy Markdown
Contributor Author

Does the env get deleted, too?

yeah copilot app delete automatically deletes all env/svc in the app and then deletes the app.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

huanjani
huanjani approved these changes Aug 13, 2020
View reviewed changes
@efekarakus efekarakus changed the title fix(e2e): clean redundant task stack for task e2e test test(e2e): clean redundant task stack for task e2e test Aug 13, 2020
@iamhopaul123
test(e2e): clean redundant task stack for task e2e test
34247ed
@iamhopaul123
iamhopaul123 force-pushed the e2e/quick-fix branch from 78e0093 to 34247ed Compare August 13, 2020 20:48
@iamhopaul123 iamhopaul123 removed the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label Aug 14, 2020
efekarakus
efekarakus reviewed Aug 14, 2020
View reviewed changes
Comment thread e2e/task/task_suite_test.go
err := command.Run("aws", []string{"ecr", "delete-repository", "--repository-name", repoName, "--force"})
Expect(err).NotTo(HaveOccurred(), "delete ecr repo")
// Delete task stack.
err = command.Run("aws", []string{"cloudformation", "delete-stack", "--stack-name", taskStackName})

@efekarakus efekarakus Aug 14, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm trying to understand based on the error that you saw yesterday while trying to delete from console:

Role arn:aws:iam::xxx:role/e2e-task-1597338546-test-CFNExecutionRole is invalid or cannot be assumed

Will this have the necessary permissions? how come?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iamhopaul123 iamhopaul123 Aug 14, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it will have. I tested that. So it's because we still have the CFN execution role since we haven't deleted the environment yet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@efekarakus efekarakus Aug 14, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks that totally makes sense!

I think one thing that these tests made us realize is that if a customer uses the same task group name to run their tasks both in a Copilot env and then in default, they won't be able to delete the stack in case the Copilot environment is deleted which is slightly surprising:

It is not possible to remove a service role attached to a stack after the stack is created.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-servicerole.html

Maybe, when we implement task delete we can provide a nicer err message with action items when this err occurs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
efekarakus
efekarakus approved these changes Aug 14, 2020
View reviewed changes
Comment thread e2e/task/task_suite_test.go
err := command.Run("aws", []string{"ecr", "delete-repository", "--repository-name", repoName, "--force"})
Expect(err).NotTo(HaveOccurred(), "delete ecr repo")
// Delete task stack.
err = command.Run("aws", []string{"cloudformation", "delete-stack", "--stack-name", taskStackName})

@efekarakus efekarakus Aug 14, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks that totally makes sense!

I think one thing that these tests made us realize is that if a customer uses the same task group name to run their tasks both in a Copilot env and then in default, they won't be able to delete the stack in case the Copilot environment is deleted which is slightly surprising:

It is not possible to remove a service role attached to a stack after the stack is created.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-servicerole.html

Maybe, when we implement task delete we can provide a nicer err message with action items when this err occurs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mergify
Merge branch 'mainline' into e2e/quick-fix
e0a8f96
@mergify
mergify Bot merged commit 35679bb into aws:mainline Aug 14, 2020
thrau pushed a commit to localstack/copilot-cli-local that referenced this pull request Dec 9, 2022
@iamhopaul123 @thrau
test(e2e): clean redundant task stack for task e2e test (aws#1267)
41eb1f5
<!-- Provide summary of changes -->
Currently our task e2e test doesn't delete the task stack after running the task e2e test. And the task stack is very difficult to remove because the CFN Execution Role that used to manage the task stack is deleted when we delete copilot environment.  Also, the remaining task stacks piles up in our Copilot pipeline account.

This PR fixes this issue by removing task stack before we delete copilot app/env.
<!-- Issue number, if available. E.g. "Fixes aws#31", "Addresses aws#42, 77" -->

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@kohidave kohidave Awaiting requested review from kohidave
2 more reviewers
@efekarakus efekarakus efekarakus approved these changes
@huanjani huanjani huanjani approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@iamhopaul123 @huanjani @efekarakus
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.