Skip to content

Commit f2ec97d

Browse files
spikymonkeyroyclarkson
authored andcommitted
Updates to the staging process
* Pipeline now fetches tags so the task doesn't have to * Staging jobs now take git versions that have passed ATs. This avoids the need to run all the tests again, taking staging down from ~20 mins to ~2 * Version bumps are done on a branch to avoid pushing to protected `master branch` * Debug output and script tidying
1 parent 1b84af1 commit f2ec97d

File tree

2 files changed

+38
-32
lines changed

2 files changed

+38
-32
lines changed

ci/pipeline.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
- get: release-ci-image
8080
- get: git-repo
8181
trigger: false
82+
passed: [run-acceptance-tests]
8283
- task: stage
8384
image: release-ci-image
8485
file: git-repo/ci/tasks/stage.yml
@@ -97,6 +98,7 @@ jobs:
9798
- get: release-ci-image
9899
- get: git-repo
99100
trigger: false
101+
passed: [run-acceptance-tests]
100102
- task: stage
101103
image: release-ci-image
102104
file: git-repo/ci/tasks/stage.yml
@@ -115,6 +117,7 @@ jobs:
115117
- get: release-ci-image
116118
- get: git-repo
117119
trigger: false
120+
passed: [run-acceptance-tests]
118121
- task: stage
119122
image: release-ci-image
120123
file: git-repo/ci/tasks/stage.yml
@@ -258,6 +261,7 @@ resources:
258261
password: ((github-password))
259262
branch: ((branch))
260263
ignore_paths: ["ci/images/*"]
264+
fetch_tags: true
261265
- name: ci-images-git-repo
262266
type: git
263267
source:
@@ -283,9 +287,7 @@ resources:
283287
source:
284288
url: {{scs-slack-webhook}}
285289
groups:
286-
- name: "Build"
287-
jobs: ["build", "run-acceptance-tests"]
288-
- name: "Release"
289-
jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "distribute-release", "sync-to-maven-central"]
290+
- name: "Main"
291+
jobs: ["build", "run-acceptance-tests", "stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "distribute-release", "sync-to-maven-central"]
290292
- name: "CI Images"
291293
jobs: ["build-release-ci-images"]

ci/scripts/stage.sh

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,55 @@
11
#!/bin/bash
2-
set -e
2+
set -euo pipefail
33

44
# shellcheck source=scripts/common.sh
55
source "$(dirname "$0")/common.sh"
66
repository=$(pwd)/distribution-repository
77

8-
pushd git-repo >/dev/null
9-
git fetch --tags --all >/dev/null
10-
popd >/dev/null
11-
12-
git clone git-repo stage-git-repo >/dev/null
8+
git clone git-repo stage-git-repo
9+
echo
1310

1411
pushd stage-git-repo >/dev/null
12+
git config user.name "Spring Buildmaster"
13+
git config user.email "[email protected]"
1514

1615
snapshotVersion=$(awk -F '=' '$1 == "version" { print $2 }' gradle.properties)
1716
if [[ $RELEASE_TYPE == "M" ]]; then
18-
stageVersion=$(get_next_milestone_release $snapshotVersion)
19-
nextVersion=$snapshotVersion
17+
stageVersion=$(get_next_milestone_release "$snapshotVersion")
18+
nextVersion="$snapshotVersion"
2019
elif [[ $RELEASE_TYPE == "RC" ]]; then
21-
stageVersion=$(get_next_rc_release $snapshotVersion)
22-
nextVersion=$snapshotVersion
20+
stageVersion=$(get_next_rc_release "$snapshotVersion")
21+
nextVersion="$snapshotVersion"
2322
elif [[ $RELEASE_TYPE == "RELEASE" ]]; then
24-
stageVersion=$(get_next_release $snapshotVersion)
25-
nextVersion=$(bump_version_number $snapshotVersion)
23+
stageVersion=$(get_next_release "$snapshotVersion")
24+
nextVersion=$(bump_version_number "$snapshotVersion")
2625
else
2726
echo "Unknown release type $RELEASE_TYPE" >&2
2827
exit 1
2928
fi
3029

31-
echo "Staging $stageVersion (next version will be $nextVersion)"
32-
sed -i "s/version=$snapshotVersion/version=$stageVersion/" gradle.properties
33-
34-
git config user.name "Spring Buildmaster" >/dev/null
35-
git config user.email "[email protected]" >/dev/null
36-
git add gradle.properties >/dev/null
37-
git commit -m"Release v$stageVersion" >/dev/null
38-
git tag -a "v$stageVersion" -m"Release v$stageVersion" >/dev/null
30+
echo "Current version is v$snapshotVersion"
31+
echo "Version to stage is v$stageVersion"
32+
echo "Next development version will be v$nextVersion"
33+
echo
3934

40-
./gradlew --no-daemon clean build install -Dmaven.repo.local="${repository}"
35+
git checkout -b "merge-on-success/$stageVersion"
36+
echo
4137

42-
git reset --hard HEAD^ >/dev/null
43-
if [[ $nextVersion != $snapshotVersion ]]; then
44-
echo "Setting next development version (v$nextVersion)"
45-
sed -i "s/version=$snapshotVersion/version=$nextVersion/" gradle.properties
46-
git add gradle.properties >/dev/null
47-
git commit -m"Next development version (v$nextVersion)" >/dev/null
48-
fi
38+
echo "Tagging version being staged (v$stageVersion)"
39+
sed -i "s/version=$snapshotVersion/version=$stageVersion/" gradle.properties
40+
git add gradle.properties
41+
git commit -m "Release v$stageVersion"
42+
git tag -a "v$stageVersion" -m "Release v$stageVersion"
43+
echo
44+
45+
./gradlew --no-daemon clean install -Dmaven.repo.local="${repository}"
46+
echo
47+
48+
echo "Setting next development version (v$nextVersion)"
49+
sed -i "s/version=$stageVersion/version=$nextVersion/" gradle.properties
50+
git add gradle.properties
51+
git commit -m "Next development version (v$nextVersion)"
52+
echo
4953

5054
echo "DONE"
5155

0 commit comments

Comments
 (0)