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

Make .CreatedAt and other timestamps time.Time types #1266

Closed
KenYN opened this issue Jan 7, 2019 · 4 comments
Closed

Make .CreatedAt and other timestamps time.Time types #1266

KenYN opened this issue Jan 7, 2019 · 4 comments

Comments

@KenYN
Copy link

KenYN commented Jan 7, 2019

I recently posted this question to StackOverflow about formatting timestamp output from:

buildah images --format '{{.CreatedAt}}' my_image

But I was informed that .CreatedAt is a string, so I was out of luck. The string is also not localised and is missing timezone information, so even as it is it is not terribly useful. The recommendation given was to request an extra CreatedAtTime time.Time field that would allow users to format however they needed. (Specifically, I want to add a check to my buildah scripts to skip processing if the script is older than the image)

This is my contribution to the call for discussion in #537 (comment).

@vrothberg
Copy link
Member

@TomSweeneyRedHat @rhatdan PTAL

It may also affect Podman (Cc @baude @mheon)

@rhatdan
Copy link
Member

rhatdan commented Jan 8, 2019

This is a good idea.

@TomSweeneyRedHat TomSweeneyRedHat self-assigned this Jan 8, 2019
@TomSweeneyRedHat
Copy link
Member

TomSweeneyRedHat commented Jan 8, 2019

@KenYN I'm hesitant to change the format of the timestamp as it is now. But I'd be OK with adding a new field for them, basically appending "Raw" to it, so you can do:

# buildah images --format '{{.ID}} {{.CreatedAtRaw}}'
3f53bb00af943dfdf815650be70c0fa7b426e56a66f5e3362b47a129d57d5991 2018-12-20 19:21:30.122610396 -0500 EST
8e09da8f6701d7cde1526d79e3123b0f1109b78d925dfe9f9bac6d59d702a390 2019-01-08 09:22:52.330623532 -0500 EST

I'm going to assume this would be useful and will get a PR together for the image side of things anyway and we can then move on to containers and Podman.

TomSweeneyRedHat added a commit to TomSweeneyRedHat/buildah that referenced this issue Jan 9, 2019
Signed-off-by: TomSweeneyRedHat <[email protected]>

This adds the ability to see a "raw" date format for the CreatedAt field rather than the pretty formatted variety.

Wit this in place the files will print thusly:

.CreatedAt: "Jan 8, 2019 09:22"
.CreatedAtRaw: "2019-01-08 09:22:52.330623532 -0500 EST"

This hopefully at least partially addresses containers#1266
Once agreed to, we might want to do a similar thing for buildah containers and then in similar commands in Podman.
rh-atomic-bot pushed a commit that referenced this issue Jan 9, 2019
Signed-off-by: TomSweeneyRedHat <[email protected]>

This adds the ability to see a "raw" date format for the CreatedAt field rather than the pretty formatted variety.

Wit this in place the files will print thusly:

.CreatedAt: "Jan 8, 2019 09:22"
.CreatedAtRaw: "2019-01-08 09:22:52.330623532 -0500 EST"

This hopefully at least partially addresses #1266
Once agreed to, we might want to do a similar thing for buildah containers and then in similar commands in Podman.

Closes: #1269
Approved by: rhatdan
@TomSweeneyRedHat
Copy link
Member

@KenYN We've created the CreatedAtRaw field for images with #1269 and I think the other dates we're displaying are fine. If you think we need further work here, please re-open and let us know which field(s) is problematic for you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants