public abstract class Environment extends Object
This is often used to run a parallel server necessary during a build, such as an application server, a database reserved for the build, X server for performing UI tests, etc.
By having a plugin that does this, instead of asking each build script to do this,
we can simplify the build script.
Environment abstraction also gives
you guaranteed "tear down" phase, so that such resource won't keep running forever.
RunListener.setUpEnvironment(AbstractBuild, Launcher, BuildListener)
|Constructor and Description|
|Modifier and Type||Method and Description|
Adds environmental variables for the builds to the given map.
Runs after the
Environment object wants to pass in information to the
build that runs, it can do so by exporting additional environment
variables to the map.
When this method is invoked, the map already contains the current "planned export" list.
env- never null. This really should have been typed as
EnvVarsbut by the time we realized it it was too late.
public boolean tearDown(AbstractBuild build, BuildListener listener) throws IOException, InterruptedException
Buildercompletes, and performs a tear down.
This method is invoked even when the build failed, so that the clean up operation can be performed regardless of the build result (for example, you'll want to stop application server even if a build fails.)
build- The same
Buildobject given to the set up method.
listener- The same
BuildListenerobject given to the set up method.
IOException- terminates the build abnormally. Jenkins will handle the exception and reports a nice error message.
Copyright © 2004–2018. All rights reserved.