Reputation: 1
I'm trying to unzip a previously downloaded zip file to the branch and it's throwing the following error when unzipping it with antbuilder, and any other method suggested for unzipping in groovy:
[ERROR] Pipeline failed: src '/home/jenkins/workspace/XYZ/src/unpackaged.zip' doesn't exist.
Below is my code:
static void unzipFile(Script script, String fileName, String dest = 'src', String overwrite = 'false'){
def workspace = NodeUtils.getWorkspace(script)
dest = "${workspace}"+ File.separator + "${dest}"
def zipFile = "${dest}" + File.separator + "${fileName}"
def ant = new AntBuilder()
ant.unzip( src:"${zipFile}",
dest:"${dest}",
overwrite:"${overwrite}" )
}
P.S, the workspace retrieval works as expected and it returns the correct path.
Upvotes: 0
Views: 229