in aws-codedeploy-common/src/main/java/jetbrains/buildServer/runner/codedeploy/ParametersValidator.java [49:123]
private static Map<String, String> validate(@NotNull Map<String, String> runnerParams, boolean runtime) {
final Map<String, String> invalids = new HashMap<String, String>();
invalids.putAll(AWSCommonParams.validate(runnerParams, !runtime));
boolean uploadStepEnabled = false;
boolean registerStepEnabled = false;
boolean deployStepEnabled = false;
final String deploymentSteps = getDeploymentSteps(runnerParams);
if (StringUtil.isEmptyOrSpaces(deploymentSteps)) {
invalids.put(DEPLOYMENT_STEPS_PARAM, DEPLOYMENT_STEPS_LABEL + " must not be empty");
} else {
uploadStepEnabled = isUploadStepEnabled(runnerParams);
registerStepEnabled = isRegisterStepEnabled(runnerParams);
deployStepEnabled = isDeployStepEnabled(runnerParams);
if (!uploadStepEnabled && !registerStepEnabled && !deployStepEnabled) {
invalids.put(DEPLOYMENT_STEPS_PARAM, DEPLOYMENT_STEPS_LABEL + " has unexpected value " + deploymentSteps);
}
}
if (uploadStepEnabled) {
final String revisionPaths = getRevisionPaths(runnerParams);
if (StringUtil.isEmptyOrSpaces(revisionPaths)) {
invalids.put(REVISION_PATHS_PARAM, REVISION_PATHS_LABEL + " must not be empty");
} else if (!isReference(revisionPaths, runtime)) {
final String readyRevision = getReadyRevision(revisionPaths);
if (readyRevision == null) {
if (getRevisionPathMappings(revisionPaths).isEmpty()) {
invalids.put(REVISION_PATHS_PARAM, REVISION_PATHS_LABEL + " has unexpected value, " + REVISION_PATHS_NOTE);
}
}
}
}
if (uploadStepEnabled || registerStepEnabled || deployStepEnabled) {
final String s3BucketName = getS3BucketName(runnerParams);
if (StringUtil.isEmptyOrSpaces(s3BucketName)) {
invalids.put(S3_BUCKET_NAME_PARAM, S3_BUCKET_NAME_LABEL + " must not be empty");
} else if (s3BucketName.contains("/")) {
invalids.put(S3_BUCKET_NAME_PARAM, S3_BUCKET_NAME_LABEL + " must not contain / characters. For addressing folders use " + S3_OBJECT_KEY_LABEL + " parameter");
}
final String s3ObjectKey = getS3ObjectKey(runnerParams);
if (StringUtil.isEmptyOrSpaces(s3ObjectKey)) {
if (!uploadStepEnabled) {
invalids.put(S3_OBJECT_KEY_PARAM, S3_OBJECT_KEY_LABEL + " must not be empty");
}
} else {
validateS3Key(invalids, s3ObjectKey, S3_OBJECT_KEY_PARAM, S3_OBJECT_KEY_LABEL, runtime);
if (registerStepEnabled || deployStepEnabled) {
validateBundleType(invalids, s3ObjectKey, S3_OBJECT_KEY_PARAM, S3_OBJECT_KEY_LABEL, runtime);
}
}
}
if (registerStepEnabled || deployStepEnabled) {
if (StringUtil.isEmptyOrSpaces(getAppName(runnerParams))) {
invalids.put(APP_NAME_PARAM, APP_NAME_LABEL + " must not be empty");
}
}
if (deployStepEnabled) {
if (StringUtil.isEmptyOrSpaces(getDeploymentGroupName(runnerParams))) {
invalids.put(DEPLOYMENT_GROUP_NAME_PARAM, DEPLOYMENT_GROUP_NAME_LABEL + " must not be empty");
}
final String fileExistsParam = getFileExistsBehavior(runnerParams);
if (StringUtil.isNotEmpty(fileExistsParam)) {
validateFileExistsBehavior(invalids, fileExistsParam, FILE_EXISTS_BEHAVIOR_PARAM, FILE_EXISTS_BEHAVIOR_PARAM, runtime);
}
}
return invalids;
}