Skip to content

Commit

Permalink
Automate homebrew tap repo update
Browse files Browse the repository at this point in the history
Closes gh-24677
  • Loading branch information
mbhave committed Jan 7, 2021
1 parent a302238 commit b309980
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
1 change: 1 addition & 0 deletions ci/parameters.yml
Expand Up @@ -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"
Expand Down
32 changes: 31 additions & 1 deletion ci/pipeline.yml
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down
20 changes: 20 additions & 0 deletions 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
11 changes: 11 additions & 0 deletions 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

0 comments on commit b309980

Please sign in to comment.