Skip to content

Add new build parameter: "defaultExclusion" - #1707

Merged
rohanKanojia merged 1 commit into
fabric8io:masterfrom
thuva9872:fixDefaultExclusion
Oct 23, 2023
Merged

rohanKanojia merged 1 commit into
fabric8io:masterfrom
thuva9872:fixDefaultExclusion

Conversation

@thuva9872

@thuva9872 thuva9872 commented Sep 26, 2023 •

Copy link
Copy Markdown
Contributor

This commit introduces a new build parameter, "defaultExclusion," within the build properties of the plugin. The current behavior of the plugin is to build a Docker archive with default exclusion rules, which exclude hidden files. However, the Docker CLI includes hidden files by default.

With the addition of the "defaultExclusion" parameter, users can now control whether hidden files should be excluded during the Docker archive build process. This parameter provides flexibility and allows users to align the plugin's behavior with their specific requirements.

Fixes: #1708

@codecov

codecov Bot commented Sep 26, 2023 •

Copy link
Copy Markdown

Codecov Report

Merging #1707 (4d0a73a) into master (522cb80) will increase coverage by 0.01%.
The diff coverage is 85.71%.

❗ Current head 4d0a73a differs from pull request most recent head 8f5e5f2. Consider uploading reports for the commit 8f5e5f2 to get more accurate results

@@             Coverage Diff              @@
##             master    #1707      +/-   ##
============================================
+ Coverage     65.09%   65.11%   +0.01%     
- Complexity     2251     2253       +2     
============================================
  Files           172      172              
  Lines         10102    10109       +7     
  Branches       1390     1390              
============================================
+ Hits           6576     6582       +6     
  Misses         2977     2977              
- Partials        549      550       +1     
Files Coverage Δ
...8/maven/docker/assembly/DockerAssemblyManager.java 55.78% <100.00%> (+0.15%) ⬆️
...aven/docker/config/handler/property/ConfigKey.java 100.00% <100.00%> (ø)
...config/handler/property/PropertyConfigHandler.java 86.08% <100.00%> (+0.04%) ⬆️
...8/maven/docker/config/BuildImageConfiguration.java 84.94% <75.00%> (-0.16%) ⬇️

// using dir dir mode
excludeDockerfile(fileSet, dockerFile);

fileSet.setUsingDefaultExcludes(buildConfig.defaultExclusion());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might consider to set this always to "false", as IMO this is the sensible behaviour (and usually it also doesn't harm except that it might increase the performance slightly).

@rhuss

rhuss commented Sep 27, 2023

Copy link
Copy Markdown
Collaborator

Thanks for the PR! We might even want to fix it without config changes, please see the discussion on the issue.


//Default file exclusions
@Parameter
private Boolean defaultExclusion;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we go forward with this PR, I would use useDefaultExcludes as option, much like the property on the fileset, as this better reflects the boolean nature of this flag.

@thuva9872
thuva9872 force-pushed the fixDefaultExclusion branch 2 times, most recently from 7e17317 to ef8515c Compare October 2, 2023 09:21
This commit introduces a new build parameter, "defaultExclusion," within the build properties of the plugin. The current behavior of the plugin is to build a Docker archive with default exclusion rules, which exclude hidden files. However, the Docker CLI includes hidden files by default.

With the addition of the "defaultExclusion" parameter, users can now control whether hidden files should be excluded during the Docker archive build process. This parameter provides flexibility and allows users to align the plugin's behavior with their specific requirements.
@thuva9872
thuva9872 force-pushed the fixDefaultExclusion branch from ef8515c to 8f5e5f2 Compare October 2, 2023 09:33
@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2023

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

88.9% 88.9% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.20.1) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

@rhuss

rhuss commented Oct 3, 2023

Copy link
Copy Markdown
Collaborator

Thanks a lot, looks good to me. One last little thing to add to the documentation, then we can merge it.

@thuva9872

Copy link
Copy Markdown
Contributor Author

Thanks a lot, looks good to me. One last little thing to add to the documentation, then we can merge it.

I already added the new configuration in the build configuration documentation. Do I need to add anything else?

@rhuss

rhuss commented Oct 4, 2023

Copy link
Copy Markdown
Collaborator

Please add the configuration property to src/main/asciidoc/inc/external/_property_configuration.adoc, too (mind the alphabetical order of the properties, too)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Need a property to handle default file exclusions while building images

3 participants