Is there a way to execute different post-build scripts depending on whether or not the build was a release build?
My goal is to execute script A for snapshot builds and execute script B for release builds
It seems pretty straight forward to determine if it was a maven release build with the groovy-post-build plugin, like so:
if(manager.build.buildVariables.containsKey("MVN_RELEASE_VERSION"))
{
"cmd /c C:\\test.bat".execute(); // Results in FileNotFound exception.
}
However, the groovy plugin gets run in a sandbox, so it doesn't allow you to access the filesystem to execute other scripts, or say grab an artifact to upload to S3.
The other option I tried was to just execute a Windows batch script, however, the variables that get passed to that script does not include the information to determine if it was a release build or not.
Is there a good way to accomplish this?
Can you try the flexi publish plugin in jenkins, hope it should solve