Skip to content

fix: nerdctl ps filter --status=created #4196

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

Merged
merged 1 commit into from
May 7, 2025

Conversation

Shubhranshu153
Copy link
Contributor

Issue:

sudo nerdctl ps -a --filter status=created
INFO[0000] containers %v[0xc0000e2000 0xc0000e20e0 0xc0000e21c0 0xc0000e22a0 0xc0000e2380 0xc0000e2460 0xc0000e2540 0xc0000e2620 0xc0000e2700] 
INFO[0000] filters %v[0xc0000e2000 0xc0000e20e0 0xc0000e21c0 0xc0000e22a0 0xc0000e2380 0xc0000e2460 0xc0000e2540 0xc0000e2620 0xc0000e2700] 
WARN[0000] no running task found: task 53fac80968c8b2f86a12bd5b8e99a043b80f5a7b2287b1e4e4db66f968a905ee not found 
WARN[0000] no running task found: task a250bf16efad4a9c2db89e82d76cdee1a466492d50a3411aa3da4276e1bc4ea8 not found 
WARN[0000] no running task found: task dc1e36498cefa97d40e9bdfea044365e836f9e711e24807b221dc64cbed34a48 not found 
WARN[0000] no running task found: task e97a33181bf251204fbb476ae10945e09269a01a938fcd861a1a14c31ca993c4 not found 
WARN[0000] no running task found: task eedd262ef9933cad2d04579355dd64287e46b948a997d90329f71888c882a24a not found 
INFO[0000] matches %v[]                                 
CONTAINER ID    IMAGE    COMMAND    CREATED    STATUS    PORTS    NAMES

Fix:

INFO[0000] contianer created                            
CONTAINER ID    IMAGE                                   COMMAND                   CREATED              STATUS     PORTS                                               NAMES
eedd262ef993    docker.io/library/alpine:latest         "/bin/sh"                 About an hour ago    Created                                                        test1
dc1e36498cef    docker.io/jenkins/jenkins:lts-jdk17     "/usr/bin/tini -- /u…"    6 hours ago          Created    0.0.0.0:8088->8080/tcp, 0.0.0.0:50000->50000/tcp    jenkins-dc1e3
a250bf16efad    docker.io/jenkins/jenkins:lts-jdk17     "/usr/bin/tini -- /u…"    6 hours ago          Created    0.0.0.0:8088->8080/tcp, 0.0.0.0:50000->50000/tcp    jenkins-a250b
e97a33181bf2    docker.io/jenkins/jenkins:lts-jdk17     "/usr/bin/tini -- /u…"    6 hours ago          Created    0.0.0.0:8088->8080/tcp, 0.0.0.0:50000->50000/tcp    jenkins-e97a3
53fac80968c8    docker.io/portainer/portainer:latest    "/portainer"              2 days ago           Created    0.0.0.0:9000->9000/tcp                              portainer-53fac
[shubhum@lima-finch nerdctl]$ sudo nerdctl ps -a --filter status=created --filter name=test1
INFO[0000] checking                                     
INFO[0000] contianer created                            

@Shubhranshu153
Copy link
Contributor Author

@apostasie
While solving for create issue found this issue as i wanted to use this filter status=created, pushing this fix out first.

@Shubhranshu153 Shubhranshu153 force-pushed the fix-nerdctl-ps-filter branch 2 times, most recently from 828ce70 to 31633cc Compare May 5, 2025 23:24
@Shubhranshu153 Shubhranshu153 changed the title fix: test nerdctl ps filter fix: nerdctl ps filter --status=created May 5, 2025
@Shubhranshu153 Shubhranshu153 force-pushed the fix-nerdctl-ps-filter branch 5 times, most recently from ab81f1e to 58d90e5 Compare May 6, 2025 03:57
@Shubhranshu153
Copy link
Contributor Author

