You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/09/16 13:12:56 UTC

[GitHub] [pulsar] tisonkun commented on a diff in pull request #17693: [feat][CI] Add approval solution to reduce GitHub Actions resource consumption

tisonkun commented on code in PR #17693:
URL: https://github.com/apache/pulsar/pull/17693#discussion_r973010235


##########
build/pulsar_ci_tool.sh:
##########
@@ -154,6 +154,59 @@ function ci_move_test_reports() {
   )
 }
 
+function ci_check_ready_to_test() {
+  if [[ -z "$GITHUB_EVENT_PATH" ]]; then
+    >&2 echo "GITHUB_EVENT_PATH isn't set"
+    return 1
+  fi
+  # check ready-to-test label
+  if ! yq eval -e '.pull_request.labels[] | .name | select(. == "ready-to-test")' "$GITHUB_EVENT_PATH" &> /dev/null; then
+    # check if the PR has been approved
+    PR_NUM=$(jq -r '.pull_request.number' "${GITHUB_EVENT_PATH}")
+    REPO_FULL_NAME=$(jq -r '.repository.full_name' "${GITHUB_EVENT_PATH}")
+    REPO_NAME=$(basename "${REPO_FULL_NAME}")
+    REPO_OWNER=$(dirname "${REPO_FULL_NAME}")
+    # use graphql query to find out reviewDecision
+    PR_REVIEW_DECISION=$(curl -s -H "Authorization: bearer $GITHUB_TOKEN" -X POST -d '{"query": "query { repository(name: \"'${REPO_NAME}'\", owner: \"'${REPO_OWNER}'\") { pullRequest(number: '${PR_NUM}') { reviewDecision } } }"}' https://api.github.com/graphql |jq -r '.data.repository.pullRequest.reviewDecision')
+    echo "Review decision for PR #${PR_NUM} in repository ${REPO_OWNER}/${REPO_NAME} is ${PR_REVIEW_DECISION}"
+    if [[ "$PR_REVIEW_DECISION" != "APPROVED" ]]; then
+      FORK_REPO_URL=$(jq -r '.pull_request.head.repo.html_url' "$GITHUB_EVENT_PATH")
+      PR_BRANCH_LABEL=$(jq -r '.pull_request.head.label' "$GITHUB_EVENT_PATH")
+      PR_URL=$(jq -r '.pull_request.html_url' "$GITHUB_EVENT_PATH")
+      >&2 tee -a "$GITHUB_STEP_SUMMARY" <<EOF
+
+# Instructions for proceeding with the pull request:
+
+apache/pulsar pull requests should be first tested in your own fork since the apache/pulsar CI based on
+GitHub Actions has constrained resources and quota. GitHub Actions provides separate quota for
+pull requests that are executed in a forked repository.
+
+1. Go to ${FORK_REPO_URL} and ensure that your branch is up to date with https://github.com/apache/pulsar
+   Sync your fork if it's behind.
+2. Open a pull request to your own fork. You can use this link to create the pull request in
+   your own fork:
+   ${FORK_REPO_URL}/compare/master...${PR_BRANCH_LABEL}?expand=1
+3. Edit the description of the pull request ${PR_URL} and add the link to the PR that you opened to your own fork
+   so that the reviewer can verify that tests pass in your own fork.
+4. Ensure that tests pass in your own fork. Your own fork will be used to run the tests during the PR review
+   and any changes made during the review. You as a PR author are responsible for following up on test failures.
+   Please report any flaky tests as new issues at https://github.com/apache/pulsar/issues
+   after checking that the flaky test isn't already reported.
+5. When the PR is approved, it will be possible to restart the Pulsar CI workflow within apache/pulsar
+   repository by adding a comment "/pulsarbot rerun-failure-checks" to the PR.
+   An alternative for the PR approval is to add a ready-to-test label to the PR. This can be done
+   by Apache Pulsar committers.
+6. When tests pass on the apache/pulsar side, the PR can be merged by a Apache Pulsar Committer.
+
+If you have any trouble, please join the #contributor channel on Pulsar Slack to get real-time support.
+Instructions for joining Pulsar Slack: https://pulsar.apache.org/community#section-discussions

Review Comment:
   I suggest we guide contributors to the dev@ mailing list:
   
   ```suggestion
   If you have any trouble, please send an email to the [dev mailing list](mailto:dev@pulsar.apache.org) ([subscribe](mailto:dev-subscribe@pulsar.apache.org)) to get support.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org