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

feat: add --remove-orphans flag to compose down #1366

Merged

Conversation

stillfox-lee
Copy link
Contributor

Signed-off-by: Siyi Liao stillfox.lee@gmail.com

close: #1344

@stillfox-lee stillfox-lee marked this pull request as draft September 8, 2022 07:03
@AkihiroSuda
Copy link
Member

test-integration-docker-compatibility seems failing

=== RUN   TestComposeDownRemoveOrphans
    compose_down_linux_test.go:54: projectName="nerdctl-compose-test-1662693203"
    compose_down_linux_test.go:61: assertion failed: res.ExitCode is not exitCode: Stopping nerdctl-compose-test-1662693203_test_1 ... 
        Stopping nerdctl-compose-test-1662693203_test_1 ... done
        Found orphan containers (nerdctl-compose-test-1662693203_orphan_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
        Removing nerdctl-compose-test-1662693203_test_1 ... 
        Removing nerdctl-compose-test-1662693203_test_1 ... done
        Removing network nerdctl-compose-test-1662693203_default
        error while removing network: network nerdctl-compose-test-1662693203_default id b2cad4ddcb3f07d66fe38fab5a38577b69c241cd90f41153e24be5c7097ab71c has active endpoints
        
--- FAIL: TestComposeDownRemoveOrphans (23.30s)

@stillfox-lee
Copy link
Contributor Author

test-integration-docker-compatibility seems failing

=== RUN   TestComposeDownRemoveOrphans
    compose_down_linux_test.go:54: projectName="nerdctl-compose-test-1662693203"
    compose_down_linux_test.go:61: assertion failed: res.ExitCode is not exitCode: Stopping nerdctl-compose-test-1662693203_test_1 ... 
        Stopping nerdctl-compose-test-1662693203_test_1 ... done
        Found orphan containers (nerdctl-compose-test-1662693203_orphan_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
        Removing nerdctl-compose-test-1662693203_test_1 ... 
        Removing nerdctl-compose-test-1662693203_test_1 ... done
        Removing network nerdctl-compose-test-1662693203_default
        error while removing network: network nerdctl-compose-test-1662693203_default id b2cad4ddcb3f07d66fe38fab5a38577b69c241cd90f41153e24be5c7097ab71c has active endpoints
        
--- FAIL: TestComposeDownRemoveOrphans (23.30s)

@AkihiroSuda Thanks for your help. I think the main reason is the different behavior of docker and nerdctl. Could your please take a look at this scenario?

@AkihiroSuda
Copy link
Member

AkihiroSuda commented Dec 21, 2022

Is this still draft?

Looks good but needs squashing commits

@djdongjin
Copy link
Member

maybe also rebase to get the fix for flaky tests

@stillfox-lee
Copy link
Contributor Author

@AkihiroSuda @djdongjin Hi, sorry for the delay. PTAL.

@stillfox-lee stillfox-lee marked this pull request as ready for review December 26, 2022 14:31
@AkihiroSuda
Copy link
Member

Please squash commits

@AkihiroSuda AkihiroSuda added this to the v1.2.0 milestone Dec 27, 2022
@stillfox-lee
Copy link
Contributor Author

@AkihiroSuda I used git rebase -i to squash into one commit, but didn't expect to get this result. What should I do now? Execute git rest by reflog to reverse?

@djdongjin
Copy link
Member

@stillfox-lee can you try this and see if it works?

First update your local main branch (git checkout main; git pull upstream main)

Then rebase this branch and resolve conflict (git checkout compose/down-remove-orphans; git rebase main)

Otherwise, maybe you can also try create a new local branch and cherrypick your own commit to the new branch and force push from the new local branch to the old remote branch.

Signed-off-by: Siyi Liao <stillfox.lee@gmail.com>
@stillfox-lee
Copy link
Contributor Author

Otherwise, maybe you can also try create a new local branch and cherrypick your own commit to the new branch and force push from the new local branch to the old remote branch.

@djdongjin It works! Thanks a lot.

@stillfox-lee
Copy link
Contributor Author

By the way, how should I squash commits in this case (merged main branch already)?

@djdongjin
Copy link
Member

By the way, how should I squash commits in this case (merged main branch already)?

Personally I don't use merge much and use more rebase, so in my case (assume I create 5 commits):

# update local main
git checkout main
git pull upstream main
# rebase dev branch, so my 5 commits are on the top
git checkout dev
git rebase main
# squash / interactively rebase the latest 5 commits
git rebase -i HEAD~5

@stillfox-lee
Copy link
Contributor Author

By the way, how should I squash commits in this case (merged main branch already)?

Personally I don't use merge much and use more rebase, so in my case (assume I create 5 commits):

# update local main
git checkout main
git pull upstream main
# rebase dev branch, so my 5 commits are on the top
git checkout dev
git rebase main
# squash / interactively rebase the latest 5 commits
git rebase -i HEAD~5

Got it. Thanks.

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda AkihiroSuda merged commit 03461fa into containerd:main Dec 29, 2022
@stillfox-lee stillfox-lee deleted the compose/down-remove-orphans branch December 30, 2022 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

compose down --remove-orphans
3 participants