-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from falkena/feature/AddTGZStep
Introduce tar/untar steps including gzip compression.
- Loading branch information
Showing
40 changed files
with
2,076 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/AbstractFileCallable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2016 CloudBees Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package org.jenkinsci.plugins.pipeline.utility.steps; | ||
|
||
import hudson.FilePath; | ||
import jenkins.MasterToSlaveFileCallable; | ||
|
||
public abstract class AbstractFileCallable<T> extends MasterToSlaveFileCallable<T> { | ||
private FilePath destination; | ||
|
||
public FilePath getDestination() { | ||
return destination; | ||
} | ||
|
||
public void setDestination(FilePath destination) { | ||
this.destination = destination; | ||
} | ||
} |
117 changes: 117 additions & 0 deletions
117
src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/AbstractFileCompressStep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
package org.jenkinsci.plugins.pipeline.utility.steps; | ||
|
||
import org.kohsuke.stapler.DataBoundSetter; | ||
|
||
public abstract class AbstractFileCompressStep extends AbstractFileStep { | ||
private String dir; | ||
private String glob; | ||
private String exclude; | ||
private boolean archive = false; | ||
private boolean overwrite = false; | ||
|
||
/** | ||
* The relative path of the base directory to create the archive from. | ||
* Leave empty to create from the current working directory. | ||
* | ||
* @return the dir | ||
*/ | ||
public String getDir() { | ||
return dir; | ||
} | ||
|
||
/** | ||
* The relative path of the base directory to create the archive from. | ||
* Leave empty to create from the current working directory. | ||
* | ||
* @param dir the dir | ||
*/ | ||
@DataBoundSetter | ||
public void setDir(String dir) { | ||
this.dir = dir; | ||
} | ||
|
||
/** | ||
* <a href="https://ant.apache.org/manual/dirtasks.html#patterns" target="_blank">Ant style pattern</a> | ||
* of files to include in the archive. | ||
* Leave empty to include all files and directories. | ||
* | ||
* @return the include pattern | ||
*/ | ||
public String getGlob() { | ||
return glob; | ||
} | ||
|
||
/** | ||
* <a href="https://ant.apache.org/manual/dirtasks.html#patterns" target="_blank">Ant style pattern</a> | ||
* of files to include in the archive. | ||
* Leave empty to include all files and directories. | ||
* | ||
* @param glob the include pattern | ||
*/ | ||
@DataBoundSetter | ||
public void setGlob(String glob) { | ||
this.glob = glob; | ||
} | ||
|
||
/** | ||
* <a href="https://ant.apache.org/manual/dirtasks.html#patterns" target="_blank">Ant style pattern</a> | ||
* of files to exclude from the archive. | ||
* | ||
* @return the exclude pattern | ||
*/ | ||
public String getExclude() { | ||
return exclude; | ||
} | ||
|
||
/** | ||
* <a href="https://ant.apache.org/manual/dirtasks.html#patterns" target="_blank">Ant style pattern</a> | ||
* of files to exclude in the archive. | ||
* | ||
* @param exclude the exclude pattern | ||
*/ | ||
@DataBoundSetter | ||
public void setExclude(String exclude) { | ||
this.exclude = exclude; | ||
} | ||
|
||
/** | ||
* If the archive file should be archived as an artifact of the current build. | ||
* The file will still be kept in the workspace after archiving. | ||
* | ||
* @return if it should be archived or not | ||
*/ | ||
public boolean isArchive() { | ||
return archive; | ||
} | ||
|
||
/** | ||
* If the archive file should be archived as an artifact of the current build. | ||
* The file will still be kept in the workspace after archiving. | ||
* | ||
* @param archive if it should be archived or not | ||
*/ | ||
@DataBoundSetter | ||
public void setArchive(boolean archive) { | ||
this.archive = archive; | ||
} | ||
|
||
/** | ||
* If the archive file should be overwritten in case of already existing a file with the same name. | ||
* | ||
* @return if the file should be overwritten or not in case of existing. | ||
*/ | ||
public boolean isOverwrite() { | ||
return overwrite; | ||
} | ||
|
||
/** | ||
* If the archive file should be overwritten in case of already existing a file with the same name. | ||
* | ||
* @param overwrite if the file should be overwritten or not in case of existing. | ||
*/ | ||
@DataBoundSetter | ||
public void setOverwrite(boolean overwrite) { | ||
this.overwrite = overwrite; | ||
} | ||
|
||
} |
99 changes: 99 additions & 0 deletions
99
src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/AbstractFileDecompressStep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package org.jenkinsci.plugins.pipeline.utility.steps; | ||
|
||
import org.kohsuke.stapler.DataBoundSetter; | ||
|
||
public abstract class AbstractFileDecompressStep extends AbstractFileStep { | ||
private String dir; | ||
private String glob; | ||
private boolean test = false; | ||
private boolean quiet = false; | ||
|
||
/** | ||
* The relative path of the base directory to create the archive from. | ||
* Leave empty to create from the current working directory. | ||
* | ||
* @return the dir | ||
*/ | ||
public String getDir() { | ||
return dir; | ||
} | ||
|
||
/** | ||
* The relative path of the base directory to create the archive from. | ||
* Leave empty to create from the current working directory. | ||
* | ||
* @param dir the dir | ||
*/ | ||
@DataBoundSetter | ||
public void setDir(String dir) { | ||
this.dir = dir; | ||
} | ||
|
||
/** | ||
* <a href="https://ant.apache.org/manual/dirtasks.html#patterns" target="_blank">Ant style pattern</a> | ||
* of files to extract from the archive. | ||
* Leave empty to include all files and directories. | ||
* | ||
* @return the include pattern | ||
*/ | ||
public String getGlob() { | ||
return glob; | ||
} | ||
|
||
/** | ||
* <a href="https://ant.apache.org/manual/dirtasks.html#patterns" target="_blank">Ant style pattern</a> | ||
* of files to extract from the archive. | ||
* Leave empty to include all files and directories. | ||
* | ||
* @param glob the include pattern | ||
*/ | ||
@DataBoundSetter | ||
public void setGlob(String glob) { | ||
this.glob = glob; | ||
} | ||
|
||
/** | ||
* Test the integrity of the archive instead of extracting it. | ||
* When this parameter is enabled, all other parameters <em>(except for {@link #getFile()})</em> will be ignored. | ||
* The step will return <code>true</code> or <code>false</code> depending on the result | ||
* instead of throwing an exception. | ||
* | ||
* @return if the archive should just be tested or not | ||
*/ | ||
public boolean isTest() { | ||
return test; | ||
} | ||
|
||
/** | ||
* Test the integrity of the archive instead of extracting it. | ||
* When this parameter is enabled, all other parameters <em>(except for {@link #getFile()})</em> will be ignored. | ||
* The step will return <code>true</code> or <code>false</code> depending on the result | ||
* instead of throwing an exception. | ||
* | ||
* @param test if the archive should just be tested or not | ||
*/ | ||
@DataBoundSetter | ||
public void setTest(boolean test) { | ||
this.test = test; | ||
} | ||
|
||
/** | ||
* Suppress the verbose output that logs every single file that is dealt with. | ||
* | ||
* @return if verbose logging should be suppressed | ||
*/ | ||
public boolean isQuiet() { | ||
return quiet; | ||
} | ||
|
||
/** | ||
* Suppress the verbose output that logs every single file that is dealt with. | ||
* | ||
* @param quiet if verbose logging should be suppressed | ||
*/ | ||
@DataBoundSetter | ||
public void setQuiet(boolean quiet) { | ||
this.quiet = quiet; | ||
} | ||
|
||
} |
23 changes: 1 addition & 22 deletions
23
src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/AbstractFileOrTextStep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/AbstractFileStep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.jenkinsci.plugins.pipeline.utility.steps; | ||
|
||
import org.jenkinsci.plugins.workflow.steps.Step; | ||
import org.kohsuke.stapler.DataBoundSetter; | ||
|
||
public abstract class AbstractFileStep extends Step { | ||
private String file; | ||
|
||
/** | ||
* The path to a file in the workspace to read from. | ||
* | ||
* @return the path | ||
*/ | ||
public String getFile() { | ||
return file; | ||
} | ||
|
||
/** | ||
* The path to a file in the workspace to read from. | ||
* | ||
* @param file the path | ||
*/ | ||
@DataBoundSetter | ||
public void setFile(String file) { | ||
this.file = file; | ||
} | ||
|
||
} |
Oops, something went wrong.