You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by ot...@apache.org on 2018/04/18 14:59:38 UTC

[08/52] [abbrv] metron git commit: METRON-1468 Add support for apache/metron-bro-plugin-kafka to prepare-commit (JonZeolla) closes apache/metron#948

METRON-1468 Add support for apache/metron-bro-plugin-kafka to prepare-commit (JonZeolla) closes apache/metron#948


Project: http://git-wip-us.apache.org/repos/asf/metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/03a4aa38
Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/03a4aa38
Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/03a4aa38

Branch: refs/heads/feature/METRON-1211-extensions-parsers-gradual
Commit: 03a4aa3846773065d51086167a28fb4c37d7b2a9
Parents: 8bc7732
Author: JonZeolla <ze...@gmail.com>
Authored: Fri Mar 9 09:05:03 2018 -0500
Committer: JonZeolla <jo...@apache.org>
Committed: Fri Mar 9 09:05:03 2018 -0500

----------------------------------------------------------------------
 dev-utilities/committer-utils/README.md      | 75 ++++++++++++-----------
 dev-utilities/committer-utils/prepare-commit | 50 +++++++++++----
 2 files changed, 75 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/metron/blob/03a4aa38/dev-utilities/committer-utils/README.md
----------------------------------------------------------------------
diff --git a/dev-utilities/committer-utils/README.md b/dev-utilities/committer-utils/README.md
index 60e1d51..ac428cc 100644
--- a/dev-utilities/committer-utils/README.md
+++ b/dev-utilities/committer-utils/README.md
@@ -22,7 +22,7 @@ This project contains tools to assist Apache Metron project committers.
 
 ## Prepare Commit
 
-This script automates the process of merging a pull request into `apache/master`.  The script will prompt for the pull request number.  Most of the remaining information is automatically extracted from Github or the Apache JIRA.
+This script automates the process of merging a pull request into `apache/metron` or `apache/metron-bro-plugin-kafka`.  The script will prompt for the pull request number.  Most of the remaining information is automatically extracted from Github or the Apache JIRA.
 
 When prompted the `[value in brackets]` is used by default.  To accept the default, simply press `enter`.  If you would like to change the default, type it in and hit `enter` when done.
 
@@ -33,36 +33,39 @@ In the following example, I enter the pull request number when prompted.   Using
     The first time the script is run, you will be prompted for additional information including your Apache username, Apache email, and Github username.  These values are persisted in `~/.metron-prepare-commit`.  Subsequent executions of the script will retrieve these values, rather than prompting you again for them.
 
     ```
-    $ prepare-commit
-      your github username []: nickwallen
-      your apache userid []: nickallen
-      your apache email [nickallen@apache.org]:
+    $ ./prepare-commit
+      your github username []: jonzeolla
+      your apache userid []: jonzeolla
+      your apache email [jonzeolla@apache.org]:
     ```
 
-1. Enter the Github pull request number.
+1. Select a repository and enter a GitHub pull request number.
 
     ```
-      pull request: 897
-      local working directory [/Users/nallen/tmp/metron-pr897]:
+        [1] metron
+        [2] metron-bro-plugin-kafka
+      which repo? [1]: 1
+      pull request: 946
+      local working directory [/Users/jzeolla/tmp/metron-pr946]:
       origin repo [https://github.com/apache/metron]:
-
-    Cloning into '/Users/nallen/tmp/metron-pr897'...
-    remote: Counting objects: 36277, done.
-    remote: Compressing objects: 100% (108/108), done.
-    remote: Total 36277 (delta 38), reused 54 (delta 20), pack-reused 36138
-    Receiving objects: 100% (36277/36277), 57.85 MiB | 7.36 MiB/s, done.
-    Resolving deltas: 100% (13653/13653), done.
+    Cloning into '/Users/jzeolla/tmp/metron-pr946'...
+    remote: Counting objects: 37861, done.
+    remote: Compressing objects: 100% (71/71), done.
+    remote: Total 37861 (delta 27), reused 47 (delta 4), pack-reused 37757
+    Receiving objects: 100% (37861/37861), 58.18 MiB | 4.38 MiB/s, done.
+    Resolving deltas: 100% (14439/14439), done.
     From https://git-wip-us.apache.org/repos/asf/metron
      * branch              master     -> FETCH_HEAD
      * [new branch]        master     -> upstream/master
     Already on 'master'
     Your branch is up to date with 'origin/master'.
     Already up to date.
-    remote: Counting objects: 5, done.
-    remote: Total 5 (delta 3), reused 3 (delta 3), pack-reused 2
-    Unpacking objects: 100% (5/5), done.
+    remote: Counting objects: 82, done.
+    remote: Compressing objects: 100% (22/22), done.
+    remote: Total 82 (delta 28), reused 48 (delta 28), pack-reused 26
+    Unpacking objects: 100% (82/82), done.
     From https://github.com/apache/metron
-     * [new ref]           refs/pull/897/head -> pr-897
+     * [new ref]           refs/pull/946/head -> pr-946
     ```
 
 1. Enter contribution details.
