From 634479edba7300506f5c3a98a837d196971e6ca2 Mon Sep 17 00:00:00 2001 From: Greg Turnquist Date: Tue, 4 Jun 2019 09:27:58 -0500 Subject: [PATCH] Introduce Jenkins CI. --- Jenkinsfile | 232 ++++++++++++++ README.adoc | 86 +++++- ci/Dockerfile | 6 + ci/README.adoc | 96 ------ ci/build.sh | 11 +- ci/build.yml | 20 -- ci/pipeline-template.yml | 572 ----------------------------------- ci/promote-to-bintray.sh | 20 +- ci/promote-to-bintray.yml | 19 -- ci/sync-to-maven-central.sh | 31 +- ci/sync-to-maven-central.yml | 21 -- ci/test.sh | 8 +- ci/test.yml | 17 -- pom.xml | 131 +++++++- 14 files changed, 475 insertions(+), 795 deletions(-) create mode 100644 Jenkinsfile create mode 100644 ci/Dockerfile delete mode 100644 ci/README.adoc delete mode 100644 ci/build.yml delete mode 100644 ci/pipeline-template.yml delete mode 100644 ci/promote-to-bintray.yml delete mode 100644 ci/sync-to-maven-central.yml delete mode 100644 ci/test.yml diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..fef00cc --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,232 @@ +pipeline { + agent none + + triggers { + pollSCM 'H/10 * * * *' + } + + options { + disableConcurrentBuilds() + } + + stages { + stage('Publish OpenJDK 8 + jq docker image') { + when { + changeset "ci/Dockerfile" + } + agent any + + steps { + script { + def image = docker.build("springci/spring-session-data-mongodb-openjdk8-with-jq", "ci/") + docker.withRegistry('', 'hub.docker.com-springbuildmaster') { + image.push() + } + } + } + } + stage("Test: baseline (jdk8)") { + agent { + docker { + image 'adoptopenjdk/openjdk8:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + steps { + sh "PROFILE=convergence ci/test.sh" + } + } + stage("Test other configurations") { + parallel { + stage("Test: spring-next (jdk8)") { + agent { + docker { + image 'adoptopenjdk/openjdk8:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + steps { + sh "PROFILE=spring-next,convergence ci/test.sh" + } + } + stage("Test: baseline (jdk11)") { + agent { + docker { + image 'adoptopenjdk/openjdk11:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + steps { + sh "PROFILE=convergence ci/test.sh" + } + } + stage("Test: spring-next (jdk11)") { + agent { + docker { + image 'adoptopenjdk/openjdk11:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + steps { + sh "PROFILE=spring-next,convergence ci/test.sh" + } + } + stage("Test: baseline (jdk12)") { + agent { + docker { + image 'adoptopenjdk/openjdk12:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + steps { + sh "PROFILE=convergence ci/test.sh" + } + } + stage("Test: spring-next (jdk12)") { + agent { + docker { + image 'adoptopenjdk/openjdk12:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + steps { + sh "PROFILE=spring-next,convergence ci/test.sh" + } + } + } + } + stage('Deploy to Artifactory') { + agent { + docker { + image 'adoptopenjdk/openjdk8:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + + environment { + ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') + } + + steps { + script { + // Warm up this plugin quietly before using it. + sh "./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version" + + PROJECT_VERSION = sh( + script: "./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO", + returnStdout: true + ).trim() + + RELEASE_TYPE = 'milestone' // .RC? or .M? + + if (PROJECT_VERSION.endsWith('BUILD-SNAPSHOT')) { + RELEASE_TYPE = 'snapshot' + } else if (PROJECT_VERSION.endsWith('RELEASE')) { + RELEASE_TYPE = 'release' + } + + OUTPUT = sh( + script: "PROFILE=distribute,docs,${RELEASE_TYPE} ci/build.sh", + returnStdout: true + ).trim() + + echo "$OUTPUT" + + build_info_path = OUTPUT.split('\n') + .find { it.contains('Artifactory Build Info Recorder') } + .split('Saving Build Info to ')[1] + .trim()[1..-2] + + dir(build_info_path + '/..') { + stash name: 'build_info', includes: "*.json" + } + } + } + } + stage('Promote to Bintray') { + when { + branch 'release-2.0' + } + agent { + docker { + image 'springci/spring-session-data-mongodb-openjdk8-with-jq:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + + environment { + ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') + } + + steps { + script { + // Warm up this plugin quietly before using it. + sh "./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version" + + PROJECT_VERSION = sh( + script: "./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO", + returnStdout: true + ).trim() + + if (PROJECT_VERSION.endsWith('RELEASE')) { + unstash name: 'build_info' + sh "ci/promote-to-bintray.sh" + } else { + echo "${PROJECT_VERSION} is not a candidate for promotion to Bintray." + } + } + } + } + stage('Sync to Maven Central') { + when { + branch 'release-2.0' + } + agent { + docker { + image 'springci/spring-session-data-mongodb-openjdk8-with-jq:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + + environment { + BINTRAY = credentials('Bintray-spring-operator') + SONATYPE = credentials('oss-token') + } + + steps { + script { + // Warm up this plugin quietly before using it. + sh "./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version" + + PROJECT_VERSION = sh( + script: "./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO", + returnStdout: true + ).trim() + + if (PROJECT_VERSION.endsWith('RELEASE')) { + unstash name: 'build_info' + sh "ci/sync-to-maven-central.sh" + } else { + echo "${PROJECT_VERSION} is not a candidate for syncing to Maven Central." + } + } + } + } + } + + post { + changed { + script { + slackSend( + color: (currentBuild.currentResult == 'SUCCESS') ? 'good' : 'danger', + channel: '#spring-session-bot', + message: "${currentBuild.fullDisplayName} - `${currentBuild.currentResult}`\n${env.BUILD_URL}") + emailext( + subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}", + mimeType: 'text/html', + recipientProviders: [[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']], + body: "${currentBuild.fullDisplayName} is reported as ${currentBuild.currentResult}") + } + } + } +} diff --git a/README.adoc b/README.adoc index 29812c6..d69f69a 100644 --- a/README.adoc +++ b/README.adoc @@ -1,4 +1,8 @@ -image:https://badges.gitter.im/spring-projects/spring-session.svg[link="https://gitter.im/spring-projects/spring-session?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"] +https://spring.io/projects/spring-session-data-mongodb[Spring Session for MongoDB] is part of the Spring Session umbrella. + +image:https://jenkins.spring.io/buildStatus/icon?job=spring-session-data-mongodb%2Fmaster&subject=Corn%20(master)[link=https://jenkins.spring.io/view/SpringData/job/spring-session-data-mongodb/] +image:https://jenkins.spring.io/buildStatus/icon?job=spring-session-data-mongodb%2F2.1.x&subject=Bean%20(2.1.x)[link=https://jenkins.spring.io/view/SpringData/job/spring-session-data-mongodb/] +image:https://jenkins.spring.io/buildStatus/icon?job=spring-session-data-mongodb%2F2.0.x&subject=Apple%20(2.0.x)[link=https://jenkins.spring.io/view/SpringData/job/spring-session-data-mongodb/] = Spring Session MongoDB @@ -14,16 +18,92 @@ Spring Session MongoDB provides a solution for Spring Session in a MongoDB data == Project Status -See https://github.com/spring-projects/spring-session-data-mongodb#project-status[Project Status on the master branch] for status of this version. +We go to great lengths to ensure smooth upgrades. We also seek to make your upgrade on major versions of Java can be as smooth +as possible. + +[IMPORTANT] +==== +* Spring Session for MongoDB 2.2.x runs on Spring Framework 5.2. +* Spring Session for MongoDB 2.1.x runs on Spring Framework 5.1. + +Both of these have support for *JDK 11*. + +Spring Session for MongoDB *2.0* runs on Spring Framework 5.0 and is NOT supported on *JDK 11* despite +our pipelines testing against it. The extra tests are designed to give you a smooth upgrade path. If you are going into production on +JDK 11, you should be using at least Spring Session for MongoDB *2.1*. +==== + +IMPORTANT: *JDK 12* is Java's latest version and is unstable. We are testing against it to catch issues early on, but don't support it directly on any version of Spring Session for MongoDB. == Building Spring Session MongoDB -. Run `mvn clean package` +. Run `./mvnw clean package` This will generate the artifact. You can also import the project into your IDE. +== Making a release + +1. Create a new release (on the main branch). ++ +---- +% ci/create-release.sh +---- ++ +2. With the release tagged, push the tagged version to the release branch. ++ +---- +% git checkout -b release-2.0 +% git reset --hard +% git push -f origin release-2.0 +---- + +NOTE: You can chain the previous set of commands together using `&&`. + +The pipeline will build and release the "release" branch. It will also build a new a new snapshot and stage it on artifactory. + +The pipeline will pick up the next tag and release it. It will also build a new snapshot and stage it on artifactory. + +=== Running CI tasks locally + +Since the pipeline uses Docker, it's easy to: + +* Debug what went wrong on your local machine. +* Test out a a tweak to your `test.sh` script before sending it out. +* Experiment against a new image before submitting your pull request. + +All of these use cases are great reasons to essentially run what Jenkins does on your local machine. + +IMPORTANT: To do this you must have Docker installed on your machine. + +1. `docker run -it --mount type=bind,source="$(pwd)",target=/spring-session-data-mongodb-github adoptopenjdk/openjdk8:latest /bin/bash` ++ +This will launch the Docker image and mount your source code at `spring-session-data-mongodb-github`. ++ +2. `cd spring-session-data-mongodb-github` ++ +Next, run the `test.sh` script from inside the container: ++ +2. `PROFILE=none ci/test.sh` + +Since the container is binding to your source, you can make edits from your IDE and continue to run build jobs. + +If you need to test the `build.sh` script, then do this: + +1. `docker run -it --mount type=bind,source="$(pwd)",target=/spring-session-data-mongodb-github --mount type=bind,source="/tmp/spring-session-data-mongodb-artifactory",target=/spring-session-data-mongodb-artifactory adoptopenjdk/openjdk8:latest /bin/bash` ++ +This will launch the Docker image and mount your source code at `spring-session-data-mongodb-github` and the temporary +artifactory output directory at `spring-session-data-mongodb-artifactory`. ++ +Next, run the `build.sh` script from inside the container: ++ +2. `ci/build.sh` + +IMPORTANT: `build.sh` will attempt to push to Artifactory. If you don't supply credentials, it will fail. + +NOTE: Docker containers can eat up disk space fast! From time to time, run `docker system prune` to clean out old images. + == Code of Conduct This project adheres to the Contributor Covenant link:CODE_OF_CONDUCT.adoc[code of conduct]. By participating, you are expected to uphold this code. Please report unacceptable behavior to spring-code-of-conduct@pivotal.io. diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 0000000..b05019d --- /dev/null +++ b/ci/Dockerfile @@ -0,0 +1,6 @@ +FROM adoptopenjdk/openjdk8:latest + +RUN apt-get update && apt-get install -y jq + +RUN apt-get clean \ + && rm -rf /var/lib/apt/lists/* diff --git a/ci/README.adoc b/ci/README.adoc deleted file mode 100644 index 335a6c7..0000000 --- a/ci/README.adoc +++ /dev/null @@ -1,96 +0,0 @@ -== Spring Session for MongoDB CI - -Spring Session for MongoDB uses Concourse as it's CI tool of choice. This provides support for: - -* Pipelines against the `master` and `2.0.x` branches -* Support for pull requests - -=== Creating a pipeline - -Using the `fly` command, you can execute a series of commands to create multiple pipelines to manage everything. But -first, some critical credentials are needed. - -Create a `credentials.yml` file like this: - -[source,yml] ----- -github-access-token: -slack: -docker-email: -docker-username: -docker-password: -artifactory-username: -artifactory-password: ----- - -WARNING: Do NOT check this file into source control! If you'll check, `credentials.yml` is listed in `.gitignore` to prevent tihs. - -With this in place, run the following `fly` commands to create pipelines: - ----- -% 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 ----- - -With these pipelines in place, you can now activate and expose them: - ----- -% 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.0x ----- - -=== Making a release - -1. Create a new release (on the main branch). -+ ----- -% ci/create-release.sh ----- -+ -2. With the release officially tagged, just push it to master. -+ ----- -% git push ----- - -The pipeline will pick up the next tag and release it. It will also build a new snapshot and stage it on artifactory. - - -=== Running CI tasks locally - -Since Concourse is built on top of Docker, it's easy to: - -* Debug what went wrong on your local machine. -* Test out a a tweak to your `test.sh` script before sending it out. -* Experiment against a new image before submitting your pull request. - -All of these use cases are great reasons to essentially run what Concourse does on your local machine. - -IMPORTANT: To do this you must have Docker installed on your machine. - -1. `docker run -it --mount type=bind,source="$(pwd)",target=/spring-session-data-mongodb-github openjdk:8-jdk /bin/bash` -+ -This will launch the Docker image and mount your source code at `spring-session-data-mongodb-github`. -+ -Next, run the `test.sh` script from inside the container: -+ -2. `PROFILE=none spring-session-data-mongodb-github/ci/test.sh` - -Since the container is binding to your source, you can make edits from your IDE and continue to run build jobs. - -If you need to test the `build.sh` script, then do this: - -1. `mkdir /tmp/spring-session-data-mongodb-artifactory` -2. `docker run -it --mount type=bind,source="$(pwd)",target=/spring-session-data-mongodb-github --mount type=bind,source="/tmp/spring-session-data-mongodb-artifactory",target=/spring-session-data-mongodb-artifactory openjdk:8-jdk /bin/bash` -+ -This will launch the Docker image and mount your source code at `spring-session-data-mongodb-github` and the temporary -artifactory output directory at `spring-session-data-mongodb-artifactory`. -+ -Next, run the `build.sh` script from inside the container: -+ -3. `spring-session-data-mongodb-github/ci/build.sh` - -IMPORTANT: `build.sh` doesn't actually push to Artifactory so don't worry about accidentally deploying anything. -It just deploys to a local folder. That way, the `artifactory-resource` later in the pipeline can pick up these artifacts -and deliver them to artifactory. - -NOTE: Docker containers can eat up disk space fast! From time to time, run `docker system prune` to clean out old images. \ No newline at end of file diff --git a/ci/build.sh b/ci/build.sh index 4a78f1f..6a202bb 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -2,13 +2,4 @@ set -euo pipefail -[[ -d $PWD/maven && ! -d $HOME/.m2 ]] && ln -s $PWD/maven $HOME/.m2 - -spring_session_data_mongodb_artifactory=$(pwd)/spring-session-data-mongodb-artifactory - -rm -rf $HOME/.m2/repository/org/springframework/ws 2> /dev/null || : - -cd spring-session-data-mongodb-github - -./mvnw -Pdistribute,docs -Dmaven.test.skip=true clean deploy \ - -DaltDeploymentRepository=distribution::default::file://${spring_session_data_mongodb_artifactory} +./mvnw -P${PROFILE} -Dmaven.test.skip=true clean deploy -B diff --git a/ci/build.yml b/ci/build.yml deleted file mode 100644 index f1fef0e..0000000 --- a/ci/build.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -platform: linux - -image_resource: - type: docker-image - source: - repository: openjdk - tag: 8-jdk - -inputs: -- name: spring-session-data-mongodb-github - -outputs: -- name: spring-session-data-mongodb-artifactory - -caches: -- path: maven - -run: - path: spring-session-data-mongodb-github/ci/build.sh diff --git a/ci/pipeline-template.yml b/ci/pipeline-template.yml deleted file mode 100644 index 27c789f..0000000 --- a/ci/pipeline-template.yml +++ /dev/null @@ -1,572 +0,0 @@ ---- -resource_types: -- name: artifactory-resource - type: registry-image - source: - repository: springio/artifactory-resource - tag: 0.0.6 - -- name: github-status - type: registry-image - source: - repository: dpb587/github-status-resource - tag: master - -- name: pull-request - type: registry-image - source: - repository: jtarchie/pr - tag: latest - -- name: slack-notification - type: registry-image - source: - repository: nebhale/slack-notification-resource - -resources: -- name: openjdk:8-jdk - type: registry-image - icon: docker - source: - repository: openjdk - tag: 8-jdk - -- name: openjdk:11-jdk - type: registry-image - icon: docker - source: - repository: openjdk - tag: 11-jdk - -- name: openjdk:13-jdk - type: registry-image - icon: docker - source: - repository: openjdk - tag: 13-jdk - -- name: spring-session-data-mongodb-github - type: git - icon: github-circle - source: - uri: https://github.com/spring-projects/spring-session-data-mongodb.git - branch: ((branch)) - -- name: spring-session-data-mongodb-artifactory - type: artifactory-resource - icon: package-variant - source: - uri: https://repo.spring.io - username: ((artifactory-username)) - password: ((artifactory-password)) - build_name: spring-session-data-mongodb-2.0.x - -- name: spring-session-data-mongodb-pull-requests - type: pull-request - icon: source-pull - source: - access_token: ((github-access-token)) - repo: spring-projects/spring-session-data-mongodb - base: ((branch)) - -- name: spring-session-data-mongodb-release - type: git - icon: github-circle - source: - uri: https://github.com/spring-projects/spring-session-data-mongodb.git - tag_filter: v* - -- name: spring-session-data-mongodb-status - type: github-status - icon: eye-check - source: - access_token: ((github-access-token)) - repository: spring-projects/spring-session-data-mongodb - branch: ((branch)) - -- name: slack - type: slack-notification - icon: slack - source: - url: ((slack)) - -groups: -- name: spring-session-data-mongodb - jobs: - - spring-session-data-mongodb-test-jdk8 - - spring-session-data-mongodb-test-jdk8-spring-next - - spring-session-data-mongodb-test-jdk11 - - spring-session-data-mongodb-test-jdk11-spring-next - - spring-session-data-mongodb-test-jdk13 - - spring-session-data-mongodb-test-jdk13-spring-next - - build -- name: pull-requests - jobs: - - spring-session-data-mongodb-pull-requests -- name: release - jobs: - - release-to-artifactory - - promote-to-bintray - - sync-to-maven-central - -jobs: -- name: spring-session-data-mongodb-test-jdk8 - serial: true - public: true - plan: - - get: spring-session-data-mongodb-github - trigger: true - - get: openjdk:8-jdk - trigger: true - - task: test - file: spring-session-data-mongodb-github/ci/test.yml - params: { PROFILE: "convergence" } - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Test 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 - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Test 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 - - -- name: spring-session-data-mongodb-test-jdk8-spring-next - serial: true - public: true - plan: - - get: spring-session-data-mongodb-github - trigger: true - - get: openjdk:8-jdk - trigger: true - - task: test - file: spring-session-data-mongodb-github/ci/test.yml - params: { PROFILE: "spring-next,convergence" } - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Test 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 - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Test 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 - -- name: spring-session-data-mongodb-test-jdk11 - serial: true - public: true - plan: - - get: spring-session-data-mongodb-github - trigger: true - - get: openjdk:11-jdk - trigger: true - - task: test - image: openjdk:11-jdk - file: spring-session-data-mongodb-github/ci/test.yml - params: { PROFILE: "convergence" } - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Test 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 - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Test 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 - -- name: spring-session-data-mongodb-test-jdk11-spring-next - serial: true - public: true - plan: - - get: spring-session-data-mongodb-github - trigger: true - - get: openjdk:11-jdk - trigger: true - - task: test - image: openjdk:11-jdk - file: spring-session-data-mongodb-github/ci/test.yml - params: { PROFILE: "spring-next,convergence" } - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Test 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 - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Test 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 - -- name: spring-session-data-mongodb-test-jdk13 - serial: true - public: true - plan: - - get: spring-session-data-mongodb-github - trigger: true - - get: openjdk:13-jdk - trigger: true - - task: test - image: openjdk:13-jdk - file: spring-session-data-mongodb-github/ci/test.yml - params: { PROFILE: "convergence" } - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Test 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 - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Test 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 - -- name: spring-session-data-mongodb-test-jdk13-spring-next - serial: true - public: true - plan: - - get: spring-session-data-mongodb-github - trigger: true - - get: openjdk:13-jdk - trigger: true - - task: test - image: openjdk:13-jdk - file: spring-session-data-mongodb-github/ci/test.yml - params: { PROFILE: "spring-next,convergence" } - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Test 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 - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Test 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 - -- name: build - serial: true - public: true - plan: - - get: spring-session-data-mongodb-github - trigger: true - passed: [ - spring-session-data-mongodb-test-jdk8, - spring-session-data-mongodb-test-jdk8-spring-next, - spring-session-data-mongodb-test-jdk11, - spring-session-data-mongodb-test-jdk11-spring-next, - spring-session-data-mongodb-test-jdk13, - spring-session-data-mongodb-test-jdk13-spring-next - ] - - put: spring-session-data-mongodb-status - params: - commit: spring-session-data-mongodb-github - state: pending - - task: build - file: spring-session-data-mongodb-github/ci/build.yml - - put: spring-session-data-mongodb-artifactory - params: - build_number: ${BUILD_NAME} - build_uri: ${ATC_EXTERNAL_URL}/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME} - repo: libs-snapshot-local - folder: spring-session-data-mongodb-artifactory - artifact_set: - - include: - - "/**" - properties: - zip.deployed: false - zip.displayname: "spring-session-data-mongodb-2.0.x" - zip.name: "spring-session-data-mongodb-2.0.x" - zip.type: "docs" - 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 " - text: "Build 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 " - text: "Build 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-pull-requests - public: true - plan: - - get: spring-session-data-mongodb-github - resource: spring-session-data-mongodb-pull-requests - trigger: true - version: every - - get: openjdk:11-jdk - - get: openjdk:13-jdk - - put: spring-session-data-mongodb-pull-requests - params: - path: spring-session-data-mongodb-github - status: pending - - aggregate: - - task: test-jdk8 - file: spring-session-data-mongodb-github/ci/test.yml - params: { PROFILE: "convergence" } - - task: test-jdk8-spring-next - file: spring-session-data-mongodb-github/ci/test.yml - params: { PROFILE: "spring-next,convergence" } - - task: test-jdk11 - image: openjdk:11-jdk - file: spring-session-data-mongodb-github/ci/test.yml - params: { PROFILE: "convergence" } - - task: test-jdk11-spring-next - image: openjdk:11-jdk - file: spring-session-data-mongodb-github/ci/test.yml - params: { PROFILE: "spring-next,convergence" } - - task: test-jdk13 - image: openjdk:13-jdk - file: spring-session-data-mongodb-github/ci/test.yml - params: { PROFILE: "convergence" } - - task: test-jdk13-spring-next - image: openjdk:13-jdk - file: spring-session-data-mongodb-github/ci/test.yml - params: { PROFILE: "spring51-next,convergence" } - on_failure: - aggregate: - - put: spring-session-data-mongodb-pull-requests - params: - path: spring-session-data-mongodb-github - status: failure - - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - 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: - aggregate: - - put: spring-session-data-mongodb-pull-requests - params: - path: spring-session-data-mongodb-github - status: success - - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - 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: release-to-artifactory - serial: true - public: true - plan: - - get: spring-session-data-mongodb-github - resource: spring-session-data-mongodb-release - trigger: true - - put: spring-session-data-mongodb-status - params: - commit: spring-session-data-mongodb-github - state: pending - - task: build - file: spring-session-data-mongodb-github/ci/build.yml - - put: spring-session-data-mongodb-artifactory - params: - build_number: ${BUILD_NAME} - build_uri: ${ATC_EXTERNAL_URL}/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME} - repo: libs-release-local - folder: spring-session-data-mongodb-artifactory - artifact_set: - - include: - - "/**" - properties: - zip.deployed: false - zip.displayname: "spring-session-data-mongodb-2.0.x" - zip.name: "spring-session-data-mongodb-2.0.x" - zip.type: "docs" - 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 " - 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: - 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 " - 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 - plan: - - get: spring-session-data-mongodb-github - resource: spring-session-data-mongodb-release - - get: spring-session-data-mongodb-artifactory - trigger: true - passed: [release-to-artifactory] - params: - save_build_info: true - - 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 " - 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 " - 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 " - 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 " - 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 diff --git a/ci/promote-to-bintray.sh b/ci/promote-to-bintray.sh index 82f8862..a00bb8d 100755 --- a/ci/promote-to-bintray.sh +++ b/ci/promote-to-bintray.sh @@ -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-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}" +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; } diff --git a/ci/promote-to-bintray.yml b/ci/promote-to-bintray.yml deleted file mode 100644 index 5420db5..0000000 --- a/ci/promote-to-bintray.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -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: diff --git a/ci/sync-to-maven-central.sh b/ci/sync-to-maven-central.sh index 461ea05..a2d47e8 100755 --- a/ci/sync-to-maven-central.sh +++ b/ci/sync-to-maven-central.sh @@ -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-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 "Synching ${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" diff --git a/ci/sync-to-maven-central.yml b/ci/sync-to-maven-central.yml deleted file mode 100644 index 76cd449..0000000 --- a/ci/sync-to-maven-central.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -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: diff --git a/ci/test.sh b/ci/test.sh index b2b3cf3..f6bb0bf 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -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/ws 2> /dev/null || : - -cd spring-session-data-mongodb-github - -./mvnw -P${PROFILE} clean dependency:list test -Dsort +./mvnw -P${PROFILE} clean dependency:list test -Dsort -B diff --git a/ci/test.yml b/ci/test.yml deleted file mode 100644 index fbe669d..0000000 --- a/ci/test.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -platform: linux - -image_resource: - type: docker-image - source: - repository: openjdk - tag: 8-jdk - -inputs: -- name: spring-session-data-mongodb-github - -caches: -- path: maven - -run: - path: spring-session-data-mongodb-github/ci/test.sh diff --git a/pom.xml b/pom.xml index c82e400..382b730 100644 --- a/pom.xml +++ b/pom.xml @@ -69,8 +69,8 @@ 1.8 UTF-8 - 3.9.1 - 1.50.5 + 3.12.2 + 2.2.0 1.3 2.9.1 4.12 @@ -436,6 +436,133 @@ + + snapshot + + + + + org.jfrog.buildinfo + artifactory-maven-plugin + 2.6.1 + false + + + build-info + + publish + + + + {{BUILD_URL}} + + + spring-session-data-mongodb + spring-session-data-mongodb + false + docs + *:*:*:*@zip + + + https://repo.spring.io + {{ARTIFACTORY_USR}} + {{ARTIFACTORY_PSW}} + libs-snapshot-local + libs-snapshot-local + + + + + + + + + + + milestone + + + + + org.jfrog.buildinfo + artifactory-maven-plugin + 2.6.1 + false + + + build-info + + publish + + + + {{BUILD_URL}} + + + spring-session-data-mongodb + spring-session-data-mongodb + false + docs + *:*:*:*@zip + + + https://repo.spring.io + {{ARTIFACTORY_USR}} + {{ARTIFACTORY_PSW}} + libs-milestone-local + libs-milestone-local + + + + + + + + + + + release + + + + + org.jfrog.buildinfo + artifactory-maven-plugin + 2.6.1 + false + + + build-info + + publish + + + + {{BUILD_URL}} + + + spring-session-data-mongodb + spring-session-data-mongodb + false + docs + *:*:*:*@zip + + + https://repo.spring.io + {{ARTIFACTORY_USR}} + {{ARTIFACTORY_PSW}} + libs-release-local + libs-release-local + + + + + + + + + +