/** * Check that the releaseVersion field is not empty. * * @param releaseVersion The release version of the package. * @param project The project name * @return Ok if not empty, error otherwise. */ public FormValidation doCheckReleaseVersion( @QueryParameter String releaseVersion, @QueryParameter String project) { setGlobalConfiguration(); releaseVersion = releaseVersion.trim(); if (project == null || project.isEmpty()) { return FormValidation.warning(PROJECT_RELEASE_VALIDATION_MESSAGE); } com.octopusdeploy.api.Project p; try { p = api.getProjectByName(project); if (p == null) { return FormValidation.warning(PROJECT_RELEASE_VALIDATION_MESSAGE); } } catch (Exception ex) { return FormValidation.warning(PROJECT_RELEASE_VALIDATION_MESSAGE); } OctopusValidator validator = new OctopusValidator(api); return validator.validateRelease( releaseVersion, p.getId(), OctopusValidator.ReleaseExistenceRequirement.MustExist); }
/** * Check that the environment field is not empty. * * @param environment The name of the project. * @return Ok if not empty, error otherwise. */ public FormValidation doCheckEnvironment(@QueryParameter String environment) { setGlobalConfiguration(); environment = environment.trim(); OctopusValidator validator = new OctopusValidator(api); return validator.validateEnvironment(environment); }
/** * Check that the project field is not empty and is a valid project. * * @param project The name of the project. * @return Ok if not empty, error otherwise. */ public FormValidation doCheckProject(@QueryParameter String project) { setGlobalConfiguration(); project = project.trim(); OctopusValidator validator = new OctopusValidator(api); return validator.validateProject(project); }