You are viewing a plain text version of this content. The canonical link for it is here.
Posted to submarine-dev@hadoop.apache.org by zh...@apache.org on 2019/10/12 08:51:14 UTC

[hadoop-submarine] branch master updated: SUBMARINE-229. Submarine-cicd failed due to the encoding error of github PR body

This is an automated email from the ASF dual-hosted git repository.

zhouquan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 6506ef8  SUBMARINE-229. Submarine-cicd failed due to the encoding error of github PR body
6506ef8 is described below

commit 6506ef8832e628b70755bf6b898ae26e0256304c
Author: Zac Zhou <zh...@apache.org>
AuthorDate: Thu Oct 10 21:13:01 2019 +0800

    SUBMARINE-229. Submarine-cicd failed due to the encoding error of github PR body
    
    ### What is this PR for?
    Sometimes, submarine-cicd failed to merge pr.
    The root cause is that the encode of PR body is UTF-8, which would cause python str encoding error.
    
    ### What type of PR is it?
    Bug Fix
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/SUBMARINE-229
    
    ### How should this be tested?
    https://travis-ci.org/yuanzac/hadoop-submarine/builds/596113339
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? Yes
    
    Author: Zac Zhou <zh...@apache.org>
    
    Closes #40 from yuanzac/topic/SUBMARINE-229 and squashes the following commits:
    
    f7e29af [Zac Zhou] SUBMARINE-229. Submarine-cicd failed due to the encoding error of github PR body
---
 dev-support/cicd/README.md             | 18 ++++++++++++------
 dev-support/cicd/merge_submarine_pr.py |  5 ++++-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/dev-support/cicd/README.md b/dev-support/cicd/README.md
index 81d3a51..24880c6 100644
--- a/dev-support/cicd/README.md
+++ b/dev-support/cicd/README.md
@@ -21,25 +21,31 @@ To use them more easily, we provide a Docker image to help committer to handle t
 ## Docker mode
 
 ```
-cd <path-to-submarine-home>/dev-support/cicd
-docker build -t submarine-cicd .
-docker run -it --rm submarine-cicd
+./build_and_start_cicd_image.sh
 ```
 
 Or
 
 ```
-./build_and_start_cicd_image.sh
+cd <path-to-submarine-home>/dev-support/cicd
+docker build -t submarine-cicd .
+docker run -it --rm submarine-cicd
 ```
 
+Jira username, password, apache id and apache username are required in the docker container. You can
+add them to the docker startup command.
+
 And you'll see output like below and then you can decide what to accomplish.
 ```
-$ docker run -it --rm submarine-cicd
+$ docker run -it -e JIRA_USERNAME='jira username' -e JIRA_PASSWORD='jira password' \
+ -e APACHE_ID='apache id' -e APACHE_NAME="apache name" --rm submarine-cicd 
 Menu:
 	1. Merge PR
 Enter Menu ID:1
 ==== Merge PR Begin ====
-Enter Your Apache JIRA User name:
+Got JIRA name: username
+
+Enter Your Apache committer ID:
 ```
 
 ## Manual mode
diff --git a/dev-support/cicd/merge_submarine_pr.py b/dev-support/cicd/merge_submarine_pr.py
index 486dda8..823e193 100755
--- a/dev-support/cicd/merge_submarine_pr.py
+++ b/dev-support/cicd/merge_submarine_pr.py
@@ -134,7 +134,10 @@ def merge_pr(pr_num, target_ref):
     if body is not None:
         # We remove @ symbols from the body to avoid triggering e-mails
         # to people every time someone creates a public fork of Submarine.
-        merge_message_flags += ["-m", body.replace("@", "")]
+        if isinstance(body, unicode):
+            merge_message_flags += ["-m", body.encode("utf-8").replace("@", "")]
+        else:
+            merge_message_flags += ["-m", body.replace("@", "")]
 
     authors = "\n".join(["Author: %s" % a for a in distinct_authors])