|
| 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