Class EnvironmentUtils

java.lang.Object
org.cyclonedx.gradle.utils.EnvironmentUtils

public class EnvironmentUtils extends Object
Utility class for working with environment variables in common CI environments.
  • Constructor Details

    • EnvironmentUtils

      public EnvironmentUtils()
  • Method Details

    • getBuildURI

      public static @Nullable String getBuildURI()
      Get the URI of the current build from the environment variables set on common build systems like GitHub Actions, GitLab CI, etc.
      Returns:
      the URI of the current build or null if it cannot be determined
    • getBuildURI

      public static @Nullable String getBuildURI(String str)
      Get the URI of the current build from the specified environment variable. Additionally, a pattern can be provided to extract the URI from the environment variable. An example pattern could be "${SERVER}/jobs/${JOB_ID}".
      Parameters:
      str - the name of the environment variable or pattern to use
      Returns:
      the URI of the current build or null if it cannot be determined