Add project to promotion url.

Along the way also remove unused code.

See #75
This commit is contained in:
Christoph Strobl
2024-02-16 11:23:18 +01:00
parent e71e1dadaf
commit ff9e9e983b
3 changed files with 3 additions and 26 deletions

View File

@@ -42,9 +42,6 @@ import org.springframework.web.util.UriTemplate;
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
public class DefaultDeploymentInformation implements DeploymentInformation {
private static UriTemplate REPOSITORY_TEMPLATE = new UriTemplate(
"artifactory::default::{server};build.number={buildNumber};build.name={buildName}");
private final @Getter @NonNull ModuleIteration module;
private final @NonNull DeploymentProperties properties;
private final @Getter String buildNumber;
@@ -124,20 +121,6 @@ public class DefaultDeploymentInformation implements DeploymentInformation {
return authentication.getRepositoryPrefix().concat(authentication.getTargetRepository());
}
/*
* (non-Javadoc)
* @see org.springframework.data.release.deployment.DeploymentInformation#getDeploymentTargetUrl()
*/
@Override
public String getDeploymentTargetUrl() {
Map<String, Object> parameters = new HashMap<>();
parameters.put("server", authentication.getTargetRepository());
parameters.putAll(getBuildInfoParameters());
return REPOSITORY_TEMPLATE.expand(parameters).toString();
}
/*
* (non-Javadoc)
* @see org.springframework.data.release.deployment.DeploymentInformation#getBuildInfoParameters()
@@ -148,6 +131,7 @@ public class DefaultDeploymentInformation implements DeploymentInformation {
Map<String, Object> parameters = new HashMap<>();
parameters.put("buildNumber", getBuildNumber());
parameters.put("buildName", getBuildName());
parameters.put("project", getProject());
return parameters;
}

View File

@@ -48,13 +48,6 @@ public interface DeploymentInformation {
*/
String getProject();
/**
* Returns the full URL to be used as deployment target.
*
* @return will never be {@literal null} or empty.
*/
String getDeploymentTargetUrl();
/**
* Returns the name of the repository to deploy to.
*

View File

@@ -53,8 +53,8 @@ public class DeploymentProperties {
@Data
public static class Server {
private static final String PROMOTION_RESOURCE = "/api/build/promote/{buildName}/{buildNumber}";
private static final String DELETE_BUILD_RESOURCE = "/api/build/{buildName}?buildNumbers={buildNumber}&artifacts=1";
private static final String PROMOTION_RESOURCE = "/api/build/promote/{buildName}/{buildNumber}?project={project}";
private static final String DELETE_BUILD_RESOURCE = "/api/build/{buildName}?buildNumbers={buildNumber}&artifacts=1&project={project}";
private static final String VERIFICATION_RESOURCE = "/api/storage/{verificationResource}";
private String uri;