-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Update gradle extraDirectory config parameter to include path and permissions field #1178
Conversation
I wonder how this will look like in Maven, because currently for other maps, an HTML tag name works as a key to the maps. But obviously we can't do Assuming that this will break the existing users who configured |
Judging by the original comment, I think we can make the map an alternating list style sort of thing: <extraDirectory>
<path>extra/dir/path</path>
<permissions>
<file>/path/file1</file>
<mode>755</mode>
<file>/path/file2</file>
<mode>755</mode>
</permissions>
</extraDirectory>
Yeah, I think I would have liked to deprecate the parameter first, but considering we're keeping the parameter and just changing its type I wasn't sure how the best way to do this. |
A slight correction on the Maven config, but otherwise looks good: <extraDirectory>
<path>extra/dir/path</path>
<permissions>
<permission>
<file>/path/file1</file>
<mode>755</mode>
</permission>
<permission>
<file>/path/file2</file>
<mode>755</mode>
</permission>
</permissions>
</extraDirectory> I think for Gradle, we could actually support both the use of |
Hmmm I just noticed that changing permissions in the build file without changing anything in the extra directory itself causes the extra layer to not be updated because file permissions aren't cached. Edit: still works with |
Have updated to support both |
Good catch, we'll need to update the selector to include permissions then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will have someone else do the final approval.
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoryParameters.java
Show resolved
Hide resolved
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/ExtraDirectoryParameters.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'll just do an actual test real quick.
@@ -184,5 +187,23 @@ public static ImageReference getGeneratedTargetDockerTag( | |||
return ImmutableList.copyOf(items); | |||
} | |||
|
|||
/** | |||
* Validates and converts a {@code String->String} map to an {@code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's mention that the input map is a file-path-to-file-permission map. Without any context, it's not clear what the map is about.
...gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleLayerConfigurations.java
Show resolved
Hide resolved
...gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleLayerConfigurations.java
Show resolved
Hide resolved
...gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/GradleLayerConfigurations.java
Show resolved
Hide resolved
* @param extraDirectory path to the source directory for the extra files layer | ||
* @param permissions map from path on container to file permissions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's mention this applies only to the files from extraDirectory
.
Toward #794
extraDirectory
configuration parameter is now an object with apath
andpermissions
field, instead of just being a fileextraDirectory.path
covers the original purpose ofextraDirectory
extraDirectory.permissions
is a map from path on container to an octal string representation of the file's permission bitsFor example, if your extra directory is
(project dir)/src/main/custom-jib
, and you want to give executable permissions topath/to/file1
andpath/to/file2
within, you would add this configuration to yourbuild.gradle
:The old method of configuring the extra directory is also still supported: