Skip to content

Commit 9ebad0d

Browse files
committed
Merge branch '2.2.x'
Closes gh-20753
2 parents b0837d3 + 41255ca commit 9ebad0d

File tree

8 files changed

+124
-2
lines changed

8 files changed

+124
-2
lines changed

ci/images/get-docker-url.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -e
3+
4+
version="19.03.7"
5+
echo "https://download.docker.com/linux/static/stable/x86_64/docker-$version.tgz";

ci/images/setup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ test -f /opt/openjdk/bin/javac
2727
###########################################################
2828
# DOCKER
2929
###########################################################
30+
DOCKER_URL=$( ./get-docker-url.sh )
3031

3132
cd /
32-
curl -L https://download.docker.com/linux/static/stable/x86_64/docker-19.03.7.tgz | tar zx
33+
curl -L ${DOCKER_URL} | tar zx
3334
mv /docker/* /bin/
3435
chmod +x /bin/docker*
3536

ci/parameters.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
docker-upgrade-issue-title: "Upgrade Docker version in CI"
12
email-server: "smtp.svc.pivotal.io"
23
email-from: "[email protected]"
34
email-to: ["[email protected]"]

ci/pipeline.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ resources:
2727
username: ((github-username))
2828
password: ((github-password))
2929
branch: ((branch))
30+
- name: git-repo-ci-docker
31+
type: git
32+
icon: github-circle
33+
source:
34+
uri: ((github-repo))
35+
username: ((github-username))
36+
password: ((github-password))
37+
branch: ci-docker-((branch))
3038
- name: git-repo-windows
3139
type: git
3240
source:
@@ -209,6 +217,34 @@ jobs:
209217
GITHUB_PASSWORD: ((github-password))
210218
GITHUB_USERNAME: ((github-username))
211219
image: spring-boot-ci-image
220+
- name: detect-docker-updates
221+
plan:
222+
- get: git-repo
223+
- get: every-wednesday
224+
trigger: true
225+
- get: spring-boot-ci-image
226+
- do:
227+
- task: detect-docker-updates
228+
file: git-repo/ci/tasks/detect-docker-updates.yml
229+
params:
230+
GITHUB_REPO: spring-boot
231+
GITHUB_ORGANIZATION: spring-projects
232+
ISSUE_TITLE: ((docker-upgrade-issue-title))
233+
image: spring-boot-ci-image
234+
- put: git-repo-ci-docker
235+
params:
236+
repository: git-repo-updated
237+
force: true
238+
- task: create-pull-request
239+
file: git-repo/ci/tasks/create-pull-request.yml
240+
params:
241+
BASE_BRANCH: ((branch))
242+
BRANCH: ci-docker-((branch))
243+
GITHUB_REPO: spring-boot
244+
GITHUB_ORGANIZATION: spring-projects
245+
GITHUB_PASSWORD: ((github-password))
246+
GITHUB_USERNAME: ((github-username))
247+
ISSUE_TITLE: ((docker-upgrade-issue-title))
212248
- name: build
213249
serial: true
214250
public: true
@@ -595,6 +631,6 @@ groups:
595631
- name: "Release"
596632
jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "sync-to-maven-central"]
597633
- name: "CI Images"
598-
jobs: ["build-spring-boot-ci-images", "detect-jdk-updates", "detect-ubuntu-image-updates"]
634+
jobs: ["build-spring-boot-ci-images", "detect-docker-updates", "detect-jdk-updates", "detect-ubuntu-image-updates"]
599635
- name: "Build Pull Requests"
600636
jobs: ["build-pull-requests"]

ci/scripts/create-pull-request.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
set -e
3+
4+
commit_message=$( cat commit-details/message )
5+
6+
if [[ ${commit_message} != "" ]]; then
7+
curl \
8+
-s \
9+
-u ${GITHUB_USERNAME}:${GITHUB_PASSWORD} \
10+
-H "Content-type:application/json" \
11+
-d "{\"head\":\"${BRANCH}\",\"base\":\"${BASE_BRANCH}\",\"title\":\"${ISSUE_TITLE}\",\"body\":\"\",\"labels\":[\"status: waiting-for-triage\",\"type: task\"]}" \
12+
-f \
13+
-X \
14+
POST "https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/pulls" > /dev/null || { echo "Failed to create pull request" >&2; exit 1; }
15+
else
16+
echo "Already up-to-date"
17+
fi

ci/scripts/detect-docker-updates.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
latest_version=$(curl -I -s https://github.com/docker/docker-ce/releases/latest | grep "location:" | awk '{n=split($0, parts, "/"); print substr(parts[n],2);}' | awk '{$1=$1;print}' | tr -d '\r' | tr -d '\n' )
4+
5+
if [[ $latest_version =~ (beta|rc) ]]; then
6+
echo "Skip pre-release versions"
7+
exit 0;
8+
fi
9+
10+
latest="https://download.docker.com/linux/static/stable/x86_64/docker-$latest_version.tgz"
11+
current=$( git-repo/ci/images/get-docker-url.sh )
12+
13+
if [[ $current = $latest ]]; then
14+
echo "Already up-to-date"
15+
exit 0;
16+
fi
17+
18+
existing_tasks=$( curl -s https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/pulls\?labels\=type:%20task\&state\=open\&creator\=spring-buildmaster )
19+
existing_upgrade_issues=$( echo "$existing_tasks" | jq -c --arg TITLE "$ISSUE_TITLE" '.[] | select(.title==$TITLE)' )
20+
21+
git clone git-repo git-repo-updated > /dev/null
22+
23+
if [[ ${existing_upgrade_issues} = "" ]]; then
24+
pushd git-repo-updated > /dev/null
25+
git config user.name "Spring Buildmaster" > /dev/null
26+
git config user.email "[email protected]" > /dev/null
27+
sed -i "s/version=.*/version=\"$latest_version\"/" ci/images/get-docker-url.sh
28+
git add ci/images/get-docker-url.sh > /dev/null
29+
commit_message="Upgrade to Docker $latest_version in CI"
30+
git commit -m "$commit_message" > /dev/null
31+
echo ${commit_message} > commit-details/message
32+
else
33+
echo "Pull request already exists."
34+
fi

ci/tasks/create-pull-request.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
platform: linux
3+
inputs:
4+
- name: git-repo
5+
- name: commit-details
6+
params:
7+
BASE_BRANCH:
8+
BRANCH:
9+
GITHUB_REPO:
10+
GITHUB_ORGANIZATION:
11+
GITHUB_PASSWORD:
12+
GITHUB_USERNAME:
13+
ISSUE_TITLE:
14+
run:
15+
path: git-repo/ci/scripts/create-pull-request.sh

ci/tasks/detect-docker-updates.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
platform: linux
3+
inputs:
4+
- name: git-repo
5+
outputs:
6+
- name: git-repo-updated
7+
- name: commit-details
8+
params:
9+
GITHUB_REPO:
10+
GITHUB_ORGANIZATION:
11+
ISSUE_TITLE:
12+
run:
13+
path: git-repo/ci/scripts/detect-docker-updates.sh

0 commit comments

Comments
 (0)