From ed71fe04601d78f1730da780c0a93a48f87b5be6 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 9 Mar 2021 15:17:06 +0100 Subject: [PATCH] Publish directly to Maven Central This commit skips the Bintray-related tasks in our CI pipeline and instead relies on Maven Central for publishing Spring Framework artifacts. This commit also updates the CI pipeline to sign the artifacts directly with the `artifactory-resource`. Closes gh-26654 --- ci/config/release-scripts.yml | 13 +++++++------ ci/images/setup.sh | 4 ++-- ci/parameters.yml | 2 -- ci/pipeline.yml | 23 ++++++++--------------- ci/scripts/generate-changelog.sh | 3 ++- ci/scripts/promote-version.sh | 6 ++++-- ci/tasks/generate-changelog.yml | 4 ++-- ci/tasks/promote-version.yml | 8 ++++---- ci/tasks/sync-to-maven-central.yml | 16 ---------------- 9 files changed, 29 insertions(+), 50 deletions(-) delete mode 100644 ci/tasks/sync-to-maven-central.yml diff --git a/ci/config/release-scripts.yml b/ci/config/release-scripts.yml index 1e70c90e68..cfe0ee88ad 100644 --- a/ci/config/release-scripts.yml +++ b/ci/config/release-scripts.yml @@ -1,9 +1,10 @@ -logging: - level: - io.spring.concourse: DEBUG -distribute: - optional-deployments: - - '.*\.zip' spring: main: banner-mode: off +logging: + level: + io.spring.concourse: DEBUG +sonatype: + exclude: + - 'build-info\.json' + - '.*\.zip' diff --git a/ci/images/setup.sh b/ci/images/setup.sh index 9942d5acc1..87c3fbc2cc 100755 --- a/ci/images/setup.sh +++ b/ci/images/setup.sh @@ -12,9 +12,9 @@ ln -fs /usr/share/zoneinfo/UTC /etc/localtime dpkg-reconfigure --frontend noninteractive tzdata rm -rf /var/lib/apt/lists/* -curl https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.3/concourse-java.sh > /opt/concourse-java.sh +curl https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.4/concourse-java.sh > /opt/concourse-java.sh -curl --output /opt/concourse-release-scripts.jar https://repo.spring.io/release/io/spring/concourse/releasescripts/concourse-release-scripts/0.2.1/concourse-release-scripts-0.2.1.jar +curl --output /opt/concourse-release-scripts.jar https://repo.spring.io/release/io/spring/concourse/releasescripts/concourse-release-scripts/0.3.0/concourse-release-scripts-0.3.0.jar ########################################################### # JAVA diff --git a/ci/parameters.yml b/ci/parameters.yml index 3e09f785eb..f08d0722cc 100644 --- a/ci/parameters.yml +++ b/ci/parameters.yml @@ -9,6 +9,4 @@ branch: "master" build-name: "spring-framework" pipeline-name: "spring-framework" concourse-url: "https://ci.spring.io" -bintray-subject: "spring" -bintray-repo: "jars" task-timeout: 1h00m \ No newline at end of file diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 7bfae68bd0..30f2f4512e 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -3,11 +3,6 @@ anchors: ARTIFACTORY_SERVER: ((artifactory-server)) ARTIFACTORY_USERNAME: ((artifactory-username)) ARTIFACTORY_PASSWORD: ((artifactory-password)) - bintray-task-params: &bintray-task-params - BINTRAY_SUBJECT: ((bintray-subject)) - BINTRAY_REPO: ((bintray-repo)) - BINTRAY_USERNAME: ((bintray-username)) - BINTRAY_API_KEY: ((bintray-api-key)) docker-resource-source: &docker-resource-source username: ((docker-hub-username)) password: ((docker-hub-password)) @@ -27,6 +22,8 @@ anchors: sonatype-task-params: &sonatype-task-params SONATYPE_USER_TOKEN: ((sonatype-user-token)) SONATYPE_PASSWORD_TOKEN: ((sonatype-user-token-password)) + SONATYPE_URL: ((sonatype-url)) + SONATYPE_STAGING_PROFILE_ID: ((sonatype-staging-profile-id)) changelog-task-params: &changelog-task-params name: generated-changelog/tag tag: generated-changelog/tag @@ -40,7 +37,7 @@ resource_types: type: registry-image source: repository: springio/artifactory-resource - tag: 0.0.12 + tag: 0.0.13 - name: github-status-resource type: registry-image source: @@ -195,6 +192,8 @@ jobs: params: { state: "success", commit: "git-repo" } - put: artifactory-repo params: &artifactory-params + signing_key: ((signing-key)) + signing_passphrase: ((signing-passphrase)) repo: libs-snapshot-local folder: distribution-repository build_uri: "https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}" @@ -405,8 +404,8 @@ jobs: params: RELEASE_TYPE: RELEASE <<: *artifactory-task-params - <<: *bintray-task-params -- name: sync-to-maven-central + <<: *sonatype-task-params +- name: create-github-release serial: true plan: - get: spring-framework-ci-image @@ -417,12 +416,6 @@ jobs: params: download_artifacts: false save_build_info: true - - task: sync-to-maven-central - image: spring-framework-ci-image - file: git-repo/ci/tasks/sync-to-maven-central.yml - params: - <<: *bintray-task-params - <<: *sonatype-task-params - task: generate-changelog file: git-repo/ci/tasks/generate-changelog.yml params: @@ -436,6 +429,6 @@ groups: - name: "builds" jobs: ["build", "jdk11-build", "jdk15-build"] - name: "releases" - jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone","promote-rc", "promote-release", "sync-to-maven-central"] + jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone","promote-rc", "promote-release", "create-github-release"] - name: "ci-images" jobs: ["build-spring-framework-ci-images"] diff --git a/ci/scripts/generate-changelog.sh b/ci/scripts/generate-changelog.sh index b0bc952a33..945717c77d 100755 --- a/ci/scripts/generate-changelog.sh +++ b/ci/scripts/generate-changelog.sh @@ -2,7 +2,8 @@ set -e CONFIG_DIR=git-repo/ci/config -version=$( cat version/version ) +version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) + java -jar /github-changelog-generator.jar \ --spring.config.location=${CONFIG_DIR}/changelog-generator.yml \ diff --git a/ci/scripts/promote-version.sh b/ci/scripts/promote-version.sh index 3b8dab0151..44c5ff626f 100755 --- a/ci/scripts/promote-version.sh +++ b/ci/scripts/promote-version.sh @@ -6,11 +6,13 @@ CONFIG_DIR=git-repo/ci/config version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) export BUILD_INFO_LOCATION=$(pwd)/artifactory-repo/build-info.json -java -jar /opt/concourse-release-scripts.jar promote $RELEASE_TYPE $BUILD_INFO_LOCATION || { exit 1; } +java -jar /opt/concourse-release-scripts.jar \ + --spring.config.location=${CONFIG_DIR}/release-scripts.yml \ + publishToCentral $RELEASE_TYPE $BUILD_INFO_LOCATION artifactory-repo || { exit 1; } java -jar /opt/concourse-release-scripts.jar \ --spring.config.location=${CONFIG_DIR}/release-scripts.yml \ - distribute $RELEASE_TYPE $BUILD_INFO_LOCATION || { exit 1; } + promote $RELEASE_TYPE $BUILD_INFO_LOCATION || { exit 1; } echo "Promotion complete" echo $version > version/version diff --git a/ci/tasks/generate-changelog.yml b/ci/tasks/generate-changelog.yml index 2df097bc29..334ebab566 100755 --- a/ci/tasks/generate-changelog.yml +++ b/ci/tasks/generate-changelog.yml @@ -4,10 +4,10 @@ image_resource: type: docker-image source: repository: springio/github-changelog-generator - tag: '0.0.4' + tag: '0.0.6' inputs: - name: git-repo -- name: version +- name: artifactory-repo outputs: - name: generated-changelog params: diff --git a/ci/tasks/promote-version.yml b/ci/tasks/promote-version.yml index 2da899a0eb..831e5c93c7 100644 --- a/ci/tasks/promote-version.yml +++ b/ci/tasks/promote-version.yml @@ -10,9 +10,9 @@ params: ARTIFACTORY_SERVER: ARTIFACTORY_USERNAME: ARTIFACTORY_PASSWORD: - BINTRAY_SUBJECT: - BINTRAY_REPO: - BINTRAY_USERNAME: - BINTRAY_API_KEY: + SONATYPE_USER_TOKEN: + SONATYPE_PASSWORD_TOKEN: + SONATYPE_URL: + SONATYPE_STAGING_PROFILE_ID: run: path: git-repo/ci/scripts/promote-version.sh diff --git a/ci/tasks/sync-to-maven-central.yml b/ci/tasks/sync-to-maven-central.yml deleted file mode 100644 index a44af5af16..0000000000 --- a/ci/tasks/sync-to-maven-central.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -platform: linux -inputs: -- name: git-repo -- name: artifactory-repo -outputs: -- name: version -params: - BINTRAY_REPO: - BINTRAY_SUBJECT: - BINTRAY_USERNAME: - BINTRAY_API_KEY: - SONATYPE_USER_TOKEN: - SONATYPE_PASSWORD_TOKEN: -run: - path: git-repo/ci/scripts/sync-to-maven-central.sh