Browse Source
This commit finishes the first step for migrating our complete build and release pipeline to Concourse CI. We're creating here a new "Release" jobs group in our pipeline. We can now release Milestones from our pipeline with: * the "stage-milestone" job, which creates and tags a new Milestone version on the source repository, builds the artifacts and deploys them in a staging repository and updates the version to the next SNAPSHOT. * the "promote-milestone" fetches the build information from the staging repository and promotes the released milestone in the official milestone repository. Interactions with the Artifactory and Bintray REST APIs are done using the https://github.com/spring-io/concourse-release-scripts project. Closes gh-22490pull/25036/head
6 changed files with 142 additions and 0 deletions
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash |
||||
|
||||
source $(dirname $0)/common.sh |
||||
|
||||
version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) |
||||
export BUILD_INFO_LOCATION=$(pwd)/artifactory-repo/build-info.json |
||||
|
||||
java -jar /opt/concourse-release-scripts.jar promote $RELEASE_TYPE $BUILD_INFO_LOCATION > /dev/null || { exit 1; } |
||||
|
||||
java -jar /opt/concourse-release-scripts.jar distribute $RELEASE_TYPE $BUILD_INFO_LOCATION > /dev/null || { exit 1; } |
||||
|
||||
echo "Promotion complete" |
||||
echo $version > version/version |
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash |
||||
set -e |
||||
|
||||
source $(dirname $0)/common.sh |
||||
repository=$(pwd)/distribution-repository |
||||
|
||||
pushd git-repo > /dev/null |
||||
git fetch --tags --all > /dev/null |
||||
popd > /dev/null |
||||
|
||||
git clone git-repo stage-git-repo > /dev/null |
||||
|
||||
pushd stage-git-repo > /dev/null |
||||
|
||||
snapshotVersion=$( awk -F '=' '$1 == "version" { print $2 }' gradle.properties ) |
||||
if [[ $RELEASE_TYPE = "M" ]]; then |
||||
stageVersion=$( get_next_milestone_release $snapshotVersion) |
||||
nextVersion=$snapshotVersion |
||||
elif [[ $RELEASE_TYPE = "RC" ]]; then |
||||
stageVersion=$( get_next_rc_release $snapshotVersion) |
||||
nextVersion=$snapshotVersion |
||||
elif [[ $RELEASE_TYPE = "RELEASE" ]]; then |
||||
stageVersion=$( get_next_release $snapshotVersion) |
||||
nextVersion=$( bump_version_number $snapshotVersion) |
||||
else |
||||
echo "Unknown release type $RELEASE_TYPE" >&2; exit 1; |
||||
fi |
||||
|
||||
echo "Staging $stageVersion (next version will be $nextVersion)" |
||||
sed -i "s/version=$snapshotVersion/version=$stageVersion/" gradle.properties |
||||
|
||||
git config user.name "Spring Buildmaster" > /dev/null |
||||
git config user.email "buildmaster@springframework.org" > /dev/null |
||||
git add gradle.properties > /dev/null |
||||
git commit -m"Release v$stageVersion" > /dev/null |
||||
git tag -a "v$stageVersion" -m"Release v$stageVersion" > /dev/null |
||||
|
||||
./gradlew --no-daemon --max-workers=4 -PdeploymentRepository=${repository} build publishAllPublicationsToDeploymentRepository |
||||
|
||||
git reset --hard HEAD^ > /dev/null |
||||
if [[ $nextVersion != $snapshotVersion ]]; then |
||||
echo "Setting next development version (v$nextVersion)" |
||||
sed -i "s/version=$snapshotVersion/version=$nextVersion/" gradle.properties |
||||
git add gradle.properties > /dev/null |
||||
git commit -m"Next development version (v$nextVersion)" > /dev/null |
||||
fi; |
||||
|
||||
echo "Staging Complete" |
||||
|
||||
popd > /dev/null |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
--- |
||||
platform: linux |
||||
inputs: |
||||
- name: git-repo |
||||
- name: artifactory-repo |
||||
outputs: |
||||
- name: version |
||||
params: |
||||
RELEASE_TYPE: |
||||
ARTIFACTORY_SERVER: |
||||
ARTIFACTORY_USERNAME: |
||||
ARTIFACTORY_PASSWORD: |
||||
BINTRAY_SUBJECT: |
||||
BINTRAY_REPO: |
||||
BINTRAY_USERNAME: |
||||
BINTRAY_API_KEY: |
||||
run: |
||||
path: git-repo/ci/scripts/promote-version.sh |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
--- |
||||
platform: linux |
||||
inputs: |
||||
- name: git-repo |
||||
outputs: |
||||
- name: stage-git-repo |
||||
- name: distribution-repository |
||||
params: |
||||
RELEASE_TYPE: |
||||
CI: true |
||||
GRADLE_ENTERPRISE_CACHE_USERNAME: |
||||
GRADLE_ENTERPRISE_CACHE_PASSWORD: |
||||
GRADLE_ENTERPRISE_URL: https://ge.spring.io |
||||
caches: |
||||
- path: gradle |
||||
run: |
||||
path: git-repo/ci/scripts/stage-version.sh |
Loading…
Reference in new issue