Package hudson.plugins.sauce_ondemand
Class SauceOnDemandBuildAction
java.lang.Object
hudson.plugins.sauce_ondemand.AbstractAction
hudson.plugins.sauce_ondemand.SauceOnDemandBuildAction
- All Implemented Interfaces:
Action,ModelObject,Serializable,RunAction2,SimpleBuildStep.LastBuildAction
@ExportedBean
public class SauceOnDemandBuildAction
extends AbstractAction
implements Serializable, RunAction2, SimpleBuildStep.LastBuildAction
Presents the links to the Sauce OnDemand jobs on the build summary page.
- Author:
- Ross Rowe
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PatternRegex pattern that is used to identify Sauce job ids which have been run as part of a Jenkins build. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoJobReport(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) getBuild()protected SauceCredentialsgetJobIdsForBuild(JenkinsSauceREST sauceREST, String buildId) getJobs()getJobs(boolean updateJobs) protected static Map<String,JenkinsJobInformation> getJobsInformation(JenkinsSauceREST sauceREST, SauceCredentials credentials, Iterable<String> jobIds) Collection<? extends Action>getSauceBuild(boolean updateBuild) Default method of getting Sauce build information using the sanitized Jenkins build numbergetSauceBuild(String sauceBuildName) getSauceBuild(String sauceBuildName, boolean updateBuild) Method for getting Sauce build information if we know the actual Sauce build namestatic SauceOnDemandBuildActiongetSauceBuildAction(Run build) protected JenkinsSauceRESTbooleanvoidonAttached(Run<?, ?> run) voidprotected Objectstatic JenkinsBuildInformationretrieveBuildFromSauce(JenkinsSauceREST sauceREST, String buildNumber) Invokes the Sauce REST API to retrieve the build information.static JenkinsBuildInformationretrieveBuildInformationFromSauce(JenkinsSauceREST sauceREST, String buildNumber) Invokes the Sauce REST API to retrieve the build information.static LinkedHashMap<String,JenkinsJobInformation> retrieveJobIdsFromSauce(JenkinsSauceREST sauceREST, Run build) Invokes the Sauce REST API to retrieve the details for the jobs the user has access to.static LinkedHashMap<String,JenkinsJobInformation> retrieveJobIdsFromSauce(JenkinsSauceREST sauceREST, Run build, SauceCredentials credentials) voidsetJobs(List<JenkinsJobInformation> jobs) voidstopJobs()voidupdateJobs(Map<String, String> customDataObj) Methods inherited from class hudson.plugins.sauce_ondemand.AbstractAction
getDisplayName, getIconFileName, getJobsWithAuth, getUrlNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.model.Action
getDisplayName, getIconFileName, getUrlName
-
Field Details
-
SESSION_ID_PATTERN
Regex pattern that is used to identify Sauce job ids which have been run as part of a Jenkins build.
-
-
Constructor Details
-
SauceOnDemandBuildAction
-
-
Method Details
-
retrieveBuildFromSauce
public static JenkinsBuildInformation retrieveBuildFromSauce(JenkinsSauceREST sauceREST, String buildNumber) throws org.json.JSONException Invokes the Sauce REST API to retrieve the build information.- Parameters:
sauceREST- Sauce Rest object/credentials to usebuildNumber- The build name on Sauce or sanitized build number from Jenkins- Returns:
- Jenkins build information
- Throws:
org.json.JSONException- Not json returned properly
-
retrieveBuildInformationFromSauce
public static JenkinsBuildInformation retrieveBuildInformationFromSauce(JenkinsSauceREST sauceREST, String buildNumber) throws org.json.JSONException, IOException Invokes the Sauce REST API to retrieve the build information.- Parameters:
sauceREST- Sauce Rest object/credentials to usebuildNumber- The build name on Sauce or sanitized build number from Jenkins- Returns:
- Jenkins build information
- Throws:
org.json.JSONException- Unable to parse jsonIOException
-
retrieveJobIdsFromSauce
public static LinkedHashMap<String,JenkinsJobInformation> retrieveJobIdsFromSauce(JenkinsSauceREST sauceREST, Run build) throws org.json.JSONException, IOException Invokes the Sauce REST API to retrieve the details for the jobs the user has access to. Iterates over the jobs and attempts to find the job that has a 'build' field matching the build key/number.- Parameters:
sauceREST- Sauce Rest object/credentials to usebuild- Which build this is requesting job ids from- Returns:
- List of processed job information
- Throws:
org.json.JSONException- Not json returned properlyIOException
-
getSauceBuildAction
- Parameters:
build- The build in progress- Returns:
- the
SauceOnDemandBuildActioninstance which has been registered with the build Can be null
-
retrieveJobIdsFromSauce
public static LinkedHashMap<String,JenkinsJobInformation> retrieveJobIdsFromSauce(JenkinsSauceREST sauceREST, Run build, SauceCredentials credentials) throws org.json.JSONException, IOException - Throws:
org.json.JSONExceptionIOException
-
getJobIdsForBuild
-
getJobsInformation
protected static Map<String,JenkinsJobInformation> getJobsInformation(JenkinsSauceREST sauceREST, SauceCredentials credentials, Iterable<String> jobIds) throws org.json.JSONException, IOException - Throws:
org.json.JSONExceptionIOException
-
slice
-
getBuild
-
hasSauceOnDemandResults
public boolean hasSauceOnDemandResults() -
getSauceBuild
Default method of getting Sauce build information using the sanitized Jenkins build number -
getSauceBuild
-
getSauceBuild
@Exported(visibility=2) public JenkinsBuildInformation getSauceBuild(String sauceBuildName, boolean updateBuild) Method for getting Sauce build information if we know the actual Sauce build name -
getSauceBuild
-
getJobs
-
getJobs
- Specified by:
getJobsin classAbstractAction
-
stopJobs
- Throws:
InterruptedException
-
updateJobs
- Throws:
IOException
-
getCredentials
- Specified by:
getCredentialsin classAbstractAction
-
getAnalytics
-
getSauceREST
-
getById
-
doJobReport
public void doJobReport(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException - Overrides:
doJobReportin classAbstractAction- Parameters:
req- Standard Request Objectrsp- Standard Response Object- Throws:
IOException- Unable to load index.jelly template
-
setJobs
-
readResolve
-
getProjectActions
- Specified by:
getProjectActionsin interfaceSimpleBuildStep.LastBuildAction
-
onAttached
- Specified by:
onAttachedin interfaceRunAction2
-
onLoad
- Specified by:
onLoadin interfaceRunAction2
-