From 97bda5b0d436c5370e67a21a30d85b3970d98891 Mon Sep 17 00:00:00 2001 From: Lkop Date: Mon, 6 Jul 2020 10:17:19 -0700 Subject: [PATCH 01/11] CI script (EAT) --- CI/PR_CI.sh | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100755 CI/PR_CI.sh diff --git a/CI/PR_CI.sh b/CI/PR_CI.sh new file mode 100755 index 000000000..4c8b06a2f --- /dev/null +++ b/CI/PR_CI.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +set -e + +#Parameters +WILDFLY=$WILDFLY +EAT=$EAT +EAT_PR=$EAT_PR + +if [ "$1" == "-v" ]; then + echo "Wildfly: "$WILDFLY + echo "EAT: "$EAT + echo "EAT_PR: "$EAT_PR + exit 0 +fi + +if [ -z "$WILDFLY" ]; then + echo "Define Wildlfy server (github)" + echo "" + echo "Example" + echo "export WILDFLY=..." + exit 1; +fi + +if [ -z "$EAT" ]; then + echo "Define EAT (github)" + echo "" + echo "Example" + echo "export EAT=..." + exit 1; +fi + +if [ -z "$EAT_PR" ]; then + echo "Define Pull Request number" + echo "" + echo "Example" + echo "export EAT_PR=1" + exit 1; +fi + +#Check PR status +prs=$(curl -s -n https://api.github.com/repos/EAT-JBCOMMUNITY/EAT/pulls?state=open); +aa=$(echo $prs | grep -Po '"number":.*?[^\\],'); +arr+=( $(echo $aa | grep -Po '[0-9]*')) ; + +pr_found=false + +for i in "${arr[@]}" +do + if [ $i == $EAT_PR ]; then + pr_found=true; + break + fi +done + +if [ $pr_found == false ]; then + echo "Pull Request not found." +fi + +#Run CI +mkdir server +cd server + +git clone $WILDFLY +cd wildfly + +mkdir eat +cd eat + +git clone $EAT +cd EAT + +#Merge PR +git fetch origin +refs/pull/$EAT_PR/merge; +git checkout FETCH_HEAD; + +echo "Merging Done!" +echo "" +# echo "Starting Build" From ffae7e67bc09076fb91bf1f7cf119f93a69a4b1a Mon Sep 17 00:00:00 2001 From: Lkop Date: Tue, 7 Jul 2020 13:33:08 -0700 Subject: [PATCH 02/11] Corrections... --- CI/PR_CI.sh | 57 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/CI/PR_CI.sh b/CI/PR_CI.sh index 4c8b06a2f..ada07b8a9 100755 --- a/CI/PR_CI.sh +++ b/CI/PR_CI.sh @@ -3,22 +3,35 @@ set -e #Parameters -WILDFLY=$WILDFLY +SERVER=$SERVER EAT=$EAT EAT_PR=$EAT_PR if [ "$1" == "-v" ]; then - echo "Wildfly: "$WILDFLY - echo "EAT: "$EAT - echo "EAT_PR: "$EAT_PR + echo "SERVER: "$SERVER + echo "EAT: "$EAT + echo "EAT_PR: "$EAT_PR exit 0 fi -if [ -z "$WILDFLY" ]; then - echo "Define Wildlfy server (github)" +if [ "$1" == "-wildfly" ]; then + SERVER="https://github.com/wildfly/wildfly" + EAT="https://github.com/EAT-JBCOMMUNITY/EAT" + + echo "SERVER: "$SERVER + echo "EAT: "$EAT + echo "EAT_PR: "$EAT_PR + echo "" + + echo "Building: Latest Wildfly + EAT" + echo "" +fi + +if [ -z "$SERVER" ]; then + echo "Define server (github)" echo "" echo "Example" - echo "export WILDFLY=..." + echo "export SERVER=..." exit 1; fi @@ -30,15 +43,17 @@ if [ -z "$EAT" ]; then exit 1; fi -if [ -z "$EAT_PR" ]; then - echo "Define Pull Request number" - echo "" - echo "Example" - echo "export EAT_PR=1" - exit 1; +if [ "$1" == "-wildfly" ]; then + if [ -z "$EAT_PR" ]; then + echo "Define Pull Request number" + echo "" + echo "Example" + echo "export EAT_PR=1" + exit 1; + fi fi -#Check PR status +#Check EAT PR status prs=$(curl -s -n https://api.github.com/repos/EAT-JBCOMMUNITY/EAT/pulls?state=open); aa=$(echo $prs | grep -Po '"number":.*?[^\\],'); arr+=( $(echo $aa | grep -Po '[0-9]*')) ; @@ -55,14 +70,15 @@ done if [ $pr_found == false ]; then echo "Pull Request not found." + exit 1; fi #Run CI mkdir server cd server -git clone $WILDFLY -cd wildfly +git clone $SERVER +cd * mkdir eat cd eat @@ -76,4 +92,11 @@ git checkout FETCH_HEAD; echo "Merging Done!" echo "" -# echo "Starting Build" + +#Build Server +echo "Building..." +cd ../../ +mvn clean install -DskipTests + + + From dd1e5bf19eb35fb018093670534baddb7e1e1dbb Mon Sep 17 00:00:00 2001 From: Lkop Date: Tue, 7 Jul 2020 16:22:30 -0700 Subject: [PATCH 03/11] Adding building state --- CI/PR_CI.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CI/PR_CI.sh b/CI/PR_CI.sh index ada07b8a9..6873dd12a 100755 --- a/CI/PR_CI.sh +++ b/CI/PR_CI.sh @@ -98,5 +98,14 @@ echo "Building..." cd ../../ mvn clean install -DskipTests +server_pom=$([0-9]*\.[0-9]*\.[0-9]*\.[a-zA-Z0-9-]*<\/version>'); +version=$(echo $version | grep -Po '[0-9]*\.[0-9]*\.[0-9]*\.[a-zA-Z0-9-]*'); +export JBOSS_VERSION=$version +export JBOSS_FOLDER=$PWD/dist/target/wildfly-$JBOSS_VERSION/ +cd eat +cd EAT + +mvn clean install -Dwildfly -Dstandalone From c96ee665ae40875ca0651d5c70f2c6153d9eaf88 Mon Sep 17 00:00:00 2001 From: Lkop Date: Mon, 13 Jul 2020 10:12:23 -0700 Subject: [PATCH 04/11] Adding server's PR option --- CI/PR_CI.sh | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/CI/PR_CI.sh b/CI/PR_CI.sh index 6873dd12a..6f07e3a09 100755 --- a/CI/PR_CI.sh +++ b/CI/PR_CI.sh @@ -6,6 +6,9 @@ set -e SERVER=$SERVER EAT=$EAT EAT_PR=$EAT_PR +SERVER_PR=$SERVER_PR + +server_pr_set=false if [ "$1" == "-v" ]; then echo "SERVER: "$SERVER @@ -15,6 +18,14 @@ if [ "$1" == "-v" ]; then fi if [ "$1" == "-wildfly" ]; then + if [ -z "$EAT_PR" ]; then + echo "Define Pull Request number" + echo "" + echo "Example" + echo "export EAT_PR=1" + exit 1; + fi + SERVER="https://github.com/wildfly/wildfly" EAT="https://github.com/EAT-JBCOMMUNITY/EAT" @@ -43,14 +54,8 @@ if [ -z "$EAT" ]; then exit 1; fi -if [ "$1" == "-wildfly" ]; then - if [ -z "$EAT_PR" ]; then - echo "Define Pull Request number" - echo "" - echo "Example" - echo "export EAT_PR=1" - exit 1; - fi +if [ -z "$SERVER_PR" ]; then + server_pr_set=true fi #Check EAT PR status @@ -58,17 +63,17 @@ prs=$(curl -s -n https://api.github.com/repos/EAT-JBCOMMUNITY/EAT/pulls?state=op aa=$(echo $prs | grep -Po '"number":.*?[^\\],'); arr+=( $(echo $aa | grep -Po '[0-9]*')) ; -pr_found=false +eat_pr_found=false for i in "${arr[@]}" do if [ $i == $EAT_PR ]; then - pr_found=true; + eat_pr_found=true; break fi done -if [ $pr_found == false ]; then +if [ $eat_pr_found == false ]; then echo "Pull Request not found." exit 1; fi @@ -80,6 +85,12 @@ cd server git clone $SERVER cd * +#Merge server's PR if found +if [ $server_pr_set == true ]; then + git fetch origin +refs/pull/$SERVER_PR/merge; + git checkout FETCH_HEAD; +fi + mkdir eat cd eat From 3058ed9ece822374fd62d68718c5335683ff9665 Mon Sep 17 00:00:00 2001 From: Lkop Date: Tue, 14 Jul 2020 09:17:49 -0700 Subject: [PATCH 05/11] Check Server's open PRs from API --- CI/PR_CI.sh | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/CI/PR_CI.sh b/CI/PR_CI.sh index 6f07e3a09..26f5a3264 100755 --- a/CI/PR_CI.sh +++ b/CI/PR_CI.sh @@ -59,13 +59,13 @@ if [ -z "$SERVER_PR" ]; then fi #Check EAT PR status -prs=$(curl -s -n https://api.github.com/repos/EAT-JBCOMMUNITY/EAT/pulls?state=open); -aa=$(echo $prs | grep -Po '"number":.*?[^\\],'); -arr+=( $(echo $aa | grep -Po '[0-9]*')) ; +eat_prs_get=$(curl -s -n https://api.github.com/repos/EAT-JBCOMMUNITY/EAT/pulls?state=open); +eat_prs_number=$(echo $eat_prs_get | grep -Po '"number":.*?[^\\],'); +eat_arr+=( $(echo $eat_prs_number | grep -Po '[0-9]*')) ; eat_pr_found=false -for i in "${arr[@]}" +for i in "${eat_arr[@]}" do if [ $i == $EAT_PR ]; then eat_pr_found=true; @@ -87,8 +87,26 @@ cd * #Merge server's PR if found if [ $server_pr_set == true ]; then - git fetch origin +refs/pull/$SERVER_PR/merge; - git checkout FETCH_HEAD; + + #Check Server PR status + server_prs_get=$(curl -s -n https://api.github.com/repos/wildfly/wildfly/pulls?state=open); + server_prs_number=$(echo $server_prs_get | grep -Po '"number":.*?[^\\],'); + server_arr+=( $(echo $server_prs_number | grep -Po '[0-9]*')) ; + + server_pr_found=false + + for i in "${server_arr[@]}" + do + if [ $i == $SERVER_PR ]; then + server_pr_found=true; + break + fi + done + + if [ $server_pr_found == true ]; then + git fetch origin +refs/pull/$SERVER_PR/merge; + git checkout FETCH_HEAD; + fi fi mkdir eat From e423673a9bf51e54176c497b4a543b05e699207a Mon Sep 17 00:00:00 2001 From: Lkop Date: Thu, 16 Jul 2020 08:08:14 -0700 Subject: [PATCH 06/11] Build all open PRs --- CI/PR_CI.sh | 50 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/CI/PR_CI.sh b/CI/PR_CI.sh index 26f5a3264..a70be7514 100755 --- a/CI/PR_CI.sh +++ b/CI/PR_CI.sh @@ -65,17 +65,19 @@ eat_arr+=( $(echo $eat_prs_number | grep -Po '[0-9]*')) ; eat_pr_found=false -for i in "${eat_arr[@]}" -do - if [ $i == $EAT_PR ]; then - eat_pr_found=true; - break - fi -done +if [ $EAT_PR != "ALL" ] && [ $EAT_PR != "all" ]; then + for i in "${eat_arr[@]}" + do + if [ $i == $EAT_PR ]; then + eat_pr_found=true; + break + fi + done -if [ $eat_pr_found == false ]; then - echo "Pull Request not found." - exit 1; + if [ $eat_pr_found == false ]; then + echo "Pull Request not found." + exit 1; + fi fi #Run CI @@ -116,11 +118,13 @@ git clone $EAT cd EAT #Merge PR -git fetch origin +refs/pull/$EAT_PR/merge; -git checkout FETCH_HEAD; - -echo "Merging Done!" -echo "" +if [ $EAT_PR != "ALL" ] && [ $EAT_PR != "all" ]; then + git fetch origin +refs/pull/$EAT_PR/merge; + git checkout FETCH_HEAD; + + echo "Merging Done!" + echo "" +fi #Build Server echo "Building..." @@ -137,4 +141,18 @@ export JBOSS_FOLDER=$PWD/dist/target/wildfly-$JBOSS_VERSION/ cd eat cd EAT -mvn clean install -Dwildfly -Dstandalone +if [ $EAT_PR == "ALL" ] || [ $EAT_PR == "all" ]; then + + for i in "${eat_arr[@]}" + do + git fetch origin +refs/pull/$i/merge; + git checkout FETCH_HEAD; + + echo "Merging Done!" + echo "" + + mvn clean install -Dwildfly -Dstandalone + done +else + mvn clean install -Dwildfly -Dstandalone +fi From f87ae491c34ab7bdd06ce09e73d56f96113fe842 Mon Sep 17 00:00:00 2001 From: Lkop Date: Thu, 16 Jul 2020 08:30:16 -0700 Subject: [PATCH 07/11] Save/Read checked PRs in/from a file --- CI/PR_CI.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/CI/PR_CI.sh b/CI/PR_CI.sh index a70be7514..54c7a471f 100755 --- a/CI/PR_CI.sh +++ b/CI/PR_CI.sh @@ -142,9 +142,25 @@ cd eat cd EAT if [ $EAT_PR == "ALL" ] || [ $EAT_PR == "all" ]; then - + #Read file + mapfile -t checked_arr < checked_PRs.txt + for i in "${eat_arr[@]}" do + checked==false + + for j in "${checked_arr[@]}" + do + if [ $i == $j ]; then + checked==true + break + fi + done + + if [ $checked==true ]; then + continue + fi + git fetch origin +refs/pull/$i/merge; git checkout FETCH_HEAD; @@ -152,6 +168,8 @@ if [ $EAT_PR == "ALL" ] || [ $EAT_PR == "all" ]; then echo "" mvn clean install -Dwildfly -Dstandalone + + $i >> checked_PRs.txt done else mvn clean install -Dwildfly -Dstandalone From 1da740d4775db83102c0ed8f2fb398a0735d3e90 Mon Sep 17 00:00:00 2001 From: Lkop Date: Tue, 28 Jul 2020 15:05:51 -0700 Subject: [PATCH 08/11] Fix Server's PR --- CI/PR_CI.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/CI/PR_CI.sh b/CI/PR_CI.sh index 54c7a471f..a4b0827d8 100755 --- a/CI/PR_CI.sh +++ b/CI/PR_CI.sh @@ -12,8 +12,9 @@ server_pr_set=false if [ "$1" == "-v" ]; then echo "SERVER: "$SERVER + echo "SERVER_PR: "$SERVER_PR echo "EAT: "$EAT - echo "EAT_PR: "$EAT_PR + echo "EAT_PR: "$EAT_PR exit 0 fi @@ -30,6 +31,7 @@ if [ "$1" == "-wildfly" ]; then EAT="https://github.com/EAT-JBCOMMUNITY/EAT" echo "SERVER: "$SERVER + echo "SERVER_PR: "$SERVER_PR echo "EAT: "$EAT echo "EAT_PR: "$EAT_PR echo "" @@ -54,7 +56,7 @@ if [ -z "$EAT" ]; then exit 1; fi -if [ -z "$SERVER_PR" ]; then +if ! [ -z "$SERVER_PR" ] && [ "$SERVER_PR" -gt 0 ]; then server_pr_set=true fi @@ -108,6 +110,9 @@ if [ $server_pr_set == true ]; then if [ $server_pr_found == true ]; then git fetch origin +refs/pull/$SERVER_PR/merge; git checkout FETCH_HEAD; + + echo "Server: Merging Done" + echo "" fi fi @@ -122,7 +127,7 @@ if [ $EAT_PR != "ALL" ] && [ $EAT_PR != "all" ]; then git fetch origin +refs/pull/$EAT_PR/merge; git checkout FETCH_HEAD; - echo "Merging Done!" + echo "EAT: Merging Done" echo "" fi @@ -164,7 +169,7 @@ if [ $EAT_PR == "ALL" ] || [ $EAT_PR == "all" ]; then git fetch origin +refs/pull/$i/merge; git checkout FETCH_HEAD; - echo "Merging Done!" + echo "EAT: Merging Done!" echo "" mvn clean install -Dwildfly -Dstandalone From fdb3ecefacacb7d238fb532f15542aacb9c9c5dd Mon Sep 17 00:00:00 2001 From: Lkop Date: Wed, 29 Jul 2020 04:11:55 -0700 Subject: [PATCH 09/11] Read paths from files --- CI/PR_CI.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CI/PR_CI.sh b/CI/PR_CI.sh index a4b0827d8..e3f98cb8c 100755 --- a/CI/PR_CI.sh +++ b/CI/PR_CI.sh @@ -10,6 +10,20 @@ SERVER_PR=$SERVER_PR server_pr_set=false +eat_file="eat_path.txt" +server_file="server_path.txt" + +if ! [ -r $eat_file ]; then + >> $eat_file +fi + +if ! [ -r $server_file ]; then + >> $server_file +fi + +eat_path=$(sed '1q;d' $eat_file) +server_path=$(sed '1q;d' $server_file) + if [ "$1" == "-v" ]; then echo "SERVER: "$SERVER echo "SERVER_PR: "$SERVER_PR @@ -89,6 +103,8 @@ cd server git clone $SERVER cd * + + #Merge server's PR if found if [ $server_pr_set == true ]; then From 0af3382853d257db431e29ea951b518854a2f9d8 Mon Sep 17 00:00:00 2001 From: Lkop Date: Thu, 30 Jul 2020 04:30:02 -0700 Subject: [PATCH 10/11] Retrieve path from files if exists --- CI/PR_CI.sh | 55 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/CI/PR_CI.sh b/CI/PR_CI.sh index e3f98cb8c..d01e914f8 100755 --- a/CI/PR_CI.sh +++ b/CI/PR_CI.sh @@ -2,6 +2,13 @@ set -e +printVariables() { + echo "SERVER: "$SERVER + echo "SERVER_PR: "$SERVER_PR + echo "EAT: "$EAT + echo "EAT_PR: "$EAT_PR +} + #Parameters SERVER=$SERVER EAT=$EAT @@ -13,22 +20,21 @@ server_pr_set=false eat_file="eat_path.txt" server_file="server_path.txt" -if ! [ -r $eat_file ]; then - >> $eat_file -fi - if ! [ -r $server_file ]; then >> $server_file fi +server_path=$(sed '1q;d' $server_file) +if ! [ -r $eat_file ]; then + >> $eat_file +fi eat_path=$(sed '1q;d' $eat_file) -server_path=$(sed '1q;d' $server_file) + +eat_file=$(realpath $eat_file) +server_file=$(realpath $server_file) if [ "$1" == "-v" ]; then - echo "SERVER: "$SERVER - echo "SERVER_PR: "$SERVER_PR - echo "EAT: "$EAT - echo "EAT_PR: "$EAT_PR + printVariables exit 0 fi @@ -97,13 +103,17 @@ if [ $EAT_PR != "ALL" ] && [ $EAT_PR != "all" ]; then fi #Run CI -mkdir server -cd server - -git clone $SERVER -cd * - +if [ -z "$server_path" ]; then + mkdir server + cd server + git clone $SERVER + cd * + echo "$PWD" > $server_file +else + cd $server_path + echo $PWD +fi #Merge server's PR if found if [ $server_pr_set == true ]; then @@ -132,11 +142,18 @@ if [ $server_pr_set == true ]; then fi fi -mkdir eat -cd eat +if [ -z "$eat_path" ]; then + mkdir eat + cd eat -git clone $EAT -cd EAT + git clone $EAT + cd EAT + echo "$PWD" > $eat_file + +else + cd $eat_path + echo $PWD +fi #Merge PR if [ $EAT_PR != "ALL" ] && [ $EAT_PR != "all" ]; then From ce5821499baeb915c34dc3124f566dccfdaf3f22 Mon Sep 17 00:00:00 2001 From: Lkop Date: Thu, 30 Jul 2020 13:30:05 -0700 Subject: [PATCH 11/11] Adding test category, rebuild option, auto/manual JBOSS vars for Wildfly --- CI/PR_CI.sh | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/CI/PR_CI.sh b/CI/PR_CI.sh index d01e914f8..ddb6a638a 100755 --- a/CI/PR_CI.sh +++ b/CI/PR_CI.sh @@ -15,8 +15,16 @@ EAT=$EAT EAT_PR=$EAT_PR SERVER_PR=$SERVER_PR +if [ -z "$test_category" ]; then + test_category=wildfly +fi + server_pr_set=false +if [ -z "$server_build" ]; then + server_build=true +fi + eat_file="eat_path.txt" server_file="server_path.txt" @@ -39,13 +47,6 @@ if [ "$1" == "-v" ]; then fi if [ "$1" == "-wildfly" ]; then - if [ -z "$EAT_PR" ]; then - echo "Define Pull Request number" - echo "" - echo "Example" - echo "export EAT_PR=1" - exit 1; - fi SERVER="https://github.com/wildfly/wildfly" EAT="https://github.com/EAT-JBCOMMUNITY/EAT" @@ -98,7 +99,6 @@ if [ $EAT_PR != "ALL" ] && [ $EAT_PR != "all" ]; then if [ $eat_pr_found == false ]; then echo "Pull Request not found." - exit 1; fi fi @@ -156,7 +156,7 @@ else fi #Merge PR -if [ $EAT_PR != "ALL" ] && [ $EAT_PR != "all" ]; then +if [ $EAT_PR != "ALL" ] && [ $EAT_PR != "all" ] && [ $eat_pr_found != false ]; then git fetch origin +refs/pull/$EAT_PR/merge; git checkout FETCH_HEAD; @@ -166,36 +166,43 @@ fi #Build Server echo "Building..." -cd ../../ -mvn clean install -DskipTests +cd $server_path + +if [ $server_build == true ]; then + mvn clean install -DskipTests +fi server_pom=$([0-9]*\.[0-9]*\.[0-9]*\.[a-zA-Z0-9-]*<\/version>'); version=$(echo $version | grep -Po '[0-9]*\.[0-9]*\.[0-9]*\.[a-zA-Z0-9-]*'); -export JBOSS_VERSION=$version -export JBOSS_FOLDER=$PWD/dist/target/wildfly-$JBOSS_VERSION/ +if [ -z "$JBOSS_VERSION" ]; then + export JBOSS_VERSION=$version +fi +if [ -z "$JBOSS_FOLDER" ]; then + export JBOSS_FOLDER=$PWD/dist/target/wildfly-$JBOSS_VERSION/ +fi -cd eat -cd EAT +cd $eat_path if [ $EAT_PR == "ALL" ] || [ $EAT_PR == "all" ]; then + >> checked_PRs.txt #Read file mapfile -t checked_arr < checked_PRs.txt for i in "${eat_arr[@]}" do - checked==false + checked=false for j in "${checked_arr[@]}" do if [ $i == $j ]; then - checked==true + checked=true break fi done - if [ $checked==true ]; then + if [ $checked == true ]; then continue fi @@ -205,10 +212,10 @@ if [ $EAT_PR == "ALL" ] || [ $EAT_PR == "all" ]; then echo "EAT: Merging Done!" echo "" - mvn clean install -Dwildfly -Dstandalone + mvn clean install -D$test_category -Dstandalone $i >> checked_PRs.txt done else - mvn clean install -Dwildfly -Dstandalone + mvn clean install -D$test_category -Dstandalone fi