@AkihiroSuda @apostasie
this fixes:

  1. [CI]: failure nerdctl - TestCreate/logs appears to be flaky #3717
  2. status=created filter

Seems CI/CD is somewhat stable, the gomodjail i dont understand atm.

@Shubhranshu153
Copy link
Contributor Author

The logs after start with -a seems to not get handled correctly so changed the test as it was testing the create functionality.

@AkihiroSuda AkihiroSuda added this to the v2.1.0 milestone May 6, 2025
@Shubhranshu153 Shubhranshu153 force-pushed the fix-nerdctl-ps-filter branch 2 times, most recently from 2967ba5 to 1368b12 Compare May 6, 2025 13:22
@Shubhranshu153 Shubhranshu153 reopened this May 6, 2025
@apostasie
Copy link
Contributor

@AkihiroSuda @apostasie this fixes:

  1. [CI]: failure nerdctl - TestCreate/logs appears to be flaky #3717
  2. status=created filter

Seems CI/CD is somewhat stable, the gomodjail i dont understand atm.

Thanks a lot for engaging with these @Shubhranshu153 - really appreciated.

Gomodjail issue is likely AkihiroSuda/gomodjail#50 - gomodjail does self-unpack (the actual executable and go.mod), but this is not currently done in a safe way (needs to use flock to prevent concurrent access).

On your last run, I see an unrelated rekor error, some windows non-sense - and the event filter issue.

I think we should have this patch here asap (cc @AkihiroSuda).

@AkihiroSuda
Copy link
Member

The current CI failures do not seem related to gomodjail

@apostasie
Copy link
Contributor

The current CI failures do not seem related to gomodjail

They are not on the last run (they are a rekor issue, windows, and the event one on EL)

@Shubhranshu153 Shubhranshu153 force-pushed the fix-nerdctl-ps-filter branch from 1368b12 to 4b50d62 Compare May 6, 2025 17:19
@Shubhranshu153
Copy link
Contributor Author

@AkihiroSuda @apostasie Refactored the events test a bit lets see

@Shubhranshu153 Shubhranshu153 force-pushed the fix-nerdctl-ps-filter branch from 4b50d62 to cf7781b Compare May 6, 2025 17:38
@@ -47,23 +48,16 @@ func TestCreate(t *testing.T) {
{
Copy link
Contributor

Choose a reason for hiding this comment

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

@Shubhranshu153 we should remove testCase.Require = nerdtest.IsFlaky("https://github.com/containerd/nerdctl/issues/3717") just above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes we should i want to see it a few more runs and would remove
I still think gomodjail has issues. and is flaky.

Copy link
Contributor

Choose a reason for hiding this comment

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

Commit 4 in this PR should workaround gomodjail unpack issue: #4199

Copy link
Contributor

Choose a reason for hiding this comment

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

@Shubhranshu153 so, the presence of testCase.Require = nerdtest.IsFlaky will make it automatically retry in case of failure, which will "hide" them... What I am suggesting is that we remove it now so that you get accurate feedback from the CI on whether this is fixed or not.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, wrong PR linked. gomodjail workaround is here: #4198

Copy link
Contributor

Choose a reason for hiding this comment

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

The other (wrongly) mentioned PR would alleviate the Windows failure you are hitting on your last run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i got confused as it seems unrelated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great, lot of good fixes are going in to make the CI more resiliant.
have few PR's approved but pending successful runs so would like the fixes in to have a successful run.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed!
And thanks again for engaging on that.

@AkihiroSuda pending green and review of course, it would be really nice to have #4198, #4199, and this here, at your convenience - that should reduce a good chunk of flakyness and frustration :-).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This looks good now.

Signed-off-by: Shubharanshu Mahapatra <[email protected]>
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 0cd6b6c into containerd:main May 7, 2025
37 checks passed
@Shubhranshu153 Shubhranshu153 deleted the fix-nerdctl-ps-filter branch May 7, 2025 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants