Skip to content

Commit df04491

Browse files
committed
Add maven central syncing to release process.
1 parent 5320a76 commit df04491

File tree

4 files changed

+100
-7
lines changed

4 files changed

+100
-7
lines changed

ci/README.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ WARNING: Do NOT check this file into source control! If you'll check, `credentia
2828
With this in place, run the following `fly` commands to create pipelines:
2929

3030
----
31-
% fly -t <team-name> sp -p spring-session-data-mongodb -c ci/pipeline-template.yml -l credentials.yml -v branch=master -v release-branch=release
32-
% fly -t <team-name> sp -p spring-session-data-mongodb-2.0.x -c ci/pipeline-template.yml -l credentials.yml -v branch=2.0.x -v release-branch=release-2.0.x
31+
% fly -t spring-team sp -p spring-session-data-mongodb -c ci/pipeline-template.yml -l credentials.yml -v branch=master -v release-branch=release
32+
% fly -t spring-team sp -p spring-session-data-mongodb-2.0.x -c ci/pipeline-template.yml -l credentials.yml -v branch=2.0.x -v release-branch=release-2.0.x
3333
----
3434

3535
This creates pipelines for:
@@ -40,8 +40,8 @@ This creates pipelines for:
4040
With these pipelines in place, you can now activate and expose them:
4141

4242
----
43-
% fly -t <team-name> unpause-pipeline -p spring-session-data-mongodb
44-
% fly -t <team-name> expose-pipeline -p spring-session-data-mongodb
45-
% fly -t <team-name> unpause-pipeline -p spring-session-data-mongodb-2.0.x
46-
% fly -t <team-name> expose-pipeline -p spring-session-data-mongodb-2.x
43+
% fly -t spring-team unpause-pipeline -p spring-session-data-mongodb
44+
% fly -t spring-team expose-pipeline -p spring-session-data-mongodb
45+
% fly -t spring-team unpause-pipeline -p spring-session-data-mongodb-2.0.x
46+
% fly -t spring-team expose-pipeline -p spring-session-data-mongodb-2.x
4747
----

ci/pipeline-template.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ groups:
104104
jobs:
105105
- release-to-artifactory
106106
- promote-to-bintray
107+
- sync-to-maven-central
107108

108109
jobs:
109110
- name: Test - JDK 8
@@ -683,7 +684,6 @@ jobs:
683684

684685
- name: promote-to-bintray
685686
serial: true
686-
public: true
687687
plan:
688688
- get: spring-session-data-mongodb-artifactory
689689
trigger: true
@@ -725,3 +725,51 @@ jobs:
725725
text: "Promoting to bintray has succeeded!"
726726
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
727727
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
728+
729+
- name: sync-to-maven-central
730+
serial: true
731+
plan:
732+
- get: spring-session-data-mongodb-github
733+
resource: spring-session-data-mongodb-release
734+
- get: spring-session-data-mongodb-artifactory
735+
trigger: true
736+
passed: [promote-to-bintray]
737+
params:
738+
save_build_info: true
739+
- task: sync-to-maven-central
740+
file: spring-session-data-mongodb-github/ci/sync-to-maven-central.yml
741+
params:
742+
BINTRAY_USERNAME: ((bintray-username))
743+
BINTRAY_API_KEY: ((bintray-api-key))
744+
SONATYPE_USER_TOKEN: ((sonatype-user-token))
745+
SONATYPE_PASSWORD_TOKEN: ((sonatype-user-token-password))
746+
ARTIFACTORY_USERNAME: ((artifactory-username))
747+
ARTIFACTORY_PASSWORD: ((artifactory-password))
748+
on_failure:
749+
aggregate:
750+
- put: spring-session-data-mongodb-status
751+
params:
752+
commit: spring-session-data-mongodb-github
753+
state: failure
754+
- put: slack
755+
params:
756+
attachments:
757+
- color: danger
758+
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <FAILURE>"
759+
text: "Syncing to maven central has failed"
760+
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
761+
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
762+
on_success:
763+
aggregate:
764+
- put: spring-session-data-mongodb-status
765+
params:
766+
commit: spring-session-data-mongodb-github
767+
state: success
768+
- put: slack
769+
params:
770+
attachments:
771+
- color: good
772+
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <SUCCESS>"
773+
text: "Syncing to maven central has succeeded!"
774+
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
775+
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME

ci/sync-to-maven-central.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
set -e -u
4+
5+
apt-get update
6+
apt-get install -y jq
7+
8+
buildName=$( cat spring-session-data-mongodb-artifactory/build-info.json | jq -r '.buildInfo.name' )
9+
buildNumber=$( cat spring-session-data-mongodb-artifactory/build-info.json | jq -r '.buildInfo.number' )
10+
groupId=$( cat spring-session-data-mongodb-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' )
11+
version=$( cat spring-session-data-mongodb-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' )
12+
13+
echo "Syncing ${buildName}/${buildNumber} to Maven Central"
14+
curl \
15+
-s \
16+
--connect-timeout 240 \
17+
--max-time 2700 \
18+
-u ${BINTRAY_USERNAME}:${BINTRAY_API_KEY} \
19+
-H "Content-Type: application/json" -d "{ \"username\": \"${SONATYPE_USER_TOKEN}\", \"password\": \"${SONATYPE_PASSWORD_TOKEN}\"}" \
20+
-f \
21+
-X \
22+
POST "https://api.bintray.com/maven_central_sync/spring/jars/${groupId}/versions/${version}" > /dev/null || { echo "Failed to sync" >&2; exit 1; }
23+
24+
echo "Sync complete"

ci/sync-to-maven-central.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
platform: linux
3+
4+
image_resource:
5+
type: docker-image
6+
source:
7+
repository: openjdk
8+
tag: 8-jdk
9+
10+
inputs:
11+
- name: spring-session-data-mongodb-artifactory
12+
- name: spring-session-data-mongodb-github
13+
14+
run:
15+
path: spring-session-data-mongodb-github/ci/sync-to-maven-central.sh
16+
17+
params:
18+
BINTRAY_USERNAME:
19+
BINTRAY_API_KEY:
20+
SONATYPE_USER_TOKEN:
21+
SONATYPE_PASSWORD_TOKEN:

0 commit comments

Comments
 (0)