Package com.splunk.splunkjenkins.utils
Class LogEventHelper
java.lang.Object
com.splunk.splunkjenkins.utils.LogEventHelper
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
static shaded.splk.org.apache.http.client.methods.HttpPost
buildPost
(EventRecord record, SplunkJenkinsInstallation config) static String
getBuildCauses
(Run run) getBuildVariables
(Run run) getBuildVariables
(Run run, boolean completed) static String
getComputerStatus
(Computer computer) static String
static EnvVars
getEnvironment
(Run run) static String
getRelativeJenkinsHomePath
(String configPath) static float
getRunDuration
(Run run) getScmInfo
(Run build) getScmInfo
(String scmName, EnvVars envVars) static String
static String
getTriggerUserName
(Run run) static String
This method may trigger load user operations.static boolean
hasPublisherName
(String shortClassName, Run build) check if the project has publisherstatic void
logUserAction
(String user, String message) static boolean
static long
parseFileSize
(String size) static int
sendFiles
(Run build, FilePath ws, Map<String, String> envVars, TaskListener listener, String includes, String excludes, boolean sendFromSlave, long maxFileSize) static String
toJson
(EventRecord record) static void
updateSlaveInfoAsync
(String nodeName) static FormValidation
validateGroovyScript
(String script) static FormValidation
-
Field Details
-
SEPARATOR
- See Also:
-
-
Constructor Details
-
LogEventHelper
public LogEventHelper()
-
-
Method Details
-
buildPost
public static shaded.splk.org.apache.http.client.methods.HttpPost buildPost(EventRecord record, SplunkJenkinsInstallation config) -
verifyHttpInput
-
nonEmpty
-
getUserName
This method may trigger load user operations.- Returns:
- User display name
-
getMasterStats
- Returns:
- Jenkins master statistics with timestamp
-
sendFiles
-
parseFileSize
-
getTriggerUserName
- Parameters:
run
- Jenkins Run- Returns:
- the user who triggered the build or upstream build
-
getComputerStatus
-
getRunningJob
-
getSlaveStats
- Returns:
- a map with slave name as key and monitor result as value monitor result is a map with monitor name as key, monitor data as value
-
getEnvironment
- Parameters:
run
- the build- Returns:
- build env with masked password variables
-
getBuildVariables
- Parameters:
run
- the buildcompleted
- the task is completed to compute scm info- Returns:
- build variables with password masked
-
getBuildVariables
- Parameters:
run
- the build- Returns:
- build variables with password masked
-
logUserAction
-
updateSlaveInfoAsync
-
getRelativeJenkinsHomePath
- Parameters:
configPath
- the absolute path- Returns:
- the relative path to
JENKINS_HOME
directory
-
getDefaultDslScript
-
validateGroovyScript
- Parameters:
script
- user input script to validate- Returns:
- error message if there is any
-
hasPublisherName
check if the project has publisher- Parameters:
shortClassName
- common used publishers arebuild
- jenkins build- Returns:
- true if the publisher is defined, false otherwise
-
getRunDuration
- Parameters:
run
- an execution of job- Returns:
- job duration
-
appendScm
-
getScmInfo
-
getScmInfo
- Parameters:
scmName
- scm class nameenvVars
- environment variables- Returns:
- scm information, we only support git,svn and p4
-
getScmURL
- Parameters:
envVars
- environment variablesprefix
- scm prefix, such as GIT_URL, SVN_URL- Returns:
- parsed scm urls from build env, e.g. GIT_URL_1, GIT_URL_2, ... GIT_URL_10 or GIT_URL
-
toJson
-
getBuildVersion
-
getBuildCauses
- Parameters:
run
- Jenkins job run- Returns:
- causes separated by comma
-