xref: /Lucene/dev-tools/scripts/README.md (revision 03e819267443b56709c57442fa7cc94b1b137ee0)
1<!--
2    Licensed to the Apache Software Foundation (ASF) under one or more
3    contributor license agreements.  See the NOTICE file distributed with
4    this work for additional information regarding copyright ownership.
5    The ASF licenses this file to You under the Apache License, Version 2.0
6    the "License"); you may not use this file except in compliance with
7    the License.  You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 -->
17
18# Developer Scripts
19
20This folder contains various useful scripts for developers, mostly related to
21releasing new versions of Lucene and testing those.
22
23Python scripts require Python 3.6 or avobe. To install necessary python modules, please run:
24
25    pip3 install -r requirements.txt
26
27## Scripts description
28
29### smokeTestRelease.py
30
31Used to validate new release candidates (RC). The script downloads an RC from a URL
32or local folder, then runs a number of sanity checks on the artifacts, and then runs
33the full tests.
34
35    usage: smokeTestRelease.py [-h] [--tmp-dir PATH] [--not-signed]
36                               [--local-keys PATH] [--revision REVISION]
37                               [--version X.Y.Z(-ALPHA|-BETA)?]
38                               [--test-java12 JAVA12_HOME] [--download-only]
39                               url ...
40
41    Utility to test a release.
42
43    positional arguments:
44      url                   Url pointing to release to test
45      test_args             Arguments to pass to ant for testing, e.g.
46                            -Dwhat=ever.
47
48    optional arguments:
49      -h, --help            show this help message and exit
50      --tmp-dir PATH        Temporary directory to test inside, defaults to
51                            /tmp/smoke_lucene_$version_$revision
52      --not-signed          Indicates the release is not signed
53      --local-keys PATH     Uses local KEYS file instead of fetching from
54                            https://archive.apache.org/dist/lucene/KEYS
55      --revision REVISION   GIT revision number that release was built with,
56                            defaults to that in URL
57      --version X.Y.Z(-ALPHA|-BETA)?
58                            Version of the release, defaults to that in URL
59      --test-java12 JAVA12_HOME
60                            Path to Java12 home directory, to run tests with if
61                            specified
62      --download-only       Only perform download and sha hash check steps
63
64    Example usage:
65    python3 -u dev-tools/scripts/smokeTestRelease.py https://dist.apache.org/repos/dist/dev/lucene/lucene-9.0.1-RC2-revc7510a0...
66
67### releaseWizard.py
68
69The Release Wizard guides the Release Manager through the release process step
70by step, helping you to to run the right commands in the right order, generating
71e-mail templates with the correct texts, versions, paths etc, obeying
72the voting rules and much more. It also serves as a documentation of all the
73steps, with timestamps, preserving log files from each command etc, showing only
74the steps and commands required for a major/minor/bugfix release. It also lets
75you generate a full Asciidoc guide for the release. The wizard will execute many
76of the other tools in this folder.
77
78    usage: releaseWizard.py [-h] [--dry-run] [--init]
79
80    Script to guide a RM through the whole release process
81
82    optional arguments:
83      -h, --help  show this help message and exit
84      --dry-run   Do not execute any commands, but echo them instead. Display
85                  extra debug info
86      --init      Re-initialize root and version
87
88    Go push that release!
89
90### buildAndPushRelease.py
91
92    usage: buildAndPushRelease.py [-h] [--no-prepare] [--local-keys PATH]
93                                  [--push-local PATH] [--sign KEYID]
94                                  [--rc-num NUM] [--root PATH] [--logfile PATH]
95
96    Utility to build, push, and test a release.
97
98    optional arguments:
99      -h, --help         show this help message and exit
100      --no-prepare       Use the already built release in the provided checkout
101      --local-keys PATH  Uses local KEYS file to validate presence of RM's gpg key
102      --push-local PATH  Push the release to the local path
103      --sign KEYID       Sign the release with the given gpg key
104      --rc-num NUM       Release Candidate number. Default: 1
105      --root PATH        Root of Git working tree for lucene. Default: "."
106                         (the current directory)
107      --logfile PATH     Specify log file path (default /tmp/release.log)
108
109    Example usage for a Release Manager:
110    python3 -u dev-tools/scripts/buildAndPushRelease.py --push-local /tmp/releases/6.0.1 --sign 6E68DA61 --rc-num 1
111
112### addBackcompatIndexes.py
113
114    usage: addBackcompatIndexes.py [-h] [--force] [--no-cleanup] [--temp-dir DIR]
115                                   version
116
117    Add backcompat index and test for new version.  See:
118    http://wiki.apache.org/lucene-java/ReleaseTodo#Generate_Backcompat_Indexes
119
120    positional arguments:
121      version         Version to add, of the form X.Y.Z
122
123    optional arguments:
124      -h, --help      show this help message and exit
125      --force         Redownload the version and rebuild, even if it already
126                      exists
127      --no-cleanup    Do not cleanup the built indexes, so that they can be reused
128                      for adding to another branch
129      --temp-dir DIR  Temp directory to build backcompat indexes within
130
131### addVersion.py
132
133    usage: addVersion.py [-h] version
134
135    Add a new version to CHANGES, to Version.java and build.gradle files
136
137    positional arguments:
138      version
139
140    optional arguments:
141      -h, --help  show this help message and exit
142
143### releasedJirasRegex.py
144
145Pulls out all JIRAs mentioned at the beginning of bullet items
146under the given version in the given CHANGES.txt file
147and prints a regular expression that will match all of them
148
149    usage: releasedJirasRegex.py [-h] version changes
150
151    Prints a regex matching JIRAs fixed in the given version by parsing the given
152    CHANGES.txt file
153
154    positional arguments:
155      version     Version of the form X.Y.Z
156      changes     CHANGES.txt file to parse
157
158    optional arguments:
159      -h, --help  show this help message and exit
160
161### reproduceJenkinsFailures.py
162
163    usage: reproduceJenkinsFailures.py [-h] [--no-git] [--iters N] URL
164
165    Must be run from a Lucene git workspace. Downloads the Jenkins
166    log pointed to by the given URL, parses it for Git revision and failed
167    Lucene tests, checks out the Git revision in the local workspace,
168    groups the failed tests by module, then runs
169    'ant test -Dtest.dups=%d -Dtests.class="*.test1[|*.test2[...]]" ...'
170    in each module of interest, failing at the end if any of the runs fails.
171    To control the maximum number of concurrent JVMs used for each module's
172    test run, set 'tests.jvms', e.g. in ~/lucene.build.properties
173
174    positional arguments:
175      URL         Points to the Jenkins log to parse
176
177    optional arguments:
178      -h, --help  show this help message and exit
179      --no-git    Do not run "git" at all
180      --iters N   Number of iterations per test suite (default: 5)
181
182### githubPRs.py
183
184    usage: githubPRs.py [-h] [--json] [--token TOKEN]
185
186    Find open Pull Requests that need attention
187
188    optional arguments:
189      -h, --help     show this help message and exit
190      --json         Output as json
191      --token TOKEN  Github access token in case you query too often anonymously
192
193### gitignore-gen.sh
194
195TBD
196
197