public class OpenShiftUtils extends Object
| Constructor and Description |
|---|
OpenShiftUtils() |
| Modifier and Type | Method and Description |
|---|---|
static NamespaceName |
buildConfigNameFromJenkinsJobName(String jobName,
String namespace)
Maps a Jenkins Job name to an ObjectShift BuildConfig name
|
static String |
dumpWithoutRuntimeStateAsYaml(io.fabric8.kubernetes.api.model.HasMetadata obj) |
static String |
formatTimestamp(long timestamp) |
static io.fabric8.openshift.client.OpenShiftClient |
getAuthenticatedOpenShiftClient() |
static String |
getExternalServiceUrl(io.fabric8.openshift.client.OpenShiftClient openShiftClient,
String defaultProtocolText,
String namespace,
String serviceName)
Returns the public URL of the given service
|
static String |
getJenkinsURL(io.fabric8.openshift.client.OpenShiftClient openShiftClient,
String namespace)
Calculates the external URL to access Jenkins
|
static String[] |
getNamespaceOrUseDefault(String[] configuredNamespaces,
io.fabric8.openshift.client.OpenShiftClient client)
Gets the current namespace running Jenkins inside or returns a reasonable default
|
static io.fabric8.openshift.client.OpenShiftClient |
getOpenShiftClient() |
static void |
initializeOpenShiftClient(String serverUrl)
Initializes an
OpenShiftClient |
static boolean |
isCancellable(io.fabric8.openshift.api.model.BuildStatus buildStatus) |
static boolean |
isCancelled(io.fabric8.openshift.api.model.BuildStatus status) |
static boolean |
isJenkinsBuildConfig(io.fabric8.openshift.api.model.BuildConfig bc)
Checks if a
BuildConfig relates to a Jenkins build |
static boolean |
isNew(io.fabric8.openshift.api.model.BuildStatus buildStatus) |
static boolean |
isResourceWithoutStateEqual(io.fabric8.kubernetes.api.model.HasMetadata oldObj,
io.fabric8.kubernetes.api.model.HasMetadata newObj) |
static String |
jenkinsJobDisplayName(io.fabric8.openshift.api.model.BuildConfig bc)
Finds the Jenkins job display name for the given
BuildConfig. |
static String |
jenkinsJobDisplayName(String namespace,
String buildConfigName)
Creates the Jenkins Job display name for the given buildConfigName
|
static String |
jenkinsJobName(io.fabric8.openshift.api.model.BuildConfig bc)
Finds the Jenkins job name for the given
BuildConfig. |
static String |
jenkinsJobName(String namespace,
String buildConfigName)
Creates the Jenkins Job name for the given buildConfigName
|
static long |
parseResourceVersion(io.fabric8.kubernetes.api.model.HasMetadata obj) |
static long |
parseResourceVersion(String resourceVersion) |
static long |
parseTimestamp(String timestamp) |
static void |
shutdownOpenShiftClient() |
static void |
updateGitSourceUrl(io.fabric8.openshift.api.model.BuildConfig buildConfig,
String gitUrl,
String ref)
Lazily creates the GitSource if need be then updates the git URL
|
static void |
updateOpenShiftBuildPhase(io.fabric8.openshift.api.model.Build build,
String phase) |
public static void initializeOpenShiftClient(String serverUrl)
OpenShiftClientserverUrl - the optional URL of where the OpenShift cluster API server is runningpublic static io.fabric8.openshift.client.OpenShiftClient getOpenShiftClient()
public static io.fabric8.openshift.client.OpenShiftClient getAuthenticatedOpenShiftClient()
public static void shutdownOpenShiftClient()
public static boolean isJenkinsBuildConfig(io.fabric8.openshift.api.model.BuildConfig bc)
BuildConfig relates to a Jenkins buildbc - the BuildConfigpublic static String jenkinsJobName(io.fabric8.openshift.api.model.BuildConfig bc)
BuildConfig.bc - the BuildConfigpublic static String jenkinsJobName(String namespace, String buildConfigName)
namespace - the namespace of the buildbuildConfigName - the name of the BuildConfig in in the namespacepublic static String jenkinsJobDisplayName(io.fabric8.openshift.api.model.BuildConfig bc)
BuildConfig.bc - the BuildConfigpublic static String jenkinsJobDisplayName(String namespace, String buildConfigName)
namespace - the namespace of the buildbuildConfigName - the name of the BuildConfig in in the namespacepublic static String[] getNamespaceOrUseDefault(String[] configuredNamespaces, io.fabric8.openshift.client.OpenShiftClient client)
configuredNamespaces - the optional configured namespace(s)client - the OpenShift clientpublic static String getExternalServiceUrl(io.fabric8.openshift.client.OpenShiftClient openShiftClient, String defaultProtocolText, String namespace, String serviceName)
openShiftClient - the OpenShiftClient to usedefaultProtocolText - the protocol text part of a URL such as http://namespace - the Kubernetes namespaceserviceName - the service namepublic static String getJenkinsURL(io.fabric8.openshift.client.OpenShiftClient openShiftClient, String namespace)
namespace - the namespace Jenkins is runing insideopenShiftClient - the OpenShift clientpublic static void updateGitSourceUrl(io.fabric8.openshift.api.model.BuildConfig buildConfig,
String gitUrl,
String ref)
buildConfig - the BuildConfig to updategitUrl - the URL to the git reporef - the git ref (commit/branch/etc) for the buildpublic static void updateOpenShiftBuildPhase(io.fabric8.openshift.api.model.Build build,
String phase)
public static NamespaceName buildConfigNameFromJenkinsJobName(String jobName, String namespace)
jobName - the job to associate to a BuildConfig namenamespace - the default namespace that Jenkins is running insidepublic static long parseResourceVersion(io.fabric8.kubernetes.api.model.HasMetadata obj)
public static long parseResourceVersion(String resourceVersion)
public static String formatTimestamp(long timestamp)
public static long parseTimestamp(String timestamp)
public static boolean isResourceWithoutStateEqual(io.fabric8.kubernetes.api.model.HasMetadata oldObj,
io.fabric8.kubernetes.api.model.HasMetadata newObj)
public static String dumpWithoutRuntimeStateAsYaml(io.fabric8.kubernetes.api.model.HasMetadata obj) throws com.fasterxml.jackson.core.JsonProcessingException
com.fasterxml.jackson.core.JsonProcessingExceptionpublic static boolean isCancellable(io.fabric8.openshift.api.model.BuildStatus buildStatus)
public static boolean isNew(io.fabric8.openshift.api.model.BuildStatus buildStatus)
public static boolean isCancelled(io.fabric8.openshift.api.model.BuildStatus status)
Copyright © 2016–2017 Red Hat. All rights reserved.