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
BuildWrapper that sets up the Sauce OnDemand SSH tunnel and populates environment variables which represent the selected browser(s).
Author:
Kohsuke Kawaguchi, Ross Rowe
See Also:
  • Field Details

    • SELENIUM_DRIVER

      public static final String SELENIUM_DRIVER
      Environment variable key which contains Selenium Client Factory driver for selected browser.
      See Also:
    • SAUCE_ONDEMAND_BROWSERS

      public static final String SAUCE_ONDEMAND_BROWSERS
      Environment variable key which contains a JSON formatted list of selected browsers.
      See Also:
    • SELENIUM_HOST

      public static final String SELENIUM_HOST
      Environment variable key which contains the selenium host.
      See Also:
    • SELENIUM_PORT

      public static final String SELENIUM_PORT
      Environment variable key which contains the selenium port.
      See Also:
    • SAUCE_USERNAME

      public static final String SAUCE_USERNAME
      Environment variable key which contains the Sauce user name.
      See Also:
    • SAUCE_ACCESS_KEY

      public static final String SAUCE_ACCESS_KEY
      Environment variable key which contains the Sauce access key.
      See Also:
    • SAUCE_REST_ENDPOINT

      public static final String SAUCE_REST_ENDPOINT
      Environment variable key which contains the Sauce REST endpoint.
      See Also:
    • SELENIUM_DEVICE

      public static final String SELENIUM_DEVICE
      Environment variable key which contains the device value for the selected browser.
      See Also:
    • SELENIUM_DEVICE_TYPE

      public static final String SELENIUM_DEVICE_TYPE
      Environment variable key which contains the device type for the selected browser.
      See Also:
    • SELENIUM_DEVICE_ORIENTATION

      public static final String SELENIUM_DEVICE_ORIENTATION
      Environment variable key which contains the device orientation for the selected browser.
      See Also:
    • 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:
    • SELENIUM_PLATFORM

      public static final String SELENIUM_PLATFORM
      Environment variable key which contains the platform for the selected browser.
      See Also:
    • SELENIUM_VERSION

      public static final String SELENIUM_VERSION
      Environment variable key which contains the version for the selected browser.
      See Also:
    • JENKINS_BUILD_NUMBER

      @Deprecated public static final String JENKINS_BUILD_NUMBER
      Deprecated.
      Should use the standard SAUCE_BUILD_NAME
      Environment variable key which contains the Jenkins build number.
      See Also:
    • SAUCE_BUILD_NAME

      public static final String SAUCE_BUILD_NAME
      Environment variable key which contains the Jenkins build number.
      See Also:
    • USE_LATEST_SAUCE_CONNECT

      public static final String USE_LATEST_SAUCE_CONNECT
      See Also:
    • TUNNEL_NAME

      public static final String TUNNEL_NAME
      See Also:
  • Constructor Details

    • 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 Connect
      seleniumInformation - 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 used
      sauceConnectPath - Path to sauce connect
      launchSauceConnectOnSlave - indicates whether Sauce Connect should be launched on the slave or master node
      verboseLogging - indicates whether the Sauce Connect output should be written to the Jenkins job output
      useLatestVersion - indicates whether the latest version of the selected browser(s) should be used
      useLatestSauceConnect - indicates whether the latest version of Sauce Connect should always be used
      forceCleanup - indicates whether to force cleanup for jobs/tunnels instead of waiting for timeout
      webDriverBrowsers - which browser(s) should be used for web driver
      appiumBrowsers - which browser(s) should be used for appium
      nativeAppPackage - the path to the native app package to be tested
      useGeneratedTunnelIdentifier - indicated whether tunnel names and ports should be managed by the plugin
      credentialId - Which credential a build should use
  • Method Details

    • getSauceTunnelManager

      public static com.saucelabs.ci.sauceconnect.AbstractSauceTunnelManager getSauceTunnelManager() throws org.codehaus.plexus.component.repository.exception.ComponentLookupException
      Retrieve the AbstractSauceTunnelManager instance to be used to launch Sauce Connect.
      Returns:
      AbstractSauceTunnelManager instance
      Throws:
      org.codehaus.plexus.component.repository.exception.ComponentLookupException - see plexus
    • makeSensitiveBuildVariables

      public void makeSensitiveBuildVariables(AbstractBuild build, Set<String> sensitiveVariables)
      Overrides:
      makeSensitiveBuildVariables in class BuildWrapper
    • setUp

      Invoked prior to the running of a Jenkins build. Populates the Sauce specific environment variables and launches Sauce Connect.

      Overrides:
      setUp in class BuildWrapper
      Returns:
      a new Environment instance populated with the Sauce environment variables
      Throws:
      IOException
      InterruptedException
    • 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)
    • getWebDriverBrowsers

      public List<String> getWebDriverBrowsers()
    • setWebDriverBrowsers

      public void setWebDriverBrowsers(List<String> webDriverBrowsers)
    • getAppiumBrowsers

      public List<String> getAppiumBrowsers()
    • setAppiumBrowsers

      public void setAppiumBrowsers(List<String> appiumBrowsers)
    • 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)