Introduce ability to promote to bintray.
This commit is contained in:
@@ -4,7 +4,7 @@ resource_types:
|
||||
type: docker-image
|
||||
source:
|
||||
repository: springio/artifactory-resource
|
||||
tag: 0.0.4
|
||||
tag: 0.0.6
|
||||
|
||||
- name: github-status
|
||||
type: docker-image
|
||||
@@ -54,7 +54,7 @@ resources:
|
||||
uri: https://repo.spring.io
|
||||
username: ((artifactory-username))
|
||||
password: ((artifactory-password))
|
||||
build_name: Spring Session for MongoDB
|
||||
build_name: spring-session-data-mongodb
|
||||
|
||||
- name: spring-session-data-mongodb-pull-requests
|
||||
type: pull-request
|
||||
@@ -68,7 +68,7 @@ resources:
|
||||
source:
|
||||
uri: https://github.com/spring-projects/spring-session-data-mongodb.git
|
||||
branch: ((release-branch))
|
||||
|
||||
|
||||
- name: spring-session-data-mongodb-status
|
||||
type: github-status
|
||||
source:
|
||||
@@ -102,7 +102,8 @@ groups:
|
||||
- spring-session-data-mongodb-pull-requests
|
||||
- name: release
|
||||
jobs:
|
||||
- spring-session-data-mongodb-release
|
||||
- release-to-artifactory
|
||||
- promote-to-bintray
|
||||
|
||||
jobs:
|
||||
- name: Test - JDK 8
|
||||
@@ -609,7 +610,7 @@ jobs:
|
||||
attachments:
|
||||
- color: danger
|
||||
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <FAILURE>"
|
||||
text: "Build has failed"
|
||||
text: "Pull request 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:
|
||||
@@ -623,11 +624,11 @@ jobs:
|
||||
attachments:
|
||||
- color: good
|
||||
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <SUCCESS>"
|
||||
text: "Build has succeeded!"
|
||||
text: "Pull request 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: spring-session-data-mongodb-release
|
||||
- name: release-to-artifactory
|
||||
serial: true
|
||||
public: true
|
||||
plan:
|
||||
@@ -662,7 +663,7 @@ jobs:
|
||||
attachments:
|
||||
- color: danger
|
||||
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <FAILURE>"
|
||||
text: "Build has failed"
|
||||
text: "Releasing to artifactory 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:
|
||||
@@ -676,6 +677,51 @@ jobs:
|
||||
attachments:
|
||||
- color: good
|
||||
fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME <SUCCESS>"
|
||||
text: "Build has succeeded!"
|
||||
text: "Releasing to artifactory 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: promote-to-bintray
|
||||
serial: true
|
||||
public: true
|
||||
plan:
|
||||
- get: spring-session-data-mongodb-artifactory
|
||||
trigger: true
|
||||
passed: [release-to-artifactory]
|
||||
params:
|
||||
save_build_info: true
|
||||
- get: spring-session-data-mongodb-github
|
||||
resource: spring-session-data-mongodb-release
|
||||
- task: promote-to-bintray
|
||||
file: spring-session-data-mongodb-github/ci/promote-to-bintray.yml
|
||||
params:
|
||||
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: "Promoting to bintray 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: "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
|
||||
|
||||
46
ci/promote-to-bintray.sh
Executable file
46
ci/promote-to-bintray.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/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/' )
|
||||
targetRepo="libs-release-local"
|
||||
|
||||
echo "Promoting ${buildName}/${buildNumber} to ${targetRepo}"
|
||||
|
||||
curl \
|
||||
-s \
|
||||
--connect-timeout 240 \
|
||||
--max-time 2700 \
|
||||
-u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \
|
||||
-H "Content-type:application/json" \
|
||||
-d "{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\", \"async\":\"true\"}" \
|
||||
-f \
|
||||
-X \
|
||||
POST "https://repo.spring.io/api/build/distribute/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to distribute" >&2; exit 1; }
|
||||
|
||||
echo "Waiting for artifacts to be published"
|
||||
|
||||
ARTIFACTS_PUBLISHED=false
|
||||
WAIT_TIME=10
|
||||
COUNTER=0
|
||||
|
||||
while [ $ARTIFACTS_PUBLISHED == "false" ] && [ $COUNTER -lt 120 ]; do
|
||||
|
||||
result=$( curl -s https://api.bintray.com/packages/spring/jars/"${groupId}" )
|
||||
versions=$( echo "$result" | jq -r '.versions' )
|
||||
exists=$( echo "$versions" | grep "$version" -o || true )
|
||||
|
||||
if [ "$exists" = "$version" ]; then
|
||||
ARTIFACTS_PUBLISHED=true
|
||||
fi
|
||||
|
||||
COUNTER=$(( COUNTER + 1 ))
|
||||
sleep $WAIT_TIME
|
||||
|
||||
done
|
||||
19
ci/promote-to-bintray.yml
Normal file
19
ci/promote-to-bintray.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
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/promote-to-bintray.sh
|
||||
|
||||
params:
|
||||
ARTIFACTORY_USERNAME:
|
||||
ARTIFACTORY_PASSWORD:
|
||||
Reference in New Issue
Block a user