@@ -70,29 +73,27 @@ In the following example, I enter the pull request number when prompted.   Using
     The contributor's username, email, along with information about the associated Apache JIRA is extracted from the commit history.
 
     ```
-      github contributor's username [MohanDV]:
-      github contributor's email [mohan.dv@gmail.com]:
-      issue identifier in jira [METRON-1395]:
-      issue description [Documentation missing for Produce a message to a Kafka topic Rest API endpoint]:
-      commit message [METRON-1395 Documentation missing for Produce a message to a Kafka topic Rest API endpoint (MohanDV via nickwallen) closes apache/metron#897]:
+    github contributor's username [wardbekker]:
+    github contributor's email [ward@wardbekker.com]:
+    issue identifier in jira [METRON-1465]:
+    issue description [X-pack support for Elasticsearch]:
+    commit message [METRON-1465 X-pack support for Elasticsearch (wardbekker via jonzeolla) closes apache/metron#946]:
     ```
 
 1. The contribution is then merged with master as a single commit.  The changes that have been made along with the commit message are displayed.
 
     ```
+    Updating b48ab93c..4fbc166d
+    Fast-forward
     Squash commit -- not updating HEAD
-    Automatic merge went well; stopped before committing as requested
-    [master 998f7915] METRON-1410 Some more upgrade fallout... Can&apos;t restart Metron Indexing. (ottobackwards via nickwallen) closes apache/metron#901
-     Author: ottobackwards <ot...@gmail.com>
-     3 files changed, 3 insertions(+), 3 deletions(-)
-
-
-     .../metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/enrichment_commands.py       | 2 +-
-     .../ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/indexing_commands.py  | 2 +-
-     .../ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/profiler_commands.py  | 2 +-
-     3 files changed, 3 insertions(+), 3 deletions(-)
-
-    998f7915 (HEAD -> master) METRON-1410 Cannot restart Metron Indexing. (ottobackwards via nickwallen) closes apache/metron#901
+    <snip>
+    [master f0190d57] METRON-1465 X-pack support for Elasticsearch (wardbekker via jonzeolla) closes apache/metron#946
+     Author: wardbekker <wa...@wardbekker.com>
+    <snip>
+     11 files changed, 48 insertions(+), 10 deletions(-)
+    
+    
+    f0190d57 (HEAD -> master) METRON-1465 X-pack support for Elasticsearch (wardbekker via jonzeolla) closes apache/metron#946
     ```
 
 1. Run the test suite.
@@ -109,6 +110,6 @@ In the following example, I enter the pull request number when prompted.   Using
 
     ```
     Review commit carefully then run...
-        cd /Users/nallen/tmp/metron-pr897
+        cd /Users/jzeolla/tmp/metron-pr946
         git push upstream master
     ```

http://git-wip-us.apache.org/repos/asf/metron/blob/03a4aa38/dev-utilities/committer-utils/prepare-commit
----------------------------------------------------------------------
diff --git a/dev-utilities/committer-utils/prepare-commit b/dev-utilities/committer-utils/prepare-commit
index 90852c0..67116cb 100755
--- a/dev-utilities/committer-utils/prepare-commit
+++ b/dev-utilities/committer-utils/prepare-commit
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
 #
 #  Licensed to the Apache Software Foundation (ASF) under one or more
 #  contributor license agreements.  See the NOTICE file distributed with
@@ -16,7 +17,8 @@
 #
 
 # not likely to change
-UPSTREAM=https://git-wip-us.apache.org/repos/asf/metron.git
+METRON_UPSTREAM="https://git-wip-us.apache.org/repos/asf/metron.git"
+BRO_PLUGIN_UPSTREAM="https://git-wip-us.apache.org/repos/asf/metron-bro-plugin-kafka.git"
 BASE_BRANCH=master
 CONFIG_FILE=~/.metron-prepare-commit
 GITHUB_REMOTE="origin"
@@ -27,6 +29,24 @@ if [ -f $CONFIG_FILE ]; then
   echo "  ...using settings from $CONFIG_FILE"
 fi
 
+# which repo?  metron or metron-bro-plugin-kafka
+echo "    [1] metron"
+echo "    [2] metron-bro-plugin-kafka"
+read -p "  which repo? [1]: " INPUT
+case "${INPUT}" in
+  [Bb][Rr][Oo]|[Mm][Ee][Tt][Rr][Oo][Nn]-[Bb][Rr][Oo]-[Pp][Ll][Uu][Gg][Ii][Nn]-[Kk][Aa][Ff][Kk][Aa]|*metron-bro-plugin-kafka\.git|2)
+    INPUT="${BRO_PLUGIN_UPSTREAM}" ;;
+  [Mm][Ee][Tt][Rr][Oo][Nn]|*metron\.git|1|'')
+    INPUT="${METRON_UPSTREAM}" ;;
+  *)
+    echo "Invalid repo, provided \"${INPUT}\".  Please choose between metron or metron-bro-plugin-kafka"
+    exit 1
+    ;;
+esac
+[ -n "$INPUT" ] && UPSTREAM=$INPUT
+
+CHOSEN_REPO=$(basename ${UPSTREAM%%.git})
+
 # github account of committer (you)
 if [ -z "$GITHUB_NAME" ]; then
   read -p "  your github username [$GITHUB_NAME]: " INPUT
