Closed
Description
Environment:
- Jib version: 3.1.4
- Build tool: Maven 3.6.2
Description of the issue:
<configuration>
<extraDirectories>
<paths>
<path>missing/folder</path>
</paths>
</extraDirectories>
</configuration>
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 a Dockerfile
has a command to copy a non-existent folder:
=> ERROR [stage-1 2/2] COPY missing/folder /app 0.0s
------
> [stage-1 2/2] COPY missing/folder /app:
------
failed to compute cache key: "/missing/folder" not found: not found
Activity
meltsufin commentedon Jan 4, 2022
Thank you for submitting this enhancement request.
chanseokoh commentedon Jan 4, 2022
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.tommysitu commentedon Jan 14, 2022
Hi @chanseokoh I've raised a PR. Could you approve the build? so that we can see which tests are failing. Thanks!
chanseokoh commentedon Jan 14, 2022
@tommysitu I just approved it.
tommysitu commentedon Jan 19, 2022
Thanks for reviewing the PR @chanseokoh. Shall I close this issue?
chanseokoh commentedon Jan 26, 2022
From Jib Gitter:
One workaround in Gradle I can think of is to create it explicitly:
cebrailinanc commentedon Feb 9, 2024
i got error on gradle
Execution failed for task ':jib'.
my command:
./gradlew jib ... -Djib.extraDirectories.paths=truststore,/aass/test
chanseokoh commentedon Feb 9, 2024
@cebrailinanc just create the directory before running Gradle, like
mkdir /aass/test
.cebrailinanc commentedon Feb 9, 2024
I tried but it didn't work. Because we need to open a folder within the image.
chanseokoh commentedon Feb 9, 2024
Oh, I see what you were thinking. It must be that you thought the syntax of the command-line parameter would be
, but the command-line supports only the basic form of
. If you want to specify the
to
directories, you have to set it in a Gradle build file.cebrailinanc commentedon Feb 9, 2024
i think, it's not useful,
Should we open an issue?
chanseokoh commentedon Feb 9, 2024
Sure, go ahead open a new issue.
chanseokoh commentedon Feb 9, 2024
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.cebrailinanc commentedon Feb 9, 2024
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.