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 cli to list imagerunner containers #880

Merged
merged 3 commits into from
Jan 29, 2024
Merged

feat: Add cli to list imagerunner containers #880

merged 3 commits into from
Jan 29, 2024

Conversation

tianfeng92
Copy link
Contributor

@tianfeng92 tianfeng92 commented Jan 27, 2024

Proposed changes

Add cli to list containers:

$ saucectl imagerunner list -o text
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ID                                Image                                            Status     CreationTime               TerminationTime           │
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ 44d3a9a52d0c4df2ba56f5900d42805d  saucelabs/imagerunner-playwright-example:latest  Cancelled  2024-01-25T17:03:07-08:00  2024-01-25T17:03:18-08:00 │
│ b8b79cd4e2fe4c6b9bab2924fb56821e  saucelabs/imagerunner-playwright-example:latest  Succeeded  2024-01-25T16:23:47-08:00  2024-01-25T16:24:38-08:00 │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

JSON output

{
  "content": [
    {
      "id": "44d3a9a52d0c4df2ba56f5900d42805d",
      "status": "Cancelled",
      "image": "saucelabs/imagerunner-playwright-example:latest",
      "creation_time": 1706230987,
      "termination_time": 1706230998
    },
    {
      "id": "14c42f8a5fa3402996139d5952e18f8f",
      "status": "Cancelled",
      "image": "saucelabs/imagerunner-playwright-example:latest",
      "creation_time": 1706230986,
      "termination_time": 1706230998
    }
  ]
}

It supports text and json output formats. But there's a difference due to the SO backend API's behavior: it provides CreationTime and TerminationTime as Unix timestamps.

  • text: CreationTime and TerminationTime are converted to RFC3339 format. More human-readable.
  • json: These timestamps are kept as Unix timestamps, as returned by the SO backend API.

The discrepancy between the formats is due to the SO backend API exclusively providing Unix timestamps. I'm open to suggestions for improving these output formats.


This description explains the reasoning behind the different timestamp formats in text and json outputs and invites feedback on this implementation.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have updated the json schema (if appropriate)

Further comments

@tianfeng92 tianfeng92 added the enhancement New feature or request label Jan 27, 2024
@tianfeng92 tianfeng92 marked this pull request as ready for review January 27, 2024 02:38
@tianfeng92 tianfeng92 requested a review from a team as a code owner January 27, 2024 02:38
@tianfeng92 tianfeng92 merged commit cebc172 into main Jan 29, 2024
18 checks passed
@tianfeng92 tianfeng92 deleted the DEVX-2742 branch January 29, 2024 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants