Skip to content

Commit 98ee724

Browse files
committed
Stop using Bintray to publish to Maven Central
This commit reworks the CI pipeline to remove the use of Bintray for publishing to Maven Central. In its place it adds a new publishToCentral command to the release scripts. This command can be used to publish a directory tree of artifacts to the Maven Central gateway hosted by Sonatype. Publishing consists of 4 steps: 1. Create the staging repository 2. Deploy artifacts to the repository 3. Close the repository 4. Release the repository The command requires 3 arguments: 1. The type of release being performed 2. Location of a build info JSON file that describes the release that is to be deployed 3. Root of a directory structure, in Maven repository layout, that contains the artifacts to be deployed Closes gh-25107
1 parent 29d46c8 commit 98ee724

File tree

184 files changed

+2320
-1502
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+2320
-1502
lines changed

ci/images/releasescripts/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<spring-javaformat.version>0.0.26</spring-javaformat.version>
2020
</properties>
2121
<dependencies>
22+
<dependency>
23+
<groupId>org.bouncycastle</groupId>
24+
<artifactId>bcpg-jdk15to18</artifactId>
25+
<version>1.68</version>
26+
</dependency>
2227
<dependency>
2328
<groupId>org.springframework.boot</groupId>
2429
<artifactId>spring-boot-starter</artifactId>

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/artifactory/ArtifactoryService.java

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,10 @@
1717
package io.spring.concourse.releasescripts.artifactory;
1818

1919
import java.net.URI;
20-
import java.time.Duration;
21-
import java.util.Set;
2220

2321
import io.spring.concourse.releasescripts.ReleaseInfo;
2422
import io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse;
25-
import io.spring.concourse.releasescripts.artifactory.payload.DistributionRequest;
2623
import io.spring.concourse.releasescripts.artifactory.payload.PromotionRequest;
27-
import io.spring.concourse.releasescripts.bintray.BintrayService;
2824
import org.slf4j.Logger;
2925
import org.slf4j.LoggerFactory;
3026

@@ -53,17 +49,11 @@ public class ArtifactoryService {
5349

5450
private static final String BUILD_INFO_URL = ARTIFACTORY_URL + "/api/build/";
5551

56-
private static final String DISTRIBUTION_URL = ARTIFACTORY_URL + "/api/build/distribute/";
57-
5852
private static final String STAGING_REPO = "libs-staging-local";
5953

6054
private final RestTemplate restTemplate;
6155

62-
private final BintrayService bintrayService;
63-
64-
public ArtifactoryService(RestTemplateBuilder builder, ArtifactoryProperties artifactoryProperties,
65-
BintrayService bintrayService) {
66-
this.bintrayService = bintrayService;
56+
public ArtifactoryService(RestTemplateBuilder builder, ArtifactoryProperties artifactoryProperties) {
6757
String username = artifactoryProperties.getUsername();
6858
String password = artifactoryProperties.getPassword();
6959
if (StringUtils.hasLength(username)) {
@@ -116,37 +106,6 @@ private boolean isAlreadyPromoted(String buildName, String buildNumber, String t
116106
}
117107
}
118108

119-
/**
120-
* Deploy builds from Artifactory to Bintray.
121-
* @param sourceRepo the source repo in Artifactory.
122-
* @param releaseInfo the resease info
123-
* @param artifactDigests the artifact digests
124-
*/
125-
public void distribute(String sourceRepo, ReleaseInfo releaseInfo, Set<String> artifactDigests) {
126-
logger.debug("Attempting distribute via Artifactory");
127-
if (!this.bintrayService.isDistributionStarted(releaseInfo)) {
128-
startDistribute(sourceRepo, releaseInfo);
129-
}
130-
if (!this.bintrayService.isDistributionComplete(releaseInfo, artifactDigests, Duration.ofMinutes(60))) {
131-
throw new DistributionTimeoutException("Distribution timed out.");
132-
}
133-
}
134-
135-
private void startDistribute(String sourceRepo, ReleaseInfo releaseInfo) {
136-
DistributionRequest request = new DistributionRequest(new String[] { sourceRepo });
137-
RequestEntity<DistributionRequest> requestEntity = RequestEntity
138-
.post(URI.create(DISTRIBUTION_URL + releaseInfo.getBuildName() + "/" + releaseInfo.getBuildNumber()))
139-
.contentType(MediaType.APPLICATION_JSON).body(request);
140-
try {
141-
this.restTemplate.exchange(requestEntity, Object.class);
142-
logger.debug("Distribute call completed");
143-
}
144-
catch (HttpClientErrorException ex) {
145-
logger.info("Failed to distribute.");
146-
throw ex;
147-
}
148-
}
149-
150109
private PromotionRequest getPromotionRequest(String targetRepo) {
151110
return new PromotionRequest("staged", STAGING_REPO, targetRepo);
152111
}

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/bintray/BintrayProperties.java

Lines changed: 0 additions & 69 deletions
This file was deleted.

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/bintray/BintrayService.java

Lines changed: 0 additions & 192 deletions
This file was deleted.

0 commit comments

Comments
 (0)