You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2023/01/24 08:16:26 UTC
[arrow] branch master updated: GH-33782: [Release] Vote email number of issues is querying JIRA and producing a wrong number (#33791)
This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 22e3bed4d1 GH-33782: [Release] Vote email number of issues is querying JIRA and producing a wrong number (#33791)
22e3bed4d1 is described below
commit 22e3bed4d1820f763ff04595d4baf171e7ecae2d
Author: Rok Mihevc <ro...@mihevc.org>
AuthorDate: Tue Jan 24 09:16:17 2023 +0100
GH-33782: [Release] Vote email number of issues is querying JIRA and producing a wrong number (#33791)
### What changes are included in this PR?
Release RC vote email now gets issue number and verify release PR's url from GitHub's GraphQL API.
### Are these changes tested?
Changes were tested stand-alone from the rest of this script.
### Are there any user-facing changes?
ARROW_GITHUB_API_TOKEN is now mandatory for generating the release vote email.
* Closes: #33782
Authored-by: Rok Mihevc <ro...@mihevc.org>
Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
dev/release/02-source-test.rb | 33 +++++++++++++++++++--------------
dev/release/02-source.sh | 10 ++++++----
dev/release/test-helper.rb | 1 +
3 files changed, 26 insertions(+), 18 deletions(-)
diff --git a/dev/release/02-source-test.rb b/dev/release/02-source-test.rb
index 85718b6645..1d0fd19d01 100644
--- a/dev/release/02-source-test.rb
+++ b/dev/release/02-source-test.rb
@@ -93,18 +93,23 @@ class SourceTest < Test::Unit::TestCase
end
def test_vote
- jira_url = "https://issues.apache.org/jira"
- jql_conditions = [
- "project = ARROW",
- "status in (Resolved, Closed)",
- "fixVersion = #{@release_version}",
- ]
- jql = jql_conditions.join(" AND ")
- n_resolved_issues = nil
- search_url = URI("#{jira_url}/rest/api/2/search?jql=#{CGI.escape(jql)}")
- search_url.open do |response|
- n_resolved_issues = JSON.parse(response.read)["total"]
- end
+ github_token = ENV["ARROW_GITHUB_API_TOKEN"]
+ uri = URI.parse("https://api.github.com/graphql")
+ n_issues_query = {
+ "query" => <<-QUERY,
+ query {
+ search(query: "repo:apache/arrow is:issue is:closed milestone:#{@release_version}",
+ type: ISSUE) {
+ issueCount
+ }
+ }
+ QUERY
+ }
+ response = Net::HTTP.post(uri,
+ n_issues_query.to_json,
+ "Content-Type" => "application/json",
+ "Authorization" => "Bearer #{github_token}")
+ n_resolved_issues = JSON.parse(response.body)["data"]["search"]["issueCount"]
github_api_url = "https://api.github.com"
verify_prs = URI("#{github_api_url}/repos/apache/arrow/pulls" +
"?state=open" +
@@ -113,7 +118,7 @@ class SourceTest < Test::Unit::TestCase
headers = {
"Accept" => "application/vnd.github+json",
}
- github_token = ENV["ARROW_GITHUB_API_TOKEN"]
+
if github_token
headers["Authorization"] = "Bearer #{github_token}"
end
@@ -149,7 +154,7 @@ The vote will be open for at least 72 hours.
[ ] +0
[ ] -1 Do not release this as Apache Arrow #{@release_version} because...
-[1]: https://issues.apache.org/jira/issues/?jql=project%20%3D%20ARROW%20AND%20status%20in%20%28Resolved%2C%20Closed%29%20AND%20fixVersion%20%3D%20#{@release_version}
+[1]: https://github.com/apache/arrow/issues?q=is%3Aissue+milestone%3A#{@release_version}+is%3Aclosed
[2]: https://github.com/apache/arrow/tree/#{@current_commit}
[3]: https://dist.apache.org/repos/dist/dev/arrow/apache-arrow-#{@release_version}-rc0
[4]: https://apache.jfrog.io/artifactory/arrow/almalinux-rc/
diff --git a/dev/release/02-source.sh b/dev/release/02-source.sh
index 984d7af594..1e54d6d10d 100755
--- a/dev/release/02-source.sh
+++ b/dev/release/02-source.sh
@@ -142,9 +142,11 @@ if [ ${SOURCE_PR} -gt 0 ]; then
fi
if [ ${SOURCE_VOTE} -gt 0 ]; then
- jira_url="https://issues.apache.org/jira"
- jql="project%20%3D%20ARROW%20AND%20status%20in%20%28Resolved%2C%20Closed%29%20AND%20fixVersion%20%3D%20${version}"
- n_resolved_issues=$(curl "${jira_url}/rest/api/2/search/?jql=${jql}" | jq ".total")
+ gh_api_url="https://api.github.com/graphql"
+ curl_options=($gh_api_url)
+ curl_options+=(--header "Authorization: Bearer ${ARROW_GITHUB_API_TOKEN}")
+ curl_options+=(--data "{\"query\": \"query {search(query: \\\"repo:apache/arrow is:issue is:closed milestone:${version}\\\", type:ISSUE) {issueCount}}\"}")
+ n_resolved_issues=$(curl "${curl_options[@]}" | jq ".data.search.issueCount")
curl_options=(--header "Accept: application/vnd.github+json")
if [ -n "${ARROW_GITHUB_API_TOKEN:-}" ]; then
curl_options+=(--header "Authorization: Bearer ${ARROW_GITHUB_API_TOKEN}")
@@ -186,7 +188,7 @@ The vote will be open for at least 72 hours.
[ ] +0
[ ] -1 Do not release this as Apache Arrow ${version} because...
-[1]: ${jira_url}/issues/?jql=${jql}
+[1]: https://github.com/apache/arrow/issues?q=is%3Aissue+milestone%3A${version}+is%3Aclosed
[2]: https://github.com/apache/arrow/tree/${release_hash}
[3]: ${rc_url}
[4]: https://apache.jfrog.io/artifactory/arrow/almalinux-rc/
diff --git a/dev/release/test-helper.rb b/dev/release/test-helper.rb
index 0111f91356..1249961eb8 100644
--- a/dev/release/test-helper.rb
+++ b/dev/release/test-helper.rb
@@ -19,6 +19,7 @@ require "English"
require "cgi/util"
require "fileutils"
require "find"
+require 'net/http'
require "json"
require "open-uri"
require "rexml/document"