Add maven central syncing to release process.

This commit is contained in:
Greg Turnquist
2018-11-28 11:03:07 -06:00
parent 5320a76ccf
commit df04491c8e
4 changed files with 100 additions and 7 deletions

View File

@@ -28,8 +28,8 @@ WARNING: Do NOT check this file into source control! If you'll check, `credentia
With this in place, run the following `fly` commands to create pipelines:
----
% 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
% 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
% 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
% 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
----
This creates pipelines for:
@@ -40,8 +40,8 @@ This creates pipelines for:
With these pipelines in place, you can now activate and expose them:
----
% fly -t <team-name> unpause-pipeline -p spring-session-data-mongodb
% fly -t <team-name> expose-pipeline -p spring-session-data-mongodb
% fly -t <team-name> unpause-pipeline -p spring-session-data-mongodb-2.0.x
% fly -t <team-name> expose-pipeline -p spring-session-data-mongodb-2.x
% fly -t spring-team unpause-pipeline -p spring-session-data-mongodb
% fly -t spring-team expose-pipeline -p spring-session-data-mongodb
% fly -t spring-team unpause-pipeline -p spring-session-data-mongodb-2.0.x
% fly -t spring-team expose-pipeline -p spring-session-data-mongodb-2.x
----

View File

@@ -104,6 +104,7 @@ groups:
jobs:
- release-to-artifactory
- promote-to-bintray
- sync-to-maven-central
jobs:
- name: Test - JDK 8
@@ -683,7 +684,6 @@ jobs:
- name: promote-to-bintray
serial: true
public: true
plan:
- get: spring-session-data-mongodb-artifactory
trigger: true
@@ -725,3 +725,51 @@ jobs:
text: "Promoting to bintray has succeeded!"
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
- name: sync-to-maven-central
serial: true
plan:
- get: spring-session-data-mongodb-github
resource: spring-session-data-mongodb-release
- get: spring-session-data-mongodb-artifactory
trigger: true
passed: [promote-to-bintray]
params:
save_build_info: true
- task: sync-to-maven-central
file: spring-session-data-mongodb-github/ci/sync-to-maven-central.yml
params:
BINTRAY_USERNAME: ((bintray-username))
BINTRAY_API_KEY: ((bintray-api-key))
SONATYPE_USER_TOKEN: ((sonatype-user-token))
SONATYPE_PASSWORD_TOKEN: ((sonatype-user-token-password))
ARTIFACTORY_USERNAME: ((artifactory-username))
ARTIFACTORY_PASSWORD: ((artifactory-password))
on_failure:
aggregate:
- put: spring-session-data-mongodb-status
params:
commit: spring-session-data-mongodb-github
state: failure
- put: slack
params:
attachments:
- color: danger
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <FAILURE>"
text: "Syncing to maven central has failed"
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
on_success:
aggregate:
- put: spring-session-data-mongodb-status
params:
commit: spring-session-data-mongodb-github
state: success
- put: slack
params:
attachments:
- color: good
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <SUCCESS>"
text: "Syncing to maven central has succeeded!"
title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME"
title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME

24
ci/sync-to-maven-central.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
set -e -u
apt-get update
apt-get install -y jq
buildName=$( cat spring-session-data-mongodb-artifactory/build-info.json | jq -r '.buildInfo.name' )
buildNumber=$( cat spring-session-data-mongodb-artifactory/build-info.json | jq -r '.buildInfo.number' )
groupId=$( cat spring-session-data-mongodb-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' )
version=$( cat spring-session-data-mongodb-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' )
echo "Syncing ${buildName}/${buildNumber} to Maven Central"
curl \
-s \
--connect-timeout 240 \
--max-time 2700 \
-u ${BINTRAY_USERNAME}:${BINTRAY_API_KEY} \
-H "Content-Type: application/json" -d "{ \"username\": \"${SONATYPE_USER_TOKEN}\", \"password\": \"${SONATYPE_PASSWORD_TOKEN}\"}" \
-f \
-X \
POST "https://api.bintray.com/maven_central_sync/spring/jars/${groupId}/versions/${version}" > /dev/null || { echo "Failed to sync" >&2; exit 1; }
echo "Sync complete"

View File

@@ -0,0 +1,21 @@
---
platform: linux
image_resource:
type: docker-image
source:
repository: openjdk
tag: 8-jdk
inputs:
- name: spring-session-data-mongodb-artifactory
- name: spring-session-data-mongodb-github
run:
path: spring-session-data-mongodb-github/ci/sync-to-maven-central.sh
params:
BINTRAY_USERNAME:
BINTRAY_API_KEY:
SONATYPE_USER_TOKEN:
SONATYPE_PASSWORD_TOKEN: