Introduce Jenkins.

This commit is contained in:
Greg Turnquist
2019-06-08 07:43:47 -05:00
parent 5ebe61a784
commit c80d1ff6f1
11 changed files with 348 additions and 134 deletions

View File

@@ -2,13 +2,4 @@
set -euo pipefail
[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2
spring_hateoas_examples_artifactory=$(pwd)/spring-hateoas-examples-artifactory
rm -rf $HOME/.m2/repository/org/springframework/hateoas 2> /dev/null || :
cd spring-hateoas-examples-github
./mvnw -Pdistribute -Dmaven.test.skip=true clean deploy \
-DaltDeploymentRepository=distribution::default::file://${spring_hateoas_examples_artifactory}
./mvnw -P${PROFILE} -Dmaven.test.skip=true clean deploy -B

View File

@@ -1,20 +0,0 @@
---
platform: linux
image_resource:
type: docker-image
source:
repository: openjdk
tag: 8-jdk
inputs:
- name: spring-hateoas-examples-github
outputs:
- name: spring-hateoas-examples-artifactory
caches:
- path: maven
run:
path: spring-hateoas-examples-github/ci/build.sh

View File

@@ -2,24 +2,20 @@
set -e -u
apt-get update
apt-get install -y jq
buildName=`jq -r '.name' build-info.json`
buildNumber=`jq -r '.number' build-info.json`
groupId=`jq -r '.modules[0].id' build-info.json | sed 's/\(.*\):.*:.*/\1/'`
version=`jq -r '.modules[0].id' build-info.json | sed 's/.*:.*:\(.*\)/\1/'`
buildName=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.name' )
buildNumber=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.number' )
groupId=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' )
version=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' )
targetRepo="libs-release-local"
echo "Promoting ${buildName}/${buildNumber} to ${targetRepo}"
echo "Promoting ${buildName}/${buildNumber}/${groupId}/${version} to libs-release-local"
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\"}" \
-u ${ARTIFACTORY_USR}:${ARTIFACTORY_PSW} \
-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; }

View File

@@ -1,19 +0,0 @@
---
platform: linux
image_resource:
type: docker-image
source:
repository: openjdk
tag: 8-jdk
inputs:
- name: spring-hateoas-examples-artifactory
- name: spring-hateoas-examples-github
run:
path: spring-hateoas-examples-github/ci/promote-to-bintray.sh
params:
ARTIFACTORY_USERNAME:
ARTIFACTORY_PASSWORD:

View File

@@ -2,23 +2,22 @@
set -e -u
apt-get update
apt-get install -y jq
buildName=`jq -r '.name' build-info.json`
buildNumber=`jq -r '.number' build-info.json`
groupId=`jq -r '.modules[0].id' build-info.json | sed 's/\(.*\):.*:.*/\1/'`
version=`jq -r '.modules[0].id' build-info.json | sed 's/.*:.*:\(.*\)/\1/'`
buildName=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.name' )
buildNumber=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.number' )
groupId=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' )
version=$( cat spring-hateoas-examples-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' )
echo "Syncing ${buildName}/${buildNumber}/${groupId}/${version} to Maven Central..."
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; }
curl \
-s \
--connect-timeout 240 \
--max-time 2700 \
-u ${BINTRAY_USR}:${BINTRAY_PSW} \
-H 'Content-Type: application/json' \
-d "{ \"username\": \"${SONATYPE_USR}\", \"password\": \"${SONATYPE_PSW}\"}" \
-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

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

View File

@@ -2,10 +2,4 @@
set -euo pipefail
[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2
rm -rf $HOME/.m2/repository/org/springframework/hateoas 2> /dev/null || :
cd spring-hateoas-examples-github
./mvnw clean dependency:list test -P${PROFILE} -Dsort
./mvnw -P${PROFILE} clean dependency:list test -Dsort -B

View File

@@ -1,17 +0,0 @@
---
platform: linux
image_resource:
type: docker-image
source:
repository: openjdk
tag: 8-jdk
inputs:
- name: spring-hateoas-examples-github
caches:
- path: maven
run:
path: spring-hateoas-examples-github/ci/test.sh