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

jib:build is not reproducible due to directory timestamps not being set #1648

Closed
eisig opened this issue Apr 19, 2019 · 9 comments · Fixed by #1649
Closed

jib:build is not reproducible due to directory timestamps not being set #1648

eisig opened this issue Apr 19, 2019 · 9 comments · Fixed by #1649
Assignees

Comments

@eisig
Copy link

eisig commented Apr 19, 2019

Description of the issue:
When I build the code in container, it will rebuild all the layer every time.

Expected behavior:
I don’t have to wait for Docker to rebuild your entire Java application - just deploy the layers that changed.
Steps to reproduce:

  1. clone https:/GoogleContainerTools/jib.git , cd to examples/spring-boot
  2. build with:
docker run -v `pwd`:/tmp/build -w /tmp/build -v $HOME/.m2:/root/.m2 maven:3-jdk-8 mvn clean compile jib:build -Djib.from.image=openjdk:8-alpine -Dimage=<myimage>
  1. docker pull the new image. I have to pull all the 3 layers, include the 14.38MB dependency layer every time .

Environment:
macos 10.14.3, docker Version 2.0.0.3

@loosebazooka
Copy link
Member

Can you run docker history on the image to see if the digests are actually different?

@chanseokoh
Copy link
Member

Seems like a critical bug. Timestamps of directories are not set to the epoch+1 sec.

examples/spring-boot$ tar tvf target/jib-cache/layers/01*/f8*
drwxr-xr-x 0/0               0 2019-04-19 13:28 app/
drwxr-xr-x 0/0               0 2019-04-19 13:28 app/classes/
drwxr-xr-x 0/0               0 1969-12-31 19:00 app/classes/hello/
-rw-r--r-- 0/0             699 1969-12-31 19:00 app/classes/hello/Application.class
-rw-r--r-- 0/0             594 1969-12-31 19:00 app/classes/hello/HelloController.class

We need to track down since when this started to happen.

@chanseokoh
Copy link
Member

It doesn't have to run inside the container to reproduce.

@loosebazooka loosebazooka self-assigned this Apr 19, 2019
@loosebazooka
Copy link
Member

@loosebazooka
Copy link
Member

Moving the time code in the link above doesn't account for parent directories added with uniqueTarArchiveEntries.add(entry);

@chanseokoh
Copy link
Member

Gosh. That explains it. That is in 1.1.0.

@chanseokoh chanseokoh changed the title jib:build is not reproducible in container jib:build is not reproducible due to directory timestamps not being set Apr 19, 2019
@loosebazooka
Copy link
Member

okay, fix is coming, behavior:

  • By default timestamp will be epoch+1.second
  • Order matters in layerEntries: to correctly configure a directory it must come before any file that exists in it, otherwise it will get default properties.

@loosebazooka
Copy link
Member

@eisig thanks again for reporting this. We just released 1.1.2 with the fix.

@eisig
Copy link
Author

eisig commented Apr 19, 2019

Great 👍

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

Successfully merging a pull request may close this issue.

3 participants