From b309980a5922a0090959a9f6e83e57de3bd7af3f Mon Sep 17 00:00:00 2001 From: Madhura Bhave Date: Thu, 7 Jan 2021 13:57:57 -0800 Subject: [PATCH] Automate homebrew tap repo update Closes gh-24677 --- ci/parameters.yml | 1 + ci/pipeline.yml | 32 ++++++++++++++++++++++++++++++- ci/scripts/update-homebrew-tap.sh | 20 +++++++++++++++++++ ci/tasks/update-homebrew-tap.yml | 11 +++++++++++ 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100755 ci/scripts/update-homebrew-tap.sh create mode 100755 ci/tasks/update-homebrew-tap.yml diff --git a/ci/parameters.yml b/ci/parameters.yml index f9a96df539..752d69b9b8 100644 --- a/ci/parameters.yml +++ b/ci/parameters.yml @@ -3,6 +3,7 @@ email-from: "ci@spring.io" email-to: ["spring-boot-dev@pivotal.io"] github-repo: "https://github.com/spring-projects/spring-boot.git" github-repo-name: "spring-projects/spring-boot" +homebrew-tap-repo: "https://github.com/spring-io/homebrew-tap.git" docker-hub-organization: "springci" artifactory-server: "https://repo.spring.io" branch: "2.3.x" diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 92dfb18c57..729a95e9ec 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -73,6 +73,11 @@ anchors: silent: true icon_emoji: ":concourse:" username: concourse-ci + homebrew-tap-repo-resource-source: &homebrew-tap-repo-resource-source + uri: ((homebrew-tap-repo)) + username: ((github-username)) + password: ((github-password)) + branch: master resource_types: - name: artifactory-resource type: registry-image @@ -206,6 +211,11 @@ resources: type: time icon: clock-outline source: { interval: "24h" } +- name: homebrew-tap-repo + type: git + icon: github + source: + <<: *homebrew-tap-repo-resource-source jobs: - name: build-ci-images plan: @@ -614,11 +624,31 @@ jobs: RELEASE_TYPE: RELEASE BRANCH: ((branch)) LATEST_GA: false +- name: update-homebrew-tap + serial: true + plan: + - get: ci-image + - get: git-repo + resource: homebrew-tap-repo + - get: artifactory-repo + passed: [sync-to-maven-central] + params: + download_artifacts: false + save_build_info: true + - task: update-homebrew-tap + image: ci-image + file: git-repo/ci/tasks/update-homebrew-tap.yml + params: + LATEST_GA: false + - put: git-repo + resource: homebrew-tap-repo + params: + repository: updated-repo groups: - name: "builds" jobs: ["build", "jdk11-build", "jdk15-build", "windows-build"] - name: "releases" - jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "sync-to-maven-central", "publish-to-sdkman"] + jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "sync-to-maven-central", "publish-to-sdkman", "update-homebrew-tap"] - name: "ci-images" jobs: ["build-ci-images", "detect-docker-updates", "detect-jdk-updates", "detect-ubuntu-image-updates"] - name: "pull-requests" diff --git a/ci/scripts/update-homebrew-tap.sh b/ci/scripts/update-homebrew-tap.sh new file mode 100755 index 0000000000..8c0baeec3c --- /dev/null +++ b/ci/scripts/update-homebrew-tap.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) + +git clone git-repo updated-repo > /dev/null + +if [[ $LATEST_GA = true ]]; then +pushd updated-repo > /dev/null + cd homebrew-tap + wget https://repo.spring.io/libs-release-local/org/springframework/boot/spring-boot-cli/${version}/spring-boot-cli-${version}-homebrew.rb + rm spring-boot.rb + mv spring-boot-cli-*.rb spring-boot.rb + git config user.name "Spring Buildmaster" > /dev/null + git config user.email "buildmaster@springframework.org" > /dev/null + git add spring-boot.rb > /dev/null + git commit -m "Upgrade to Spring Boot ${version}" > /dev/null + echo "DONE" +popd > /dev/null +fi \ No newline at end of file diff --git a/ci/tasks/update-homebrew-tap.yml b/ci/tasks/update-homebrew-tap.yml new file mode 100755 index 0000000000..4caca3bdf5 --- /dev/null +++ b/ci/tasks/update-homebrew-tap.yml @@ -0,0 +1,11 @@ +--- +platform: linux +inputs: + - name: git-repo + - name: artifactory-repo +outputs: + - name: updated-repo +params: + LATEST_GA: +run: + path: git-repo/ci/scripts/update-homebrew-tap.sh \ No newline at end of file