Enhance CI pipeline

- Support for Pull Requests
- Display build status on commit
- Notify build results on slack
- Support for releasing to artifactory

Closes gh-771
This commit is contained in:
Madhura Bhave
2018-11-19 15:13:07 -08:00
parent 22b4c9537c
commit 79623260f9
8 changed files with 277 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
#!/bin/bash
set -e
source $(dirname $0)/common.sh
version=$( cat version/version )
milestone=${version%.RELEASE}
java -jar /github-release-notes-generator.jar \
--releasenotes.github.username=${GITHUB_USERNAME} \
--releasenotes.github.password=${GITHUB_TOKEN} \
--releasenotes.github.organization=${GITHUB_ORGANIZATION} \
--releasenotes.github.repository=${GITHUB_REPO} \
${milestone} generated-release-notes/release-notes.md
echo ${version} > generated-release-notes/version
echo v${version} > generated-release-notes/tag

27
ci/scripts/promote.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
set -e
source $(dirname $0)/common.sh
buildName=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.name' )
buildNumber=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.number' )
groupId=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' )
version=$( cat artifactory-repo/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 900 \
-u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \
-H "Content-type:application/json" \
-d "{\"status\": \"staged\", \"sourceRepo\": \"libs-staging-local\", \"targetRepo\": \"${targetRepo}\"}" \
-f \
-X \
POST "${ARTIFACTORY_SERVER}/api/build/promote/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to promote" >&2; exit 1; }
echo "Promotion complete"
echo $version > version/version

39
ci/scripts/stage.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/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=$( get_revision_from_pom )
stageVersion=$( get_next_release $snapshotVersion)
nextVersion=$( bump_version_number $snapshotVersion)
echo "Staging $stageVersion (next version will be $nextVersion)"
set_revision_to_pom "$stageVersion"
git config user.name "Spring Buildmaster" > /dev/null
git config user.email "buildmaster@springframework.org" > /dev/null
git add pom.xml > /dev/null
git commit -m"Release v$stageVersion" > /dev/null
git tag -a "v$stageVersion" -m"Release v$stageVersion" > /dev/null
./mvnw clean deploy -U -Pfull -DaltDeploymentRepository=distribution::default::file://${repository}
git reset --hard HEAD^ > /dev/null
if [[ $nextVersion != $snapshotVersion ]]; then
echo "Setting next development version (v$nextVersion)"
set_revision_to_pom "$nextVersion"
git add pom.xml > /dev/null
git commit -m"Next development version (v$nextVersion)" > /dev/null
fi;
echo "DONE"
popd > /dev/null