Package com.buildstash
Class BuildstashUploadHelper
java.lang.Object
com.buildstash.BuildstashUploadHelper
Helper class containing shared logic for Buildstash upload operations.
Used by both BuildstashBuilder and BuildstashStepExecution to avoid code duplication.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BuildstashUploadRequestcreateUploadRequest(FilePath workspace, Run<?, ?> build, String structure, String primaryFilePath, String expansionFilePath, String versionComponent1Major, String versionComponent2Minor, String versionComponent3Patch, String versionComponentExtra, String versionComponentMeta, String customBuildNumber, String labels, String architectures, String platform, String stream, String notes, String vcHostType, String vcHost, String vcRepoName, String vcRepoUrl, String vcBranch, String vcCommitSha, String vcCommitUrl) Creates a BuildstashUploadRequest from the provided parameters.static StringExpands environment variables in a string value.static StringformatBuildDuration(long durationMs) Formats build duration in milliseconds to HH:mm:ss format.static longgetBuildDuration(Run<?, ?> build) Gets the build duration in milliseconds.static StringgetBuildUrl(Run<?, ?> build) Gets the full URL to the build run status summary.static StringgetProjectUrl(Run<?, ?> build) Gets the full URL to the Jenkins project/job root.static voidlogResults(TaskListener listener, BuildstashUploadResponse response) Logs the upload results to the task listener.static voidvalidateParameters(String apiKey, String primaryFilePath, String versionComponent1Major, String versionComponent2Minor, String versionComponent3Patch, String platform, String stream) Validates required parameters for Buildstash upload.
-
Constructor Details
-
BuildstashUploadHelper
public BuildstashUploadHelper()
-
-
Method Details
-
expand
Expands environment variables in a string value. Returns null if input is null, otherwise expands variables like ${VAR_NAME}. -
validateParameters
public static void validateParameters(String apiKey, String primaryFilePath, String versionComponent1Major, String versionComponent2Minor, String versionComponent3Patch, String platform, String stream) Validates required parameters for Buildstash upload.- Throws:
IllegalArgumentException- if any required parameter is null or blank
-
createUploadRequest
public static BuildstashUploadRequest createUploadRequest(FilePath workspace, Run<?, ?> build, String structure, String primaryFilePath, String expansionFilePath, String versionComponent1Major, String versionComponent2Minor, String versionComponent3Patch, String versionComponentExtra, String versionComponentMeta, String customBuildNumber, String labels, String architectures, String platform, String stream, String notes, String vcHostType, String vcHost, String vcRepoName, String vcRepoUrl, String vcBranch, String vcCommitSha, String vcCommitUrl) throws IOException, InterruptedExceptionCreates a BuildstashUploadRequest from the provided parameters. All string parameters should already be expanded (environment variables resolved).- Throws:
IOExceptionInterruptedException
-
getBuildUrl
Gets the full URL to the build run status summary. -
getProjectUrl
Gets the full URL to the Jenkins project/job root. -
getBuildDuration
Gets the build duration in milliseconds. If the build is still running or duration is 0, calculates duration from start time to now. If the build is completed with a valid duration, returns that duration. -
formatBuildDuration
Formats build duration in milliseconds to HH:mm:ss format. -
logResults
Logs the upload results to the task listener.
-