docker-workflow-plugin icon indicating copy to clipboard operation
docker-workflow-plugin copied to clipboard

JENKINS-57589 Fix parsing of container creation date

Open rufoa opened this issue 5 years ago • 7 comments

Thought I'd fix this outstanding TODO

rufoa avatar May 21 '19 22:05 rufoa

JIRA issue here

rufoa avatar May 21 '19 23:05 rufoa

cc @jglick who was involved in the related PR https://github.com/jenkinsci/docker-workflow-plugin/pull/15: PTAL

rufoa avatar May 22 '19 00:05 rufoa

(3 months without response)

@dwnusbaum PTAL. Thanks

rufoa avatar Aug 24 '19 05:08 rufoa

@rufoa Thanks for the PR! Can you add a regression test for the bug?

dwnusbaum avatar Aug 26 '19 13:08 dwnusbaum

All done I think

rufoa avatar Aug 26 '19 21:08 rufoa

@dwnusbaum thanks for volunteering to review this Devin - could you check it over when you get a minute please? The changes are pretty straightforward.

rufoa avatar Nov 11 '19 00:11 rufoa

The fix seems simple/fine, but I don't really understand the impact (is the creation date even used for anything now that fingerprinting is disabled by default? Was it ever used?).

IIRC the problem surfaced because I was using this plugin with podman (rather than Docker) and the timestamps it exposes via podman inspect, although ISO 8601 compliant, don't conform to the more restrictive assumptions made by this plugin's old code, causing it to throw an exception.

I believe (can't easily check, sorry) that Docker outputs timestamps pre-converted to UTC, whereas podman outputs them in the system's TZ. The old code assumed that removing the final character from the timestamp would be harmless (because in UTC this is always just Z), so it choked on non-UTC timestamps which end with e.g. -0700.

It looks like the PR could still use a regression test that deals with time zones specifically (unless the changes to DockerClientTest fail without the fix?).

Unfortunately because Docker always returns timestamps in UTC, you can't really test for the actual bug unless you start running your tests against podman (in a non-UTC tz) as well. :man_shrugging:

I tightened up the tests while I was here, but you're correct that they won't actually catch a regression.

rufoa avatar Nov 12 '19 19:11 rufoa