public abstract class AbstractDevOpsAction
extends hudson.tasks.Recorder
hudson.tasks.Publisher.DescriptorExtensionListImpl
Modifier and Type | Field and Description |
---|---|
static String |
API_KEY |
static String |
APP_NAME |
static String |
CONTROL_CENTER |
static String |
DEFAULT_ENV |
static String |
DLMS |
static String |
ENV |
static String |
GATE_SERVICE |
static Logger |
LOGGER |
static String |
PASSWORD |
static String |
RESULT_FAIL |
static String |
RESULT_SUCCESS |
static String |
TOOLCHAIN_ID |
static String |
USERNAME |
Constructor and Description |
---|
AbstractDevOpsAction() |
Modifier and Type | Method and Description |
---|---|
static String |
chooseAppsUrl(String environment) |
static String |
chooseIAMAPI(String environment) |
static String |
chooseOrganizationsUrl(String environment) |
static String |
chooseSpacesUrl(String environment) |
static String |
chooseTargetAPI(String environment) |
static String |
constructBuildNumber(String jobName,
hudson.model.Run build)
construct the build number, format will be the jobName:buildNumber
|
static String |
expandVariable(String key,
hudson.EnvVars envVars,
boolean isRequired)
expand the env var and check if it is a required var
|
static Map<String,String> |
getAllEndpoints(String OTCBrokerServer,
String token,
String toolchainId) |
static String |
getAppId(String token,
String appName,
String orgName,
String spaceName,
String environment,
Boolean debug_mode) |
static String |
getBluemixToken(String username,
String password,
String targetAPI,
PrintStream printStream)
given the username and password, get the UAA token
|
static String |
getBuildNumber(hudson.EnvVars envVars,
String jobName,
hudson.model.Run build,
PrintStream printStream)
get build number if it is not specified
|
static com.google.gson.JsonObject |
getDecisionFromDRA(String bluemixToken,
String toolchainId,
String draUrl,
PrintStream printStream,
boolean isDebugMode)
Get gate decision from DevOps Insights
|
static String |
getDeploymentRiskUrl(String baseUrl,
String toolchainId) |
static String |
getIAMToken(String apikey,
String iamAPI,
PrintStream printStream)
get IAM token using API key
|
static String |
getIBMCloudToken(String credentialsId,
String apikey,
String username,
String password,
String env,
hudson.model.Job context,
PrintStream printStream)
get token for either pipeline or freestyle in the runtime
|
static String |
getOrgId(String token,
String orgName,
String environment,
Boolean debug_mode) |
static String |
getOTCBrokerServer(String env)
get the OTC broker server endpoint
|
static hudson.util.ListBoxModel |
getPolicyList(String token,
String toolchainId,
String environment,
boolean isDebugMode)
Get a list of policies that belong to a toolchain
|
static String |
getReportUrl(String baseUrl,
String toolchainId,
String reportId) |
static String |
getSpaceId(String token,
String spaceName,
String environment,
Boolean debug_mode) |
static String |
getTokenForFreeStyleJob(com.cloudbees.plugins.credentials.common.StandardCredentials credentials,
String iamAPI,
String targetAPI,
PrintStream printStream)
get IAM or UAA token based on the credentials id, only used by freestyle job's test connection or get the policy list
|
static void |
passEnvToNextBuildStep(hudson.model.Run build,
String bluemixToken,
String buildId)
write to the environment variables to pass to next build step
|
static void |
printDebugLog(PrintStream printStream,
org.apache.http.client.methods.HttpEntityEnclosingRequestBase method,
String status,
String resStr) |
static void |
publishDecision(com.google.gson.JsonObject obj,
hudson.model.Run build,
String reportUrl,
String ccUrl,
String policyName,
boolean willDisrupt,
PrintStream printStream)
publish the decision to Jenkins UI and fail the build/job/pipeline if needed
|
static String |
setDLMSUrl(String baseUrl,
String toolchainId,
String appName,
String buildId)
set DLMS endpoint url to upload data to DLMS
|
static String |
setGateServiceUrl(String baseUrl,
String toolchainId,
String applicationName,
String buildId,
String policyName,
String environmentName) |
static HashMap<String,String> |
setRequiredEnvVars(AbstractDevOpsStep step,
hudson.EnvVars envVars)
set the required env variables' HashMap for all steps
|
all, getProjectAction, needsToRunAfterFinalized, prebuild
getProjectAction, getProjectActions, perform, perform, prebuild
public static final Logger LOGGER
public static final String APP_NAME
public static final String TOOLCHAIN_ID
public static final String USERNAME
public static final String PASSWORD
public static final String API_KEY
public static final String ENV
public static final String RESULT_SUCCESS
public static final String RESULT_FAIL
public static final String DEFAULT_ENV
public static final String DLMS
public static final String GATE_SERVICE
public static final String CONTROL_CENTER
public static String getOTCBrokerServer(String env)
env
- public static Map<String,String> getAllEndpoints(String OTCBrokerServer, String token, String toolchainId) throws Exception
Exception
public static HashMap<String,String> setRequiredEnvVars(AbstractDevOpsStep step, hudson.EnvVars envVars)
step
- envVars
- public static String getTokenForFreeStyleJob(com.cloudbees.plugins.credentials.common.StandardCredentials credentials, String iamAPI, String targetAPI, PrintStream printStream) throws Exception
iamAPI
- targetAPI
- credentials
- Exception
public static String getIBMCloudToken(String credentialsId, String apikey, String username, String password, String env, hudson.model.Job context, PrintStream printStream) throws Exception
credentialsId
- apikey
- username
- password
- env
- context
- Exception
public static String getBluemixToken(String username, String password, String targetAPI, PrintStream printStream) throws MalformedURLException, org.cloudfoundry.client.lib.CloudFoundryException
username
- password
- targetAPI
- MalformedURLException
org.cloudfoundry.client.lib.CloudFoundryException
public static String getIAMToken(String apikey, String iamAPI, PrintStream printStream) throws Exception
apikey
- iamAPI
- Exception
public static String setDLMSUrl(String baseUrl, String toolchainId, String appName, String buildId) throws UnsupportedEncodingException
baseUrl
- toolchainId
- appName
- buildId
- UnsupportedEncodingException
public static String setGateServiceUrl(String baseUrl, String toolchainId, String applicationName, String buildId, String policyName, String environmentName) throws UnsupportedEncodingException
UnsupportedEncodingException
public static String getDeploymentRiskUrl(String baseUrl, String toolchainId) throws URISyntaxException
URISyntaxException
public static String getReportUrl(String baseUrl, String toolchainId, String reportId) throws URISyntaxException
URISyntaxException
public static String getBuildNumber(hudson.EnvVars envVars, String jobName, hudson.model.Run build, PrintStream printStream) throws Exception
envVars
- jobName
- build
- Exception
public static String constructBuildNumber(String jobName, hudson.model.Run build)
build
- public static String expandVariable(String key, hudson.EnvVars envVars, boolean isRequired) throws Exception
key
- envVars
- isRequired
- Exception
public static String getOrgId(String token, String orgName, String environment, Boolean debug_mode)
public static String getSpaceId(String token, String spaceName, String environment, Boolean debug_mode)
public static String getAppId(String token, String appName, String orgName, String spaceName, String environment, Boolean debug_mode)
public static hudson.util.ListBoxModel getPolicyList(String token, String toolchainId, String environment, boolean isDebugMode)
token
- toolchainId
- environment
- isDebugMode
- public static com.google.gson.JsonObject getDecisionFromDRA(String bluemixToken, String toolchainId, String draUrl, PrintStream printStream, boolean isDebugMode) throws Exception
bluemixToken
- toolchainId
- draUrl
- printStream
- IOException
Exception
public static void publishDecision(com.google.gson.JsonObject obj, hudson.model.Run build, String reportUrl, String ccUrl, String policyName, boolean willDisrupt, PrintStream printStream) throws hudson.AbortException
obj
- build
- reportUrl
- ccUrl
- policyName
- willDisrupt
- printStream
- hudson.AbortException
public static void printDebugLog(PrintStream printStream, org.apache.http.client.methods.HttpEntityEnclosingRequestBase method, String status, String resStr)
public static void passEnvToNextBuildStep(hudson.model.Run build, String bluemixToken, String buildId)
build
- - the current buildbluemixToken
- - the Bluemix TokenbuildId
- - the build number of the build job in the JenkinsCopyright © 2016–2020. All rights reserved.