Skip to content

Commit d5d7df9

Browse files
dsmileyclaude
andauthored
Add releaseDryRun.sh: CI dry run of the release process (#5252)
It's for the Solr-Smoketest-* Jenkins jobs. * smokeTestRelease.py: SMOKETEST_SRC_TEST_TASK to reduce/eliminate unit tests to run * git-status.gradle: allow source only execution in a subdirectory of another git checkout Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 7391b7d commit d5d7df9

4 files changed

Lines changed: 69 additions & 12 deletions

File tree

‎dev-tools/scripts/README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ the full tests.
3838
python3 -u dev-tools/scripts/smokeTestRelease.py https://dist.apache.org/repos/dist/dev/solr/solr-10.0.0-RC1-rev-c7510a0...
3939

4040

41+
### releaseDryRun.sh
42+
43+
Dry run of the release process for the version in `build.gradle`, without signing or
44+
publishing anything: prepares the changelog on a local branch, builds an RC with
45+
`buildAndPushRelease.py`, and smoke tests it. Used by the `Solr-Smoketest-*` Jenkins jobs.
46+
47+
Usage: dev-tools/scripts/releaseDryRun.sh [TMP_DIR]
48+
4149
### releaseWizard.py
4250

4351
The Release Wizard guides the Release Manager through the release process step

‎dev-tools/scripts/releaseDryRun.sh‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
# Dry run of the release process for the version in build.gradle: prepares the
3+
# changelog (committed to a local "release-dry-run" branch, never pushed), builds
4+
# an unsigned RC with buildAndPushRelease.py, then runs smokeTestRelease.py on it.
5+
# Used by the Solr-Smoketest-* Jenkins jobs.
6+
#
7+
# Usage: dev-tools/scripts/releaseDryRun.sh [TMP_DIR]
8+
# TMP_DIR must be outside the git checkout; it is deleted first.
9+
10+
set -euo pipefail
11+
cd "$(git rev-parse --show-toplevel)"
12+
13+
TMP_ROOT="${1:-${WORKSPACE:-$(pwd)}_smoke}"
14+
15+
if [[ -n "$(git status --porcelain --untracked-files=no)" ]]; then
16+
echo "Working tree has uncommitted changes" >&2
17+
exit 1
18+
fi
19+
20+
pip3 install -r dev-tools/scripts/requirements.txt
21+
22+
[[ -e "$TMP_ROOT" ]] && chmod -R u+w "$TMP_ROOT"
23+
rm -rf "$TMP_ROOT"
24+
mkdir -p "$TMP_ROOT"
25+
26+
VERSION=$(cd dev-tools/scripts && python3 -c 'import scriptutil;print(scriptutil.find_current_version())')
27+
echo "Dry run of release $VERSION in $TMP_ROOT"
28+
29+
ORIG_REF=$(git symbolic-ref -q --short HEAD || git rev-parse HEAD)
30+
trap 'git checkout -q "$ORIG_REF"' EXIT
31+
32+
export GIT_AUTHOR_NAME=ci GIT_AUTHOR_EMAIL=ci@localhost GIT_COMMITTER_NAME=ci GIT_COMMITTER_EMAIL=ci@localhost
33+
git checkout -B release-dry-run
34+
python3 -u dev-tools/scripts/logchange.py prepare --version "$VERSION" --release-branch release-dry-run --commit
35+
36+
python3 -u dev-tools/scripts/buildAndPushRelease.py --dev-mode --push-local "$TMP_ROOT/dist" --rc-num 1
37+
38+
# Unit tests run in the regular CI jobs; here just check that the source release compiles.
39+
export SMOKETEST_SRC_TEST_TASK=testClasses
40+
41+
python3 -u dev-tools/scripts/smokeTestRelease.py --not-signed --tmp-dir "$TMP_ROOT/smoke" \
42+
"file://$TMP_ROOT/dist/solr-$VERSION-RC1-rev-$(git rev-parse HEAD)"

‎dev-tools/scripts/smokeTestRelease.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,10 @@ def verifySrcUnpacked(java, artifact, unpackPath, version, testArgs, tmpDir):
651651
print(' run "%s"' % validateCmd)
652652
java.run_java(validateCmd, '%s/documentation.log' % logDir)
653653

654-
print(" run tests w/ Java %s and testArgs='%s'..." % (java.version, testArgs))
655-
java.run_java('./gradlew test %s' % testArgs, '%s/test.log' % logDir)
654+
# SMOKETEST_SRC_TEST_TASK lets CI swap the full test run for something lighter
655+
testTask = os.environ.get('SMOKETEST_SRC_TEST_TASK', 'test')
656+
print(" run %s w/ Java %s and testArgs='%s'..." % (testTask, java.version, testArgs))
657+
java.run_java('./gradlew %s %s' % (testTask, testArgs), '%s/test.log' % logDir)
656658
# Some integration tests need the Docker image of the binary release, and skip without it
657659
if subprocess.call('docker info', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) == 0:
658660
print(" build docker image from solr-%s.tgz" % version)

‎gradle/validation/git-status.gradle‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,23 @@ buildscript {
3737
}
3838

3939
configure(rootProject) {
40+
// Only a repository rooted at the project dir counts, not a parent checkout that merely contains it
41+
// (e.g. an unpacked source release inside a clone).
42+
def findGitRepository = {
43+
if (!rootProject.file(".git").exists()) {
44+
throw new RepositoryNotFoundException(rootProject.projectDir)
45+
}
46+
return new FileRepositoryBuilder()
47+
.findGitDir(rootProject.projectDir)
48+
.setWorkTree(rootProject.projectDir)
49+
.setMustExist(true)
50+
.build()
51+
}
52+
4053
task gitStatus() {
4154
doFirst {
4255
try {
43-
def repository = new FileRepositoryBuilder()
44-
.findGitDir(rootProject.projectDir)
45-
.setWorkTree(rootProject.projectDir)
46-
.setMustExist(true)
47-
.build()
56+
def repository = findGitRepository()
4857

4958
def ref = repository.findRef("HEAD").getObjectId()
5059
project.ext.gitRev = ref.name()
@@ -65,11 +74,7 @@ configure(rootProject) {
6574
doFirst {
6675
def status
6776
try {
68-
def repository = new FileRepositoryBuilder()
69-
.findGitDir(rootProject.projectDir)
70-
.setWorkTree(rootProject.projectDir)
71-
.setMustExist(true)
72-
.build()
77+
def repository = findGitRepository()
7378
status = new Git(repository).status().call()
7479
} catch (RepositoryNotFoundException | NoWorkTreeException e) {
7580
status = null

0 commit comments

Comments
 (0)