Closed tommysitu closed 2 years ago
Thank you for submitting this enhancement request.
The reason we don't check the existence is due to the default implicit directory src/main/jib
, which doesn't exist often. Perhaps we should fail only for non-default directories. Contributions are welcome.
Hi @chanseokoh I've raised a PR. Could you approve the build? so that we can see which tests are failing. Thanks!
@tommysitu I just approved it.
Thanks for reviewing the PR @chanseokoh. Shall I close this issue?
From Jib Gitter:
extraDirectories now have to be present while running the jib plugin. I have some directories which might be generated during the build process (depending on the situation). How can we deal with such situation? Checking for the existence of the file does not work since the
extraDirectories
setting is evaluated during the Configuration Stage of the plugin, when the directory is not present yet.
One workaround in Gradle I can think of is to create it explicitly:
extraDirectories {
mkdir "${buildDir}/jib-extras"
paths = ["${buildDir}/jib-extras"]
}
i got error on gradle Execution failed for task ':jib'.
extraDirectories.paths contain "from" directory that doesn't exist locally: /aass/test
my command: ./gradlew jib ... -Djib.extraDirectories.paths=truststore,/aass/test
@cebrailinanc just create the directory before running Gradle, like mkdir /aass/test
.
I tried but it didn't work. Because we need to open a folder within the image.
Oh, I see what you were thinking. It must be that you thought the syntax of the command-line parameter would be
-Djib.extraDirectories.paths=<from_1>,<to_1>,<from_2>,<to_2>,...
, but the command-line supports only the basic form of
-Djib.extraDirectories.paths=<from_1>,<from_2>,<from_3>,...
. If you want to specify the to
directories, you have to set it in a Gradle build file.
i think, it's not useful, Should we open an issue?
Sure, go ahead open a new issue.
Anyways, if you are familiar with Gradle, you can always define your own property as a workaround to templatize to
directiories on the command-line.
I used it by defining it in the build.gradle
. But it would be usable to add the command line in the future, thank you.
jib {
extraDirectories {
paths {
path {
setFrom("extra")
into = "/aass/test"
}
}
}
}
Environment:
Description of the issue:
Using the
extraDirectories
config above to copy additional files doesn't fail the build even the path is invalid or not a folder. This behaviour is not good for catching bugs early if the additional files are crucial for the docker container.Expected behaviour: Should be similar to the
docker build
command which would throw the following exception if aDockerfile
has a command to copy a non-existent folder: