jib icon indicating copy to clipboard operation
jib copied to clipboard

extraDirectories directory that doesn't exist locally: in command-line(-Djib.extraDirectories.paths)

Open cebrailinanc opened this issue 1 year ago • 1 comments

Environment:

  • Jib version: 3.4.0
  • Build tool: Gradle
  • OS: macos

Description of the issue: I get an error when I try to build with the command line. Parameter -Djib.extraDirectories.paths parse incorrectly. This code only receiving as from. Value of into always is '/'

Command:

./gradlew jibDockerBuild --image=poc-jib:latest -Djib.from.image=openjdk:21-slim -Djib.extraDirectories.paths='extra, /var/temp'

discussed here

Expected behavior: should have copied the files in the extra to /var/temp

Steps to reproduce:

  1. I created a sample project (https://github.com/cebrailinanc/jib-demo)

Log output:

  • What went wrong: Execution failed for task ':jibDockerBuild'. extraDirectories.paths contain "from" directory that doesn't exist locally: /var/temp

cebrailinanc avatar Feb 09 '24 21:02 cebrailinanc

Hey I want to support this issue, given this comment I think we should be able to set to from the CLI too, currently it's not possible, e.g.

What I tried (all below not working), any option I'd expect to work to set both from and to from the CLI parameter:

# expect /app/config is in the image

./gradlew jibDockerBuild  -Djib.extraDirectories.paths='/Users/artemptushkin/foo/config,/app/config'

./gradlew jibDockerBuild  -Djib.extraDirectories.paths.path.from='/Users/artemptushkin/foo/config' -Djib.extraDirectories.paths.path.to='/app/config'

./gradlew jibDockerBuild -Djib.extraDirectories.paths=['/Users/artemptushkin/gitlab/IptiQ/dx/kotlin-app-example/config','/app/config']

What works is just from:

./gradlew jibDockerBuild  -Djib.extraDirectories.paths='/Users/artemptushkin/foo/config'

All the files and directories from foo/config will be in the root of the image. We can use it still make more directories in from so we emulate the path in the target image, e.g.

from:

  • /Users/artemptushkin/foo/config/app/test -> expect /app/test directory in the image

If it's should be another issue - let me know, I will create one

artemptushkin avatar Mar 06 '24 08:03 artemptushkin