-
Notifications
You must be signed in to change notification settings - Fork 166
[JENKINS-63587] Allow disabling Ant default excludes in the zip step #180
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
Conversation
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.
Missing documentation
See https://github.com/jenkinsci/pipeline-utility-steps-plugin/tree/master/src/main/resources/org/jenkinsci/plugins/pipeline/utility/steps/zip/ZipStep and https://github.com/jenkinsci/pipeline-utility-steps-plugin/tree/master/src/main/resources/org/jenkinsci/plugins/pipeline/utility/steps/tar/TarStep Also if this only applies to zip files then the parameter should be added to that step, not the abstract step that also is used by |
It is only applies to zip files. |
Done. Added in code itself. is that fine? |
You also need to add a |
Done |
@rsandell not sure why build is failing. Can you help? |
Looks like an update of the build library causing javadoc generation to run and fail, not your fault. |
@rsandell If PR looking good, can that be merged? |
.../resources/org/jenkinsci/plugins/pipeline/utility/steps/zip/ZipStep/help-defaultExclude.html
Outdated
Show resolved
Hide resolved
src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/AbstractFileCompressStep.java
Show resolved
Hide resolved
Looks like the build failure is caused by a Javadoc error:
|
PS You can test Javadoc generation locally by running |
Thanks for the pointer. Fixed it. |
@@ -75,10 +75,13 @@ static class ZipItFileCallable extends AbstractFileCallable<Integer> { | |||
final String exclude; | |||
final boolean overwrite; | |||
|
|||
public ZipItFileCallable(String glob, String exclude, boolean overwrite) { | |||
private boolean defaultExcludes = true; |
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.
Making this field final
would make it both consistent with the other fields in this class and easier to reason about (mutable state is generally harder to reason about than immutable state).
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.
Done. can you review?
<p> | ||
The zip file should include defaultExcludes provided by ant java pattern. | ||
By Default defaultExcludes param value will be true. | ||
</p> |
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.
This documentation is grammatically confusing (the first sentence probably meant to say "Whether the zip file should […]") and also has incorrect capitalization. Suggest clarifying as follows:
<p>By default, the following exclusions are applied:</p>
<pre>**/*~
**/#*#
**/%*%
**/.#*
**/._*
**/.bzr
**/.bzr/**
**/.bzrignore
**/CVS
**/CVS/**
**/.cvsignore
**/.DS_Store
**/.git
**/.git/**
**/.gitattributes
**/.gitignore
**/.gitmodules
**/.hg
**/.hg/**
**/.hgignore
**/.hgsub
**/.hgsubstate
**/.hgtags
**/SCCS
**/SCCS/**
**/.svn
**/.svn/**
**/vssver.scc
</pre>
<p>Set this option to <code>false</code> if you do not want these default exclusions to be applied.</p>
* <a href="https://ant.apache.org/manual/dirtasks.html#defaultexcludes" target="_blank">Ant style pattern</a> | ||
* of files to disable default excludes from the archive. |
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.
Incorrect: this is a boolean, not a pattern.
* <a href="https://ant.apache.org/manual/dirtasks.html#defaultexcludes" target="_blank">Ant style pattern</a> | ||
* of files to disable default excludes from the archive. |
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.
Incorrect: this is a boolean, not a pattern.
From my reading of the code, it appears the tar step uses the same Ant task and therefore the same default exclusions. If true, then it seems inconsistent to add this parameter to the zip step but not the tar step. |
As this ticket was for zip step i added code only for that but i agree with your point and to have the same consistency in zip and tar, added the same in tarStep as well. |
@basil can this be reviewed now. This feature is much needed for us to progress in our project. Hence the urgency. |
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.
This is looking good overall, but I think now that the scope of this PR extends to both the zip and the tar step, HTML documentation for the tar step needs to be added to match that of the zip step, along with a corresponding test for the tar step. Otherwise the change is inconsistent, applying some logic to one step but not the other.
src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/zip/ZipStep.java
Outdated
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.
Looks good to me. Thanks for your contribution and for addressing feedback so quickly! In order to set expectations properly, I am not a maintainer of this plugin (though I am a Jenkins core maintainer), so I will be unable to merge your change. But @rsandell is a maintainer of this plugin, and I believe that the work we have done together has brought this PR closer to a state that can be approved by him (if not to the finish line!). Thanks again!
Thanks for the feedback and support provided. |
Looks good, from what I can see you only need to fix the javadoc errors in the new code to make the build pass. |
Done |
@rsandell can this be merged? |
@rsandell It didnot create a new release. Do i need to do anything from my side? |
Bydefault zipcreation excludes the default files like .gitignore and others mentioned in https://ant.apache.org/manual/dirtasks.html#defaultexcludes.
This PR is to solve https://issues.jenkins.io/browse/JENKINS-63587
Example:
zip zipFile: 'template.zip', archive: true, defaultExcludes:false, glob: 'template-*/**/*'
default value of defaultExcludes is true.