Package hudson.plugins.sauce_ondemand
Class SauceOnDemandBuildWrapper
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<BuildWrapper>
-
- hudson.tasks.BuildWrapper
-
- hudson.plugins.sauce_ondemand.SauceOnDemandBuildWrapper
-
- All Implemented Interfaces:
ExtensionPoint,Describable<BuildWrapper>,Serializable
public class SauceOnDemandBuildWrapper extends BuildWrapper implements Serializable
BuildWrapperthat sets up the Sauce OnDemand SSH tunnel and populates environment variables which represent the selected browser(s).- Author:
- Kohsuke Kawaguchi, Ross Rowe
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSauceOnDemandBuildWrapper.DescriptorImplPlugin descriptor, which adds the plugin details to the Jenkins job configuration page.static classSauceOnDemandBuildWrapper.GetAvailablePortstatic classSauceOnDemandBuildWrapper.ItemListenerImpl-
Nested classes/interfaces inherited from class hudson.tasks.BuildWrapper
BuildWrapper.Environment
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static PatternENVIRONMENT_VARIABLE_PATTERNRegex pattern which is used to identify replacement parameters.static StringJENKINS_BUILD_NUMBERDeprecated.Should use the standard SAUCE_BUILD_NAMEstatic StringSAUCE_ACCESS_KEYEnvironment variable key which contains the Sauce access key.static StringSAUCE_BUILD_NAMEEnvironment variable key which contains the Jenkins build number.static StringSAUCE_ONDEMAND_BROWSERSEnvironment variable key which contains a JSON formatted list of selected browsers.static StringSAUCE_REST_ENDPOINTEnvironment variable key which contains the Sauce REST endpoint.static StringSAUCE_USERNAMEEnvironment variable key which contains the Sauce user name.static StringSELENIUM_BROWSEREnvironment variable key which contains the browser value for the selected browser.static StringSELENIUM_DEVICEEnvironment variable key which contains the device value for the selected browser.static StringSELENIUM_DEVICE_ORIENTATIONEnvironment variable key which contains the device orientation for the selected browser.static StringSELENIUM_DEVICE_TYPEEnvironment variable key which contains the device type for the selected browser.static StringSELENIUM_DRIVEREnvironment variable key which contains Selenium Client Factory driver for selected browser.static StringSELENIUM_HOSTEnvironment variable key which contains the selenium host.static StringSELENIUM_PLATFORMEnvironment variable key which contains the platform for the selected browser.static StringSELENIUM_PORTEnvironment variable key which contains the selenium port.static StringSELENIUM_VERSIONEnvironment variable key which contains the version for the selected browser.static StringTUNNEL_NAMEstatic StringUSE_LATEST_SAUCE_CONNECT
-
Constructor Summary
Constructors Constructor Description SauceOnDemandBuildWrapper(boolean enableSauceConnect, org.jenkins_ci.plugins.run_condition.RunCondition condition, String credentialId, SeleniumInformation seleniumInformation, String seleniumHost, String seleniumPort, String options, String cliOptions, String sauceConnectPath, boolean launchSauceConnectOnSlave, boolean verboseLogging, boolean useLatestVersion, boolean useLatestSauceConnect, boolean forceCleanup, List<String> webDriverBrowsers, List<String> appiumBrowsers, String nativeAppPackage, boolean useGeneratedTunnelIdentifier)Constructs a new instance using data entered on the job configuration screen.
-
Method Summary
-
Methods inherited from class hudson.tasks.BuildWrapper
all, decorateLauncher, decorateLogger, getProjectAction, getProjectActions, makeBuildVariables, preCheckout, setUp
-
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
-
-
-
Field Detail
-
SELENIUM_DRIVER
public static final String SELENIUM_DRIVER
Environment variable key which contains Selenium Client Factory driver for selected browser.- See Also:
- Constant Field Values
-
SAUCE_ONDEMAND_BROWSERS
public static final String SAUCE_ONDEMAND_BROWSERS
Environment variable key which contains a JSON formatted list of selected browsers.- See Also:
- Constant Field Values
-
SELENIUM_HOST
public static final String SELENIUM_HOST
Environment variable key which contains the selenium host.- See Also:
- Constant Field Values
-
SELENIUM_PORT
public static final String SELENIUM_PORT
Environment variable key which contains the selenium port.- See Also:
- Constant Field Values
-
SAUCE_USERNAME
public static final String SAUCE_USERNAME
Environment variable key which contains the Sauce user name.- See Also:
- Constant Field Values
-
SAUCE_ACCESS_KEY
public static final String SAUCE_ACCESS_KEY
Environment variable key which contains the Sauce access key.- See Also:
- Constant Field Values
-
SAUCE_REST_ENDPOINT
public static final String SAUCE_REST_ENDPOINT
Environment variable key which contains the Sauce REST endpoint.- See Also:
- Constant Field Values
-
SELENIUM_DEVICE
public static final String SELENIUM_DEVICE
Environment variable key which contains the device value for the selected browser.- See Also:
- Constant Field Values
-
SELENIUM_DEVICE_TYPE
public static final String SELENIUM_DEVICE_TYPE
Environment variable key which contains the device type for the selected browser.- See Also:
- Constant Field Values
-
SELENIUM_DEVICE_ORIENTATION
public static final String SELENIUM_DEVICE_ORIENTATION
Environment variable key which contains the device orientation for the selected browser.- See Also:
- Constant Field Values
-
ENVIRONMENT_VARIABLE_PATTERN
public static final Pattern ENVIRONMENT_VARIABLE_PATTERN
Regex pattern which is used to identify replacement parameters.
-
SELENIUM_BROWSER
public static final String SELENIUM_BROWSER
Environment variable key which contains the browser value for the selected browser.- See Also:
- Constant Field Values
-
SELENIUM_PLATFORM
public static final String SELENIUM_PLATFORM
Environment variable key which contains the platform for the selected browser.- See Also:
- Constant Field Values
-
SELENIUM_VERSION
public static final String SELENIUM_VERSION
Environment variable key which contains the version for the selected browser.- See Also:
- Constant Field Values
-
JENKINS_BUILD_NUMBER
@Deprecated public static final String JENKINS_BUILD_NUMBER
Deprecated.Should use the standard SAUCE_BUILD_NAMEEnvironment variable key which contains the Jenkins build number.- See Also:
- Constant Field Values
-
SAUCE_BUILD_NAME
public static final String SAUCE_BUILD_NAME
Environment variable key which contains the Jenkins build number.- See Also:
- Constant Field Values
-
USE_LATEST_SAUCE_CONNECT
public static final String USE_LATEST_SAUCE_CONNECT
- See Also:
- Constant Field Values
-
TUNNEL_NAME
public static final String TUNNEL_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SauceOnDemandBuildWrapper
@DataBoundConstructor public SauceOnDemandBuildWrapper(boolean enableSauceConnect, org.jenkins_ci.plugins.run_condition.RunCondition condition, String credentialId, SeleniumInformation seleniumInformation, String seleniumHost, String seleniumPort, String options, String cliOptions, String sauceConnectPath, boolean launchSauceConnectOnSlave, boolean verboseLogging, boolean useLatestVersion, boolean useLatestSauceConnect, boolean forceCleanup, List<String> webDriverBrowsers, List<String> appiumBrowsers, String nativeAppPackage, boolean useGeneratedTunnelIdentifier)Constructs a new instance using data entered on the job configuration screen.- Parameters:
enableSauceConnect- indicates whether Sauce Connect should be started as part of the build.condition- allows users to define rules which enable Sauce ConnectseleniumInformation- the browser information that is to be used for the build.seleniumHost- host location of the selenium server.seleniumPort- port location of the selenium server.options- the Sauce Connect command line options to be usedsauceConnectPath- Path to sauce connectlaunchSauceConnectOnSlave- indicates whether Sauce Connect should be launched on the slave or master nodeverboseLogging- indicates whether the Sauce Connect output should be written to the Jenkins job outputuseLatestVersion- indicates whether the latest version of the selected browser(s) should be useduseLatestSauceConnect- indicates whether the latest version of Sauce Connect should always be usedforceCleanup- indicates whether to force cleanup for jobs/tunnels instead of waiting for timeoutwebDriverBrowsers- which browser(s) should be used for web driverappiumBrowsers- which browser(s) should be used for appiumnativeAppPackage- the path to the native app package to be testeduseGeneratedTunnelIdentifier- indicated whether tunnel names and ports should be managed by the plugincredentialId- Which credential a build should use
-
-
Method Detail
-
getSauceTunnelManager
public static com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager getSauceTunnelManager() throws org.codehaus.plexus.component.repository.exception.ComponentLookupExceptionRetrieve theAbstractSauceTunnelManagerinstance to be used to launch Sauce Connect.- Returns:
AbstractSauceTunnelManagerinstance- Throws:
org.codehaus.plexus.component.repository.exception.ComponentLookupException- see plexus
-
makeSensitiveBuildVariables
public void makeSensitiveBuildVariables(AbstractBuild build, Set<String> sensitiveVariables)
- Overrides:
makeSensitiveBuildVariablesin classBuildWrapper
-
setUp
public BuildWrapper.Environment setUp(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException
Invoked prior to the running of a Jenkins build. Populates the Sauce specific environment variables and launches Sauce Connect.
- Overrides:
setUpin classBuildWrapper- Returns:
- a new
Environmentinstance populated with the Sauce environment variables - Throws:
IOExceptionInterruptedException
-
isDisableUsageStats
public boolean isDisableUsageStats()
-
isUseLatestVersion
public boolean isUseLatestVersion()
-
isForceCleanup
public boolean isForceCleanup()
-
getSeleniumHost
public String getSeleniumHost()
-
setSeleniumHost
public void setSeleniumHost(String seleniumHost)
-
getSeleniumPort
public String getSeleniumPort()
-
setSeleniumPort
public void setSeleniumPort(String seleniumPort)
-
getSeleniumInformation
public SeleniumInformation getSeleniumInformation()
-
setSeleniumInformation
public void setSeleniumInformation(SeleniumInformation seleniumInformation)
-
isEnableSauceConnect
public boolean isEnableSauceConnect()
-
setEnableSauceConnect
public void setEnableSauceConnect(boolean enableSauceConnect)
-
isLaunchSauceConnectOnSlave
public boolean isLaunchSauceConnectOnSlave()
-
setLaunchSauceConnectOnSlave
public void setLaunchSauceConnectOnSlave(boolean launchSauceConnectOnSlave)
-
isUseLatestSauceConnect
public boolean isUseLatestSauceConnect()
-
isUseGeneratedTunnelIdentifier
public boolean isUseGeneratedTunnelIdentifier()
-
setUseGeneratedTunnelIdentifier
public void setUseGeneratedTunnelIdentifier(boolean useGeneratedTunnelIdentifier)
-
isVerboseLogging
public boolean isVerboseLogging()
-
setVerboseLogging
public void setVerboseLogging(boolean verboseLogging)
-
getOptions
public String getOptions()
-
setOptions
public void setOptions(String options)
-
getCliOptions
public String getCliOptions()
-
setCliOptions
public void setCliOptions(String cliOptions)
-
getCondition
public org.jenkins_ci.plugins.run_condition.RunCondition getCondition()
-
getSauceConnectPath
public String getSauceConnectPath()
-
setSauceConnectPath
public void setSauceConnectPath(String sauceConnectPath)
-
isUseChromeForAndroid
public boolean isUseChromeForAndroid()
-
getNativeAppPackage
public String getNativeAppPackage()
-
setUseLatestVersion
public void setUseLatestVersion(boolean useLatestVersion)
-
setForceCleanup
public void setForceCleanup(boolean forceCleanup)
-
setNativeAppPackage
public void setNativeAppPackage(String nativeAppPackage)
-
setUseChromeForAndroid
public void setUseChromeForAndroid(boolean useChromeForAndroid)
-
getCredentialId
public String getCredentialId()
-
setCredentialId
public void setCredentialId(String credentialId)
-
migrateCredentials
protected boolean migrateCredentials(AbstractProject project)
-
getSauceBuildAction
public SauceOnDemandBuildAction getSauceBuildAction(AbstractBuild build)
-
-