From b2e327d1d2765a80f306d286f17ff594105a4c41 Mon Sep 17 00:00:00 2001 From: Greg Turnquist Date: Thu, 30 May 2019 15:15:04 -0500 Subject: [PATCH] #999 - Introduce Jenkins CI. --- Jenkinsfile | 202 ++++++++ README.adoc | 103 +++-- build_all.bash | 8 - ci/Dockerfile | 6 +- ci/README.adoc | 97 ---- ci/build.sh | 11 +- ci/build.yml | 19 - ci/pipeline-template.yml | 860 ----------------------------------- 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 | 123 +++++ 15 files changed, 418 insertions(+), 1127 deletions(-) create mode 100644 Jenkinsfile delete mode 100755 build_all.bash 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 00000000..9feb9a0a --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,202 @@ +pipeline { + agent none + + triggers { + pollSCM 'H/10 * * * *' + } + + options { + disableConcurrentBuilds() + } + + stages { + stage('Publish OpenJDK 8 + Graphviz + jq docker image') { + when { + changeset "ci/Dockerfile" + } + agent any + + steps { + script { + def image = docker.build("springci/spring-hateoas-openjdk8-with-graphviz-and-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=none ci/test.sh" + } + } + + stage("Test other configurations") { + parallel { + stage("test: baseline (jdk11)") { + agent { + docker { + image 'adoptopenjdk/openjdk11:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + steps { + sh "PROFILE=none ci/test.sh" + } + } + stage("test: baseline (jdk12)") { + agent { + docker { + image 'adoptopenjdk/openjdk12:latest' + args '-v $HOME/.m2:/root/.m2' + } + } + steps { + sh "PROFILE=none ci/test.sh" + } + } + } + } + + stage('Deploy to Artifactory') { + agent { + docker { + image 'springci/spring-hateoas-openjdk8-with-graphviz-and-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() + + 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=ci,${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' + } + agent { + docker { + image 'springci/spring-hateoas-openjdk8-with-graphviz-and-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' + } + agent { + docker { + image 'springci/spring-hateoas-openjdk8-with-graphviz-and-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-hateoas', + 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 96fa1da2..17e6532b 100644 --- a/README.adoc +++ b/README.adoc @@ -2,48 +2,14 @@ image:https://spring.io/badges/spring-hateoas/ga.svg[link=https://spring.io/proj image:https://spring.io/badges/spring-hateoas/snapshot.svg[link=https://spring.io/projects/spring-hateoas] image:https://badges.gitter.im/spring-projects/spring-hateoas.png[link=https://gitter.im/spring-projects/spring-hateoas] +image:https://jenkins.spring.io/buildStatus/icon?job=spring-hateoas%2Fmaster&subject=master[link=https://jenkins.spring.io/view/SpringHATEOAS/job/spring-hateoas/] +image:https://jenkins.spring.io/buildStatus/icon?job=spring-hateoas%2F0.25.x&subject=0.25.x[link=https://jenkins.spring.io/view/SpringHATEOAS/job/spring-hateoas/] + + = Spring HATEOAS This project provides some APIs to ease creating REST representations that follow the https://en.wikipedia.org/wiki/HATEOAS[HATEOAS] principle when working with Spring and especially Spring MVC. The core problem it tries to address is link creation and representation assembly. -== Project Status - -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. - -Check the matrix below to see the status of supported versions: - -.Build Status -[cols='2,1,1'] -|=== -| Job | `1.0` status (master) | `0.25` status (0.25.x) - -| Test - JDK 8 -| image:https://ci.spring.io/api/v1/teams/spring-data/pipelines/spring-hateoas/jobs/test-jdk8/badge[link="https://ci.spring.io/teams/spring-data/pipelines/spring-hateoas"] -| image:https://ci.spring.io/api/v1/teams/spring-data/pipelines/spring-hateoas-0.25.x/jobs/Test%20-%20JDK%208/badge[link="https://ci.spring.io/teams/spring-data/pipelines/spring-hateoas-0.25.x"] - -| Test - JDK 8 and Spring 5.0 (snapshots) -| Requires Spring Framework 5.2+ -| image:https://ci.spring.io/api/v1/teams/spring-data/pipelines/spring-hateoas-0.25.x/jobs/Test%20-%20JDK%208%20and%20Spring%205.0%20(snapshots)/badge[link="https://ci.spring.io/teams/spring-data/pipelines/spring-hateoas-0.25.x"] - -| Test - JDK 8 and Spring 5.1 (snapshots) -| Requires Spring Framework 5.2+ -| image:https://ci.spring.io/api/v1/teams/spring-data/pipelines/spring-hateoas-0.25.x/jobs/Test%20-%20JDK%208%20and%20Spring%205.1%20(snapshots)/badge[link="https://ci.spring.io/teams/spring-data/pipelines/spring-hateoas-0.25.x"] - -| Test - JDK 11 -| image:https://ci.spring.io/api/v1/teams/spring-data/pipelines/spring-hateoas/jobs/test-jdk11/badge[link="https://ci.spring.io/teams/spring-data/pipelines/spring-hateoas"] -| Not supported - -| Test - JDK 13 -| image:https://ci.spring.io/api/v1/teams/spring-data/pipelines/spring-hateoas/jobs/test-jdk13/badge[link="https://ci.spring.io/teams/spring-data/pipelines/spring-hateoas"] -| Not supported - -| Build - Deploy to repo.spring.io -| image:https://ci.spring.io/api/v1/teams/spring-data/pipelines/spring-hateoas/jobs/build/badge[link="https://ci.spring.io/teams/spring-data/pipelines/spring-hateoas"] -| image:https://ci.spring.io/api/v1/teams/spring-data/pipelines/spring-hateoas-0.25.x/jobs/Build/badge[link="https://ci.spring.io/teams/spring-data/pipelines/spring-hateoas-0.25.x"] -|=== - - == Working with Spring HATEOAS Since all commits are headlined with its github issue, git will treat it as a comment. To get around this, apply the following configuration to your clone: @@ -53,6 +19,67 @@ Since all commits are headlined with its github issue, git will treat it as a co git config core.commentchar "/" ---- +== 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 +% git reset --hard +% git push -f origin release +---- + +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-hateoas-github adoptopenjdk/openjdk8:latest /bin/bash` ++ +This will launch the Docker image and mount your source code at `spring-hateoas-github`. ++ +2. `cd spring-hateoas-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-hateoas-github --mount type=bind,source="/tmp/spring-hateoas-artifactory",target=/spring-hateoas-artifactory adoptopenjdk/openjdk8:latest /bin/bash` ++ +This will launch the Docker image and mount your source code at `spring-hateoas-github` and the temporary +artifactory output directory at `spring-hateoas-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. + == Resources * Reference documentation - https://docs.spring.io/spring-hateoas/docs/current/reference/html/[html], https://docs.spring.io/spring-hateoas/docs/current/reference/pdf/spring-hateoas-reference.pdf[pdf] diff --git a/build_all.bash b/build_all.bash deleted file mode 100755 index 360d87d1..00000000 --- a/build_all.bash +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -# -# Convenient way to run ALL build profiles at once, before committing changes. -# -# - -./mvnw clean package && -./mvnw clean package -Pspring5-next diff --git a/ci/Dockerfile b/ci/Dockerfile index ba27b323..756af281 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -1,6 +1,6 @@ -FROM openjdk:8-jdk +FROM adoptopenjdk/openjdk8:latest -RUN apt-get update && apt-get install -y graphviz +RUN apt-get update && apt-get install -y graphviz jq RUN apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ No newline at end of file + && rm -rf /var/lib/apt/lists/* diff --git a/ci/README.adoc b/ci/README.adoc deleted file mode 100644 index f749b018..00000000 --- a/ci/README.adoc +++ /dev/null @@ -1,97 +0,0 @@ -== Spring HATEOAS CI - -Spring HATEOAS uses Concourse as it's CI tool of choice. This provides support for: - -* Pipeline against the `master` branch -* 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: -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 this. - -With this in place, run the following `fly` commands to create pipelines: - ----- -% fly -t spring-data sp -p spring-hateoas -c ci/pipeline-template.yml -l credentials.yml -v branch=master ----- - -With this pipeline in place, you can now activate and expose it: - ----- -% fly -t spring-data unpause-pipeline -p spring-hateoas -% fly -t spring-data expose-pipeline -p spring-hateoas ----- - -=== Making a release - -1. Create a new release (on the main branch). ----- -% ci/create-release.sh ----- - -NOTE: Because starts with `#`, it must be prefix on the command line with `\`, e.g. -`ci/create-release.sh \#123 1.0.0.M1 1.0.0.BUILD-SNAPSHOT`. - -2. With the release tagged, push the tagged version to the release branch. ----- -% git checkout -b release -% git reset --hard -% git push -f origin release ----- - -NOTE: You can chain the previous set of commands together using `&&`. - -=== 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-hateoas-github openjdk:8-jdk /bin/bash` -+ -This will launch the Docker image and mount your source code at `spring-hateoas-github`. -+ -Next, run the `test.sh` script from inside the container: -+ -2. `PROFILE=none spring-hateoas-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-hateoas-artifactory` -2. `docker run -it --mount type=bind,source="$(pwd)",target=/spring-hateoas-github --mount type=bind,source="/tmp/spring-hateoas-artifactory",target=/spring-hateoas-artifactory openjdk:8-jdk /bin/bash` -+ -This will launch the Docker image and mount your source code at `spring-hateoas-github` and the temporary -artifactory output directory at `spring-hateoas-artifactory`. -+ -Next, run the `build.sh` script from inside the container: -+ -3. `spring-hateoas-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 796a69f7..6a202bbe 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_hateoas_artifactory=$(pwd)/spring-hateoas-artifactory - -rm -rf $HOME/.m2/repository/org/springframework/hateoas 2> /dev/null || : - -cd spring-hateoas-github - -./mvnw -Dmaven.test.skip=true clean deploy \ - -DaltDeploymentRepository=distribution::default::file://${spring_hateoas_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 fc24dc0d..00000000 --- a/ci/build.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -platform: linux - -image_resource: - type: docker-image - source: - repository: springci/spring-hateoas-8-jdk-with-graphviz - -inputs: -- name: spring-hateoas-github - -outputs: -- name: spring-hateoas-artifactory - -caches: -- path: maven - -run: - path: spring-hateoas-github/ci/build.sh diff --git a/ci/pipeline-template.yml b/ci/pipeline-template.yml deleted file mode 100644 index 3c8e7da1..00000000 --- a/ci/pipeline-template.yml +++ /dev/null @@ -1,860 +0,0 @@ ---- -resource_types: -- name: artifactory-resource - type: registry-image - source: - repository: springio/artifactory-resource - tag: latest - -- 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-hateoas-github - type: git - icon: github-circle - source: - uri: https://github.com/spring-projects/spring-hateoas.git - branch: ((branch)) - ignore_paths: - - ci/Dockerfile - -- name: spring-hateoas-artifactory - type: artifactory-resource - icon: package-variant - source: - uri: https://repo.spring.io - username: ((artifactory-username)) - password: ((artifactory-password)) - build_name: spring-hateoas - -- name: spring-hateoas-pull-requests - type: pull-request - icon: source-pull - source: - access_token: ((github-access-token)) - repo: spring-projects/spring-hateoas - base: ((branch)) - -- name: spring-hateoas-release - type: git - icon: github-circle - source: - uri: https://github.com/spring-projects/spring-hateoas.git - tag_filter: 1* - -- name: spring-hateoas-status - type: github-status - icon: eye-check - source: - access_token: ((github-access-token)) - repository: spring-projects/spring-hateoas - branch: ((branch)) - -- name: spring-hateoas-examples-github - type: git - icon: github-circle - source: - uri: https://github.com/spring-projects/spring-hateoas-examples.git - branch: ((branch)) - -- name: spring-hateoas-examples-artifactory - type: artifactory-resource - icon: package-variant - source: - uri: https://repo.spring.io - username: ((artifactory-username)) - password: ((artifactory-password)) - build_name: spring-hateoas-examples - -- name: spring-hateoas-examples-pull-requests - type: pull-request - icon: source-pull - source: - access_token: ((github-access-token)) - repo: spring-projects/spring-hateoas-examples - base: ((branch)) - -- name: spring-hateoas-examples-release - type: git - icon: github-circle - source: - uri: https://github.com/spring-projects/spring-hateoas-examples.git - tag_filter: v* - -- name: spring-hateoas-examples-status - type: github-status - icon: eye-check - source: - access_token: ((github-access-token)) - repository: spring-projects/spring-hateoas-examples - branch: ((branch)) - -- name: slack - type: slack-notification - icon: slack - source: - url: ((slack)) - -- name: 8-jdk-with-graphviz-docker-image-github - type: git - icon: github-circle - source: - uri: https://github.com/spring-projects/spring-hateoas.git - branch: master - paths: - - ci/Dockerfile - -- name: 8-jdk-with-graphviz:latest - type: docker-image - icon: docker - source: - repository: springci/spring-hateoas-8-jdk-with-graphviz - email: ((docker-email)) - username: ((docker-username)) - password: ((docker-password)) - -groups: -- name: spring-hateoas - jobs: - - test-jdk8 - - test-spring-next-jdk8 - - test-jdk11 - - test-spring-next-jdk11 - - test-jdk13 - - test-spring-next-jdk13 - - build -- name: spring-hateoas-examples - jobs: - - spring-hateoas-examples-test-jdk8 - - spring-hateoas-examples-test-jdk11 - - spring-hateoas-examples-test-jdk13 - - spring-hateoas-examples-build -- name: pull-requests - jobs: - - spring-hateoas-pull-requests - - spring-hateoas-examples-pull-requests -- name: release - jobs: - - release-to-artifactory -# - promote-to-bintray -# - sync-to-maven-central - - release-examples-to-artifactory -- name: docker - jobs: - - 8-jdk-with-graphviz:latest - -jobs: -- name: test-jdk8 - serial: true - public: true - plan: - - get: spring-hateoas-github - trigger: true - - get: openjdk:8-jdk - trigger: true - - task: test - file: spring-hateoas-github/ci/test.yml - params: { PROFILE: "non-existent" } - 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: test-spring-next-jdk8 - serial: true - public: true - plan: - - get: spring-hateoas-github - trigger: true - passed: [ test-jdk8 ] - - get: openjdk:8-jdk - trigger: true - - task: test - file: spring-hateoas-github/ci/test.yml - params: { PROFILE: "spring-next" } - 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: test-jdk11 - serial: true - public: true - plan: - - get: spring-hateoas-github - trigger: true - passed: [ test-jdk8 ] - - get: openjdk:11-jdk - trigger: true - - task: test - image: openjdk:11-jdk - file: spring-hateoas-github/ci/test.yml - params: { PROFILE: "non-existant" } - 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: test-spring-next-jdk11 - serial: true - public: true - plan: - - get: spring-hateoas-github - trigger: true - passed: [ test-jdk8 ] - - get: openjdk:11-jdk - trigger: true - - task: test - image: openjdk:11-jdk - file: spring-hateoas-github/ci/test.yml - params: { PROFILE: "spring-next" } - 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: test-jdk13 - serial: true - public: true - plan: - - get: spring-hateoas-github - trigger: true - passed: [ test-jdk8 ] - - get: openjdk:13-jdk - trigger: true - - task: test - image: openjdk:13-jdk - file: spring-hateoas-github/ci/test.yml - params: { PROFILE: "non-existant" } - 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: test-spring-next-jdk13 - serial: true - public: true - plan: - - get: spring-hateoas-github - trigger: true - passed: [ test-jdk8 ] - - get: openjdk:13-jdk - trigger: true - - task: test - image: openjdk:13-jdk - file: spring-hateoas-github/ci/test.yml - params: { PROFILE: "spring-next" } - 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-hateoas-github - trigger: true - passed: [ - test-spring-next-jdk8, - test-jdk11, - test-spring-next-jdk11, - test-jdk13, - test-spring-next-jdk13 - ] - - get: 8-jdk-with-graphviz:latest - trigger: true - - put: spring-hateoas-status - params: - commit: spring-hateoas-github - state: pending - - task: build - file: spring-hateoas-github/ci/build.yml - - put: spring-hateoas-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-hateoas-artifactory - artifact_set: - - include: - - "/**" - properties: - zip.deployed: false - zip.displayname: "spring-hateoas" - zip.name: "spring-hateoas" - zip.type: "docs" - on_failure: - aggregate: - - put: spring-hateoas-status - params: - commit: spring-hateoas-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-hateoas-status - params: - commit: spring-hateoas-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-hateoas-pull-requests - public: true - plan: - - get: spring-hateoas-github - resource: spring-hateoas-pull-requests - trigger: true - version: every - - get: openjdk:11-jdk - - get: openjdk:13-jdk - - put: spring-hateoas-pull-requests - params: - path: spring-hateoas-github - status: pending - - aggregate: - - task: test-jdk8 - file: spring-hateoas-github/ci/test.yml - params: { PROFILE: "ci" } - - task: test-jdk11 - image: openjdk:11-jdk - file: spring-hateoas-github/ci/test.yml - params: { PROFILE: "ci" } - - task: test-jdk13 - image: openjdk:13-jdk - file: spring-hateoas-github/ci/test.yml - params: { PROFILE: "ci" } - - task: test-spring-next-jdk8 - file: spring-hateoas-github/ci/test.yml - params: { PROFILE: "ci,spring-next" } - - task: test-spring-next-jdk11 - image: openjdk:11-jdk - file: spring-hateoas-github/ci/test.yml - params: { PROFILE: "ci,spring-next" } - - task: test-spring-next-jdk13 - image: openjdk:13-jdk - file: spring-hateoas-github/ci/test.yml - params: { PROFILE: "ci,spring-next" } - on_failure: - aggregate: - - put: spring-hateoas-pull-requests - params: - path: spring-hateoas-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-hateoas-pull-requests - params: - path: spring-hateoas-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: spring-hateoas-examples-test-jdk8 - serial: true - public: true - plan: - - get: spring-hateoas-examples-github - trigger: true - - get: spring-hateoas-artifactory - trigger: true - - get: openjdk:8-jdk - trigger: true - - task: test - file: spring-hateoas-examples-github/ci/test.yml - params: { PROFILE: "non-existent" } - 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-hateoas-examples-test-jdk11 - serial: true - public: true - plan: - - get: spring-hateoas-examples-github - trigger: true - passed: [ spring-hateoas-examples-test-jdk8 ] - - get: spring-hateoas-artifactory - trigger: true - passed: [ spring-hateoas-examples-test-jdk8 ] - - get: openjdk:11-jdk - trigger: true - - task: test - image: openjdk:11-jdk - file: spring-hateoas-examples-github/ci/test.yml - params: { PROFILE: "non-existant" } - 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-hateoas-examples-test-jdk13 - serial: true - public: true - plan: - - get: spring-hateoas-examples-github - trigger: true - passed: [ spring-hateoas-examples-test-jdk8 ] - - get: spring-hateoas-artifactory - trigger: true - passed: [ spring-hateoas-examples-test-jdk8 ] - - get: openjdk:13-jdk - trigger: true - - task: test - image: openjdk:13-jdk - file: spring-hateoas-examples-github/ci/test.yml - params: { PROFILE: "non-existant" } - 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-hateoas-examples-build - serial: true - public: true - plan: - - get: spring-hateoas-examples-github - trigger: true - passed: [ - spring-hateoas-examples-test-jdk11, - spring-hateoas-examples-test-jdk13 - ] - - get: spring-hateoas-artifactory - trigger: true - passed: [ - spring-hateoas-examples-test-jdk11, - spring-hateoas-examples-test-jdk13 - ] - - get: openjdk:8-jdk - trigger: true - - put: spring-hateoas-examples-status - params: - commit: spring-hateoas-examples-github - state: pending - - task: build - file: spring-hateoas-examples-github/ci/build.yml - - put: spring-hateoas-examples-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-hateoas-examples-artifactory - artifact_set: - - include: - - "/**" - properties: - zip.deployed: false - zip.displayname: "spring-hateoas-examples" - zip.name: "spring-hateoas-examples" - zip.type: "docs" - on_failure: - aggregate: - - put: spring-hateoas-examples-status - params: - commit: spring-hateoas-examples-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-hateoas-examples-status - params: - commit: spring-hateoas-examples-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-hateoas-examples-pull-requests - public: true - plan: - - get: spring-hateoas-examples-github - resource: spring-hateoas-examples-pull-requests - trigger: true - version: every - - get: openjdk:11-jdk - - get: openjdk:13-jdk - - put: spring-hateoas-examples-pull-requests - params: - path: spring-hateoas-examples-github - status: pending - - aggregate: - - task: test-jdk8 - file: spring-hateoas-examples-github/ci/test.yml - params: { PROFILE: "non-existent" } - - task: test-jdk11 - image: openjdk:11-jdk - file: spring-hateoas-examples-github/ci/test.yml - params: { PROFILE: "non-existent" } - - task: test-jdk13 - image: openjdk:13-jdk - file: spring-hateoas-examples-github/ci/test.yml - params: { PROFILE: "non-existent" } - on_failure: - aggregate: - - put: spring-hateoas-examples-pull-requests - params: - path: spring-hateoas-examples-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-hateoas-examples-pull-requests - params: - path: spring-hateoas-examples-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: 8-jdk-with-graphviz:latest - public: true - plan: - - aggregate: - - get: 8-jdk-with-graphviz-docker-image-github - trigger: true - - get: openjdk:8-jdk - trigger: true - - put: 8-jdk-with-graphviz:latest - params: - build: 8-jdk-with-graphviz-docker-image-github/ci - -- name: release-to-artifactory - serial: true - public: true - plan: - - get: spring-hateoas-github - resource: spring-hateoas-release - trigger: true - - put: spring-hateoas-status - params: - commit: spring-hateoas-github - state: pending - - task: build - file: spring-hateoas-github/ci/build.yml - - put: spring-hateoas-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-milestone-local - folder: spring-hateoas-artifactory - artifact_set: - - include: - - "/**" - properties: - zip.deployed: false - zip.displayname: "spring-hateoas" - zip.name: "spring-hateoas" - zip.type: "docs" - on_failure: - aggregate: - - put: spring-hateoas-status - params: - commit: spring-hateoas-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-hateoas-status - params: - commit: spring-hateoas-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-hateoas-github -# resource: spring-hateoas-release -# - get: spring-hateoas-artifactory -# trigger: true -# passed: [release-to-artifactory] -# params: -# save_build_info: true -# - task: promote-to-bintray -# file: spring-hateoas-github/ci/promote-to-bintray.yml -# params: -# ARTIFACTORY_USERNAME: ((artifactory-username)) -# ARTIFACTORY_PASSWORD: ((artifactory-password)) -# on_failure: -# aggregate: -# - put: spring-hateoas-status -# params: -# commit: spring-hateoas-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-hateoas-status -# params: -# commit: spring-hateoas-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-hateoas-github -# resource: spring-hateoas-release -# - get: spring-hateoas-artifactory -# trigger: true -# passed: [promote-to-bintray] -# params: -# save_build_info: true -# - task: sync-to-maven-central -# file: spring-hateoas-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-hateoas-status -# params: -# commit: spring-hateoas-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-hateoas-status -# params: -# commit: spring-hateoas-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 -# - -- name: release-examples-to-artifactory - serial: true - public: true - plan: - - get: spring-hateoas-examples-github - resource: spring-hateoas-examples-release - trigger: true - - put: spring-hateoas-examples-status - params: - commit: spring-hateoas-examples-github - state: pending - - task: build - file: spring-hateoas-examples-github/ci/build.yml - - put: spring-hateoas-examples-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-milestone-local - folder: spring-hateoas-examples-artifactory - artifact_set: - - include: - - "/**" - properties: - zip.deployed: false - zip.displayname: "spring-hateoas-examples" - zip.name: "spring-hateoas-examples" - zip.type: "docs" - on_failure: - aggregate: - - put: spring-hateoas-examples-status - params: - commit: spring-hateoas-examples-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-hateoas-examples-status - params: - commit: spring-hateoas-examples-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 - - diff --git a/ci/promote-to-bintray.sh b/ci/promote-to-bintray.sh index e7af261b..a00bb8d6 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-hateoas-artifactory/build-info.json | jq -r '.buildInfo.name' ) -buildNumber=$( cat spring-hateoas-artifactory/build-info.json | jq -r '.buildInfo.number' ) -groupId=$( cat spring-hateoas-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' ) -version=$( cat spring-hateoas-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 ed41c054..00000000 --- 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-hateoas-artifactory -- name: spring-hateoas-github - -run: - path: spring-hateoas-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 2d5a5c16..7150ca76 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-hateoas-artifactory/build-info.json | jq -r '.buildInfo.name' ) -buildNumber=$( cat spring-hateoas-artifactory/build-info.json | jq -r '.buildInfo.number' ) -groupId=$( cat spring-hateoas-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' ) -version=$( cat spring-hateoas-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" diff --git a/ci/sync-to-maven-central.yml b/ci/sync-to-maven-central.yml deleted file mode 100644 index d72b2227..00000000 --- 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-hateoas-artifactory -- name: spring-hateoas-github - -run: - path: spring-hateoas-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 570e22ce..f6bb0bf1 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/hateoas 2> /dev/null || : - -cd spring-hateoas-github - -./mvnw clean dependency:list test -P${PROFILE} -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 b465b3a0..00000000 --- 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-hateoas-github - -caches: -- path: maven - -run: - path: spring-hateoas-github/ci/test.sh diff --git a/pom.xml b/pom.xml index 19aa9bed..f77f0ef1 100644 --- a/pom.xml +++ b/pom.xml @@ -477,6 +477,129 @@ + + snapshot + + + + + org.jfrog.buildinfo + artifactory-maven-plugin + 2.6.1 + false + + + build-info + + publish + + + + {{BUILD_URL}} + + + spring-hateoas + spring-hateoas + false + *:*:*:*@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-hateoas + spring-hateoas + false + *:*:*:*@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-hateoas + spring-hateoas + false + *:*:*:*@zip + + + https://repo.spring.io + {{ARTIFACTORY_USR}} + {{ARTIFACTORY_PSW}} + libs-release-local + libs-release-local + + + + + + + + +