Class BuildstashUploadHelper

java.lang.Object
com.buildstash.BuildstashUploadHelper

public class BuildstashUploadHelper extends Object
Helper class containing shared logic for Buildstash upload operations. Used by both BuildstashBuilder and BuildstashStepExecution to avoid code duplication.
  • Constructor Details

    • BuildstashUploadHelper

      public BuildstashUploadHelper()
  • Method Details

    • expand

      public static String expand(EnvVars env, String value)
      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, InterruptedException
      Creates a BuildstashUploadRequest from the provided parameters. All string parameters should already be expanded (environment variables resolved).
      Throws:
      IOException
      InterruptedException
    • getBuildUrl

      public static String getBuildUrl(Run<?,?> build)
      Gets the full URL to the build run status summary.
    • getProjectUrl

      public static String getProjectUrl(Run<?,?> build)
      Gets the full URL to the Jenkins project/job root.
    • getBuildDuration

      public static long getBuildDuration(Run<?,?> build)
      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

      public static String formatBuildDuration(long durationMs)
      Formats build duration in milliseconds to HH:mm:ss format.
    • logResults

      public static void logResults(TaskListener listener, BuildstashUploadResponse response)
      Logs the upload results to the task listener.