question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Working with a TarImage fails if the tar does not contain explicit directory entries

See original GitHub issue

Environment:

  • Jib version: 0.11.0
  • Build tool: jib-core
  • OS: Linux

Description of the issue: Jib cannot containerize or use as a base an image tar file built by Bazel’s rules_docker. Because the tar file does not contain explicit entries for the directory structure (i.e. the file <hash>/VERSION is declared, but not the directory <hash>/), Jib’s TarExtractor fails when trying to copy to its temporary extract path any TarEntry files which are in subdirectories.

Expected behavior: Jib Core is able to unpack and work with layers from a tar built by Bazel.

Steps to reproduce:

  1. Build a docker image tar using Bazel: bazel build :test_image.tar
  2. Try to push the image with Jib.from(TarImage.at(testImage)).containerize(...)

Log output: Example from a test:

Caused by: java.nio.file.NoSuchFileException: /dev/shm/bazel-sandbox.4e8f4b3b8db28de924ca33f45be42f6d/linux-sandbox/582/execroot/com_cgi_eoss_gaiascope/_tmp/42f1ca17bd58950223768ec9be1efd40/jib-extract-tar4907815467966721691/a815cab1da47c1b1e40f68e08b42c6142de5a555445df26ff05e4be1a2915454/VERSION
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
	at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434)
	at java.nio.file.Files.newOutputStream(Files.java:216)
	at com.google.cloud.tools.jib.tar.TarExtractor.extract(TarExtractor.java:61)
	at com.google.cloud.tools.jib.builder.steps.ExtractTarStep.call(ExtractTarStep.java:111)
	at com.google.cloud.tools.jib.builder.steps.StepsRunner.lambda$extractTar$4(StepsRunner.java:253)
	... 6 more

Additional Information: I have a naive fix locally, which solves the issue: https://github.com/Zetten/jib/commit/426b5a34bf9620a00eaa4d07bf7f4e7a9c3d9afd

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Zettencommented, Oct 16, 2019

Hi @TadCordle, your PR branch works perfectly in my project.

Thanks very much!

0reactions
chanseokohcommented, Oct 18, 2019

@Zetten we’ve released jib-core 0.12.0 with this fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maven assembly plugin not creating tar files with directory ...
I'm trying to use the assembly plugin to build a tar file, but it looks like the generated file does not always include...
Read more >
Tar (computing) - Wikipedia
In computing, tar is a computer software utility for collecting many files into one archive file, often referred to as a tarball, for...
Read more >
tar exits on "Cannot stat: No such file of directory", why?
With a hyphen, the argument for the -f option is z . So the command is in effect trying to archive dvr_rdk_v1.tar.gz and...
Read more >
tar Man Page - Linux - SS64.com
If no file arguments are given, extract all the files in the archive. ... If the archive contains multiple entries corresponding to the...
Read more >
tarfile — Read and write tar archive files ... - Python Docs
This is done to work around two problems: A directory's modification time is reset each time a file is created in it. And,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found