awslabs / aws-codepipeline-plugin-for-jenkins

Use this plugin to integrate your Jenkins project with a pipeline in AWS CodePipeline. For more information and step-by-step directions on how to install and configure this plugin, follow the Four Stage Pipeline Tutorial. http://docs.aws.amazon.com/codepipeline/latest/userguide/getting-started-4.html
Apache License 2.0
82 stars 68 forks source link

Error when using output location that is absolute path that is not underneath working directory #18

Open dmarklein opened 7 years ago

dmarklein commented 7 years ago

As part of our build process, we copy the resulting artifacts for our build to a separate directory, one that is not a subdirectory of our workspace, and zip them up for publishing. We would like to use this directory as our output location to be uploaded, but when we try to do so, the plugin throws an error because there's an illegal character (":") in the resulting path.

For example, let's say our workspace directory is "C:\Data\build\jenkins\workspace\OurApp", and we output our artifacts to publish to "C:\Data\build\jenkins\published\OurApp". If I configure out Jenkins project to upload and output location of the latter path, it blows up when trying to publish because there's an "Illegal char <:> ... " in the path "C:\Data\build\jenkins\workspace\OurApp\C:\Data\build\jenkins\published\OurApp".

I suspect this is an easy fix, and one I think I could put together a PR for -- is there any reason against adding this support? Thanks!

belltimo commented 7 years ago

It seems like : characters should be supported, are you able to provide a stack trace so I can see exactly where the issue is? I've made a note of your issue internally so we can investigate it further.

In the interim, is it possible to use a directory inside your workspace for the output artifact? I believe it's quite common to use a directory called something like build or target inside your workspace for this purpose.

dmarklein commented 7 years ago

I do not have a stack trace currently (I will re-configure the job and repro for a stack trace as soon as I can), but to me it certainly looks that the error I see comes from line 209 of CompressionTools.java (here). If outputPath is an absolute path already and not one that is under the workspace, the code tries to concatenate outputPath with the absolute workspace path, yielding a bogus path.