Skip to content

Commit 2227546

Browse files
Modernize lts-candidate-stats script (#765)
Co-authored-by: Mark Waite <[email protected]>
1 parent f0c7161 commit 2227546

File tree

4 files changed

+67
-138
lines changed

4 files changed

+67
-138
lines changed

.github/ISSUE_TEMPLATE/1-lts-release-checklist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Remember to exchange the LTS version, release date and Jira URLs.
4848

4949
- [ ] Backport changes, run the [list-issue-commits script](https://github.com/jenkins-infra/release/blob/master/tools/list-issue-commits) to locate commits via Jira ID, some manual work is required to locate them if the issue ID wasn't present at merge time, backport with `git cherry-pick -x $commit`.
5050

51-
- [ ] Open backporting PR with `into-lts` label and summary of changes in description from [lts-candidate-stats script](https://github.com/jenkins-infra/release/blob/master/tools/lts-candidate-stats) and:
51+
- [ ] Open backporting PR with `into-lts` label and summary of changes in description from [lts-candidate-stats script](https://github.com/jenkins-infra/release/blob/master/tools/lts-candidate-stats.sh) and:
5252
- [ ] the selected [Jira lts-candidates](https://issues.jenkins-ci.org/issues/?filter=12146).
5353
- [ ] possible LTS candidates in the [release](https://github.com/jenkins-infra/release/issues?q=is%3Aclosed+label%3Alts-candidate+) repository.
5454
- [ ] possible LTS candidates in the [packaging](https://github.com/jenkinsci/packaging/issues?q=is%3Aclosed+label%3Alts-candidate) repository.

tools/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ There is a couple of manual tasks that needs to follow described in the output.
1414

1515
### Backporting
1616

17-
Process through [LTS Candidates](https://issues.jenkins.io/issues/?filter=12146) and update label `lts-candidate` to `${VERSION}-fixed` or `${VERSION}-rejected`. See `lts-candidate-stats <next_lts_version>` for status report.
17+
Process through [LTS Candidates](https://issues.jenkins.io/issues/?filter=12146) and update label `lts-candidate` to `${VERSION}-fixed` or `${VERSION}-rejected`. See `./lts-candidate-stats.sh <next_lts_version>` for status report.
1818

1919
#### Identify issue commits
2020

tools/lts-candidate-stats

Lines changed: 0 additions & 136 deletions
This file was deleted.

tools/lts-candidate-stats.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
if [ -z "$(command -v xmllint)" ]; then
6+
echo "Error: xmllint is not installed. Please install it to continue." >&2
7+
exit 1
8+
fi
9+
10+
PREFIX="https://issues.jenkins.io/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?tempMax=1000&jqlQuery="
11+
12+
if [ "$#" -ne 1 ]; then
13+
echo "Usage: ./lts-candidate-stats.sh <version>" >&2
14+
exit 1
15+
fi
16+
17+
label_version_dot="$1"
18+
19+
targetVersion=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --batch-mode)
20+
if [[ "$targetVersion" != *"$version"* ]]; then
21+
echo "The previous version does not appear to be released yet: $targetVersion" >&2
22+
exit 1
23+
fi
24+
25+
git fetch upstream master:master
26+
echo "Latest core version: $(git describe master --abbrev=0)"
27+
28+
fetch_issues() {
29+
local url="$1"
30+
curl -s "$url" | xmllint --xpath "//*[local-name()='item']" - 2>/dev/null | \
31+
awk '
32+
/<item/ {initem=1; title=""; link=""}
33+
/<\/item>/ {if (title && link) print "- " title " (" link ")"; initem=0}
34+
initem && /<title>/ {sub(/.*<title>/,""); sub(/<\/title>.*/,""); title=$0}
35+
initem && /<link>/ {sub(/.*<link>/,""); sub(/<\/link>.*/,""); link=$0}
36+
'
37+
}
38+
39+
fetch_postponed_candidates() {
40+
local url="$1"
41+
curl -s "$url" | xmllint --xpath "//*[local-name()='item']" - 2>/dev/null | \
42+
awk -v rejected="${label_version_dot}-rejected" '
43+
/<item/ {initem=1; title=""; link=""; label=""}
44+
/<\/item>/ {
45+
if (title && link && label ~ rejected)
46+
print "- " title " (" link ")";
47+
initem=0
48+
}
49+
initem && /<title>/ {sub(/.*<title>/,""); sub(/<\/title>.*/,""); title=$0}
50+
initem && /<link>/ {sub(/.*<link>/,""); sub(/<\/link>.*/,""); link=$0}
51+
initem && /<label>.*<\/label>/ {
52+
sub(/.*<label>/,"");
53+
sub(/<\/label>.*/,"");
54+
if ($0 ~ rejected) {
55+
label=$1;
56+
}
57+
}
58+
'
59+
}
60+
61+
echo -e "\nFixed:\n------------------"
62+
fetch_issues "${PREFIX}labels%3D${label_version_dot}-fixed"
63+
64+
echo -e "\nPostponed:\n------------------"
65+
fetch_postponed_candidates "https://issues.jenkins.io/sr/jira.issueviews:searchrequest-xml/12146/SearchRequest-12146.xml?tempMax=1000"

0 commit comments

Comments
 (0)