@@ -63,14 +83,14 @@ if [ -z "$PR" ]; then
 fi
 
 # ensure that the pull request exists
-PR_EXISTS=`curl -sI https://api.github.com/repos/apache/metron/pulls/$PR | grep Status: | sed 's/[^0-9]//g'`
+PR_EXISTS=`curl -sI https://api.github.com/repos/apache/${CHOSEN_REPO}/pulls/$PR | grep Status: | sed 's/[^0-9]//g'`
 if [ "$PR_EXISTS" != "200" ]; then
   echo "Error: pull request #$PR does not exist"
   exit 1
 fi
 
 # working directory
-WORK=~/tmp/metron-pr$PR
+WORK=~/tmp/${CHOSEN_REPO}-pr$PR
 read -p "  local working directory [$WORK]: " INPUT
 [ -n "$INPUT" ] && WORK=$INPUT
 
@@ -90,7 +110,7 @@ fi
 if [ ! -d "$WORK" ]; then
 
   # origin repository
-  ORIGIN="https://github.com/apache/metron"
+  ORIGIN="https://github.com/apache/${CHOSEN_REPO}"
   read -p "  origin repo [$ORIGIN]: " INPUT
   [ -n "$INPUT" ] && ORIGIN=$INPUT
 
@@ -127,7 +147,7 @@ git fetch $GITHUB_REMOTE $PR_BRANCH_REF
 echo ""
 
 # use github api to retrieve the contributor's login
-USER=`curl -s https://api.github.com/repos/apache/metron/pulls/$PR | grep login | head -1 | awk -F":" '{print $2}' | sed 's/[^a-zA-Z.@_-]//g'`
+USER=`curl -s https://api.github.com/repos/apache/${CHOSEN_REPO}/pulls/$PR | grep login | head -1 | awk -F":" '{print $2}' | sed 's/[^a-zA-Z.@_-]//g'`
 read -p "  github contributor's username [$USER]: " INPUT
 [ -n "$INPUT" ] && USER=$INPUT
 
@@ -149,7 +169,7 @@ if [ -z "$EMAIL" ] || [ "$EMAIL" = "null" ]; then
 fi
 
 # can we extract the JIRA from the PR title?
-JIRA=`curl -s https://api.github.com/repos/apache/metron/pulls/$PR | grep title | head -1 | egrep -o -i 'METRON-[0-9]+' | awk '{print toupper($0)}'`
+JIRA=`curl -s https://api.github.com/repos/apache/${CHOSEN_REPO}/pulls/$PR | grep title | head -1 | egrep -o -i 'METRON-[0-9]+' | awk '{print toupper($0)}'`
 read -p "  issue identifier in jira [$JIRA]: " INPUT
 [ -n "$INPUT" ] && JIRA=$INPUT
 
@@ -173,9 +193,9 @@ fi
 # commit message
 AUTHOR="$USER <$EMAIL>"
 if [ "$USER" == "$GITHUB_NAME" ]; then
-    MSG="$JIRA $DESC ($USER) closes apache/metron#$PR"
+  MSG="$JIRA $DESC ($USER) closes apache/${CHOSEN_REPO}#$PR"
 else
-    MSG="$JIRA $DESC ($USER via $GITHUB_NAME) closes apache/metron#$PR"
+  MSG="$JIRA $DESC ($USER via $GITHUB_NAME) closes apache/${CHOSEN_REPO}#$PR"
 fi
 read -p "  commit message [$MSG]: " INPUT
 [ -n "$INPUT" ] && MSG=$INPUT
@@ -202,11 +222,15 @@ echo ""
 read -p "  run test suite? [yN] " -n 1 -r
 echo
 if [[ $REPLY =~ ^[Yy]$ ]]; then
-  mvn -q -T 2C -DskipTests clean install &&
-    mvn -q -T 2C surefire:test@unit-tests &&
-    mvn -q surefire:test@integration-tests &&
-    mvn -q test --projects metron-interface/metron-config &&
-    dev-utilities/build-utils/verify_licenses.sh
+  if [ "${UPSTREAM}" == "${METRON_UPSTREAM}" ]; then
+      mvn -q -T 2C -DskipTests clean install &&
+          mvn -q -T 2C surefire:test@unit-tests &&
+          mvn -q surefire:test@integration-tests &&
+          mvn -q test --projects metron-interface/metron-config &&
+	  dev-utilities/build-utils/verify_licenses.sh
+  elif [ "${UPSTREAM}" == "${BRO_PLUGIN_UPSTREAM}" ]; then
+    echo "We don't currently support running metron-bro-plugin-kafka tests in this script"
+  fi
 fi
 
 echo ""