From fa0c00d3131fe50d72122f8a6cf822eedf70d9c8 Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Mon, 20 Jan 2025 16:21:45 +0530 Subject: [PATCH 01/14] KUBESAW-174: Print error output for repos where verification failed Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index e54506d0..d476900c 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -5,7 +5,10 @@ GH_BASE_URL_KS=https://github.com/kubesaw/ GH_BASE_URL_CRT=https://github.com/codeready-toolchain/ declare -a REPOS=("${GH_BASE_URL_KS}ksctl" "${GH_BASE_URL_CRT}host-operator" "${GH_BASE_URL_CRT}member-operator" "${GH_BASE_URL_CRT}registration-service" "${GH_BASE_URL_CRT}toolchain-e2e") C_PATH=${PWD} -ERRORLIST=() +ERRORREPOLIST=() +ERRORFILELIST=() +GOLINTREGEX="[\s\w.\/]*:[0-9]*:[0-9]*:[\s\w]*[:]*[\s\w\">.-]*[\w\s)(*.]*" +ERRORREGEX="Error[:]*" echo Initiating verify-replace on dependent repos for repo in "${REPOS[@]}" @@ -16,27 +19,45 @@ do echo echo ========================================================================================= repo_path=${BASE_REPO_PATH}/$(basename ${repo}) + ERRFILE=$(mktemp ${TMP_DIR}$(basename ${repo}).XXX) echo "Cloning repo in /tmp" git clone --depth=1 ${repo} ${repo_path} echo "Repo cloned successfully" cd ${repo_path} if ! make pre-verify; then - ERRORLIST+="($(basename ${repo}))" + ERRORREPOLIST+="($(basename ${repo}))" continue fi echo "Initiating 'go mod replace' of current toolchain common version in dependent repos" go mod edit -replace github.com/codeready-toolchain/toolchain-common=${C_PATH} - make verify-dependencies || ERRORLIST+="($(basename ${repo}))" + make verify-dependencies &> ${ERRFILE} + rc=$? + if [ ${rc} -ne 0 ]; then + ERRORREPOLIST+="($(basename ${repo}))" + ERRORFILELIST+="${ERRFILE} " + fi echo echo ========================================================================================= echo done -if [ ${#ERRORLIST[@]} -ne 0 ]; then +echo "Summary" +if [ ${#ERRORREPOLIST[@]} -ne 0 ]; then echo "Below are the repos with error: " - for e in ${ERRORLIST[*]} + for e in ${ERRORREPOLIST[*]} do echo "${e}" done + for c in ${ERRORFILELIST[*]} + do + echo + echo ========================================================================================= + echo + echo "${c} has the following errors " + echo + echo ========================================================================================= + echo + cat "${c}" | grep "${GOLINTREGEX}\|${ERRORREGEX}" + done exit 1 else echo "No errors detected" From df6d35ba5bb75234458117c8091448f10835dfdb Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Wed, 22 Jan 2025 12:09:05 +0530 Subject: [PATCH 02/14] Review comments Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index d476900c..3d68911a 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -7,7 +7,7 @@ declare -a REPOS=("${GH_BASE_URL_KS}ksctl" "${GH_BASE_URL_CRT}host-operator" "${ C_PATH=${PWD} ERRORREPOLIST=() ERRORFILELIST=() -GOLINTREGEX="[\s\w.\/]*:[0-9]*:[0-9]*:[\s\w]*[:]*[\s\w\">.-]*[\w\s)(*.]*" +GOLINTREGEX="[\s\w.\/]*:[0-9]*:[0-9]*:[\w\s)(*.\`]*" ERRORREGEX="Error[:]*" echo Initiating verify-replace on dependent repos @@ -19,13 +19,13 @@ do echo echo ========================================================================================= repo_path=${BASE_REPO_PATH}/$(basename ${repo}) - ERRFILE=$(mktemp ${TMP_DIR}$(basename ${repo}).XXX) + ERRFILE=$(mktemp ${TMP_DIR}$(basename ${repo})-error.XXX) echo "Cloning repo in /tmp" git clone --depth=1 ${repo} ${repo_path} echo "Repo cloned successfully" cd ${repo_path} if ! make pre-verify; then - ERRORREPOLIST+="($(basename ${repo}))" + ERRORREPOLIST+="$(basename ${repo}) " continue fi echo "Initiating 'go mod replace' of current toolchain common version in dependent repos" @@ -33,14 +33,14 @@ do make verify-dependencies &> ${ERRFILE} rc=$? if [ ${rc} -ne 0 ]; then - ERRORREPOLIST+="($(basename ${repo}))" + ERRORREPOLIST+="$(basename ${repo}) " ERRORFILELIST+="${ERRFILE} " fi echo echo ========================================================================================= echo done -echo "Summary" +echo "Summary" if [ ${#ERRORREPOLIST[@]} -ne 0 ]; then echo "Below are the repos with error: " for e in ${ERRORREPOLIST[*]} @@ -52,7 +52,7 @@ if [ ${#ERRORREPOLIST[@]} -ne 0 ]; then echo echo ========================================================================================= echo - echo "${c} has the following errors " + echo "${c} has the following errors " echo echo ========================================================================================= echo From 3c0585b807be5ca91452e152e91a94da8ddd6d03 Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Thu, 23 Jan 2025 16:15:03 +0530 Subject: [PATCH 03/14] Review comments on stdout,stderr Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 41 ++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index 3d68911a..ccfbff38 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -7,8 +7,9 @@ declare -a REPOS=("${GH_BASE_URL_KS}ksctl" "${GH_BASE_URL_CRT}host-operator" "${ C_PATH=${PWD} ERRORREPOLIST=() ERRORFILELIST=() +STDOUTFILELIST=() GOLINTREGEX="[\s\w.\/]*:[0-9]*:[0-9]*:[\w\s)(*.\`]*" -ERRORREGEX="Error[:]*" +LINTERERRORFILE=$(mktemp ${TMP_DIR}LinterError.XXX) echo Initiating verify-replace on dependent repos for repo in "${REPOS[@]}" @@ -20,6 +21,7 @@ do echo ========================================================================================= repo_path=${BASE_REPO_PATH}/$(basename ${repo}) ERRFILE=$(mktemp ${TMP_DIR}$(basename ${repo})-error.XXX) + STDOUTFILE=$(mktemp ${TMP_DIR}$(basename ${repo})-output.XXX) echo "Cloning repo in /tmp" git clone --depth=1 ${repo} ${repo_path} echo "Repo cloned successfully" @@ -30,7 +32,7 @@ do fi echo "Initiating 'go mod replace' of current toolchain common version in dependent repos" go mod edit -replace github.com/codeready-toolchain/toolchain-common=${C_PATH} - make verify-dependencies &> ${ERRFILE} + make verify-dependencies 2> ${ERRFILE} 1> ${STDOUTFILE} rc=$? if [ ${rc} -ne 0 ]; then ERRORREPOLIST+="$(basename ${repo}) " @@ -45,18 +47,29 @@ if [ ${#ERRORREPOLIST[@]} -ne 0 ]; then echo "Below are the repos with error: " for e in ${ERRORREPOLIST[*]} do - echo "${e}" - done - for c in ${ERRORFILELIST[*]} - do - echo - echo ========================================================================================= - echo - echo "${c} has the following errors " - echo - echo ========================================================================================= - echo - cat "${c}" | grep "${GOLINTREGEX}\|${ERRORREGEX}" + for c in ${ERRORFILELIST[*]} + do + if [[ ${c} =~ ${e} ]]; then + echo + echo ========================================================================================= + echo + echo "${e} has the following errors " + echo + echo ========================================================================================= + echo + cat "${c}" + else + for s in ${STDOUTFILELIST[*]} + do + if [[ ${s} =~ ${e} ]]; then + cat "${s}" | grep -E ${GOLINTREGEX} > lintererror + if ! [ -s "lintererror" ]; then + cat lintererror + fi + fi + done + fi + done done exit 1 else From b1c3b7b482f80d0183d116bd15b1bfdba63acecf Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Thu, 23 Jan 2025 17:17:05 +0530 Subject: [PATCH 04/14] a silly miss of array Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index ccfbff38..105aa902 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -37,6 +37,7 @@ do if [ ${rc} -ne 0 ]; then ERRORREPOLIST+="$(basename ${repo}) " ERRORFILELIST+="${ERRFILE} " + STDOUTFILELIST="${STDOUTFILE} " fi echo echo ========================================================================================= From 6248706bed203f661f85159bceb96431400f8145 Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Mon, 27 Jan 2025 17:50:28 +0530 Subject: [PATCH 05/14] silly mis of $ and not using global variable Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index 105aa902..6c9e41ac 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -63,9 +63,9 @@ if [ ${#ERRORREPOLIST[@]} -ne 0 ]; then for s in ${STDOUTFILELIST[*]} do if [[ ${s} =~ ${e} ]]; then - cat "${s}" | grep -E ${GOLINTREGEX} > lintererror - if ! [ -s "lintererror" ]; then - cat lintererror + cat "${s}" | grep -E ${GOLINTREGEX} > ${LINTERERRORFILE} + if ! [ -s "${LINTERERRORFILE}" ]; then + cat "${LINTERERRORFILE}" fi fi done From d4f49b69647bf010db336bf9335c46415b850c92 Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Tue, 28 Jan 2025 20:03:14 +0530 Subject: [PATCH 06/14] Some silly misses and cosmetic changes as per review comments Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index 6c9e41ac..e313a491 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -9,7 +9,7 @@ ERRORREPOLIST=() ERRORFILELIST=() STDOUTFILELIST=() GOLINTREGEX="[\s\w.\/]*:[0-9]*:[0-9]*:[\w\s)(*.\`]*" -LINTERERRORFILE=$(mktemp ${TMP_DIR}LinterError.XXX) +LINTERERRORFILE=$(mktemp ${BASE_REPO_PATH}/LinterError.XXX) echo Initiating verify-replace on dependent repos for repo in "${REPOS[@]}" @@ -20,8 +20,10 @@ do echo echo ========================================================================================= repo_path=${BASE_REPO_PATH}/$(basename ${repo}) - ERRFILE=$(mktemp ${TMP_DIR}$(basename ${repo})-error.XXX) - STDOUTFILE=$(mktemp ${TMP_DIR}$(basename ${repo})-output.XXX) + err_file=$(mktemp ${BASE_REPO_PATH}/$(basename ${repo})-error.XXX) + echo "error output file : ${err_file}" + stdout_file=$(mktemp ${BASE_REPO_PATH}/$(basename ${repo})-output.XXX) + echo "std output file : ${stdout_file}" echo "Cloning repo in /tmp" git clone --depth=1 ${repo} ${repo_path} echo "Repo cloned successfully" @@ -32,12 +34,12 @@ do fi echo "Initiating 'go mod replace' of current toolchain common version in dependent repos" go mod edit -replace github.com/codeready-toolchain/toolchain-common=${C_PATH} - make verify-dependencies 2> ${ERRFILE} 1> ${STDOUTFILE} + make verify-dependencies 2> >(tee ${err_file}) 1> >(tee ${stdout_file}) rc=$? if [ ${rc} -ne 0 ]; then ERRORREPOLIST+="$(basename ${repo}) " - ERRORFILELIST+="${ERRFILE} " - STDOUTFILELIST="${STDOUTFILE} " + ERRORFILELIST+="${err_file} " + STDOUTFILELIST+="${stdout_file} " fi echo echo ========================================================================================= @@ -46,25 +48,30 @@ done echo "Summary" if [ ${#ERRORREPOLIST[@]} -ne 0 ]; then echo "Below are the repos with error: " - for e in ${ERRORREPOLIST[*]} + for errorreponame in ${ERRORREPOLIST[*]} do - for c in ${ERRORFILELIST[*]} + for errorfilename in ${ERRORFILELIST[*]} do - if [[ ${c} =~ ${e} ]]; then + if [[ ${errorfilename} =~ ${errorreponame} ]]; then echo echo ========================================================================================= echo - echo "${e} has the following errors " + echo "${errorreponame} has the following errors " echo echo ========================================================================================= echo - cat "${c}" + cat "${errorfilename}" else - for s in ${STDOUTFILELIST[*]} + # Since golint check is the only check for which we parse the error from the standard-ouput + # and is checked at last after all the other checks are done. But if there is any error in the previous checks, + # the script won't go ahead to check golint, and hence this check is seperated and put into else + # Meaning if the other checks have passed then only it wil proceed to check golint and we would parse + # golint errors from std files if any. + for stdoutfilename in ${STDOUTFILELIST[*]} do - if [[ ${s} =~ ${e} ]]; then - cat "${s}" | grep -E ${GOLINTREGEX} > ${LINTERERRORFILE} - if ! [ -s "${LINTERERRORFILE}" ]; then + if [[ ${stdoutfilename} =~ ${errorreponame} ]]; then + cat "${stdoutfilename}" | grep -E ${GOLINTREGEX} > ${LINTERERRORFILE} + if [ -s "${LINTERERRORFILE}" ]; then cat "${LINTERERRORFILE}" fi fi From 9e404c35ab7f916cbad8bad3e559f68150064221 Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Thu, 30 Jan 2025 11:22:35 +0530 Subject: [PATCH 07/14] extra loop removed Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index e313a491..c0478a5f 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -9,7 +9,6 @@ ERRORREPOLIST=() ERRORFILELIST=() STDOUTFILELIST=() GOLINTREGEX="[\s\w.\/]*:[0-9]*:[0-9]*:[\w\s)(*.\`]*" -LINTERERRORFILE=$(mktemp ${BASE_REPO_PATH}/LinterError.XXX) echo Initiating verify-replace on dependent repos for repo in "${REPOS[@]}" @@ -70,10 +69,7 @@ if [ ${#ERRORREPOLIST[@]} -ne 0 ]; then for stdoutfilename in ${STDOUTFILELIST[*]} do if [[ ${stdoutfilename} =~ ${errorreponame} ]]; then - cat "${stdoutfilename}" | grep -E ${GOLINTREGEX} > ${LINTERERRORFILE} - if [ -s "${LINTERERRORFILE}" ]; then - cat "${LINTERERRORFILE}" - fi + cat "${stdoutfilename}" | grep -E ${GOLINTREGEX} fi done fi From 7ed19cc1171d35801761e245e9a8ce30cae7c549 Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Thu, 30 Jan 2025 17:34:09 +0530 Subject: [PATCH 08/14] Following the conventions of naming abd reducing the for loops Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 56 ++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index c0478a5f..90c04664 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -5,10 +5,10 @@ GH_BASE_URL_KS=https://github.com/kubesaw/ GH_BASE_URL_CRT=https://github.com/codeready-toolchain/ declare -a REPOS=("${GH_BASE_URL_KS}ksctl" "${GH_BASE_URL_CRT}host-operator" "${GH_BASE_URL_CRT}member-operator" "${GH_BASE_URL_CRT}registration-service" "${GH_BASE_URL_CRT}toolchain-e2e") C_PATH=${PWD} -ERRORREPOLIST=() -ERRORFILELIST=() -STDOUTFILELIST=() -GOLINTREGEX="[\s\w.\/]*:[0-9]*:[0-9]*:[\w\s)(*.\`]*" +ERROR_REPO_LIST=() +ERROR_FILE_LIST=() +STD_OUT_FILE_LIST=() +GO_LINT_REGEX="[\s\w.\/]*:[0-9]*:[0-9]*:[\w\s)(*.\`]*" echo Initiating verify-replace on dependent repos for repo in "${REPOS[@]}" @@ -21,59 +21,55 @@ do repo_path=${BASE_REPO_PATH}/$(basename ${repo}) err_file=$(mktemp ${BASE_REPO_PATH}/$(basename ${repo})-error.XXX) echo "error output file : ${err_file}" - stdout_file=$(mktemp ${BASE_REPO_PATH}/$(basename ${repo})-output.XXX) - echo "std output file : ${stdout_file}" + std_out_file=$(mktemp ${BASE_REPO_PATH}/$(basename ${repo})-output.XXX) + echo "std output file : ${std_out_file}" echo "Cloning repo in /tmp" git clone --depth=1 ${repo} ${repo_path} echo "Repo cloned successfully" cd ${repo_path} - if ! make pre-verify; then - ERRORREPOLIST+="$(basename ${repo}) " + make pre-verify 2> >(tee ${err_file}) + if [ ${rc} -ne 0 ]; then + ERROR_REPO_LIST+="$(basename ${repo}) " + ERROR_FILE_LIST+="${err_file} " continue fi echo "Initiating 'go mod replace' of current toolchain common version in dependent repos" go mod edit -replace github.com/codeready-toolchain/toolchain-common=${C_PATH} - make verify-dependencies 2> >(tee ${err_file}) 1> >(tee ${stdout_file}) + make verify-dependencies 2> >(tee ${err_file}) 1> >(tee ${std_out_file}) rc=$? if [ ${rc} -ne 0 ]; then - ERRORREPOLIST+="$(basename ${repo}) " - ERRORFILELIST+="${err_file} " - STDOUTFILELIST+="${stdout_file} " + ERROR_REPO_LIST+="$(basename ${repo}) " + ERROR_FILE_LIST+="${err_file} " + STD_OUT_FILE_LIST+="${std_out_file} " fi echo echo ========================================================================================= echo done echo "Summary" -if [ ${#ERRORREPOLIST[@]} -ne 0 ]; then +if [ ${#ERROR_REPO_LIST[@]} -ne 0 ]; then echo "Below are the repos with error: " - for errorreponame in ${ERRORREPOLIST[*]} + for error_repo_name in ${ERROR_REPO_LIST[*]} do - for errorfilename in ${ERRORFILELIST[*]} + for error_file_name in ${ERROR_FILE_LIST[*]} do - if [[ ${errorfilename} =~ ${errorreponame} ]]; then + if [[ ${error_file_name} =~ ${error_repo_name} ]]; then echo echo ========================================================================================= echo - echo "${errorreponame} has the following errors " + echo "${error_repo_name} has the following errors " echo echo ========================================================================================= echo - cat "${errorfilename}" - else - # Since golint check is the only check for which we parse the error from the standard-ouput - # and is checked at last after all the other checks are done. But if there is any error in the previous checks, - # the script won't go ahead to check golint, and hence this check is seperated and put into else - # Meaning if the other checks have passed then only it wil proceed to check golint and we would parse - # golint errors from std files if any. - for stdoutfilename in ${STDOUTFILELIST[*]} - do - if [[ ${stdoutfilename} =~ ${errorreponame} ]]; then - cat "${stdoutfilename}" | grep -E ${GOLINTREGEX} - fi - done + cat "${error_file_name}" fi done + for std_out_file_name in ${STD_OUT_FILE_LIST[*]} + do + if [[ ${std_out_file_name} =~ ${error_repo_name} ]]; then + cat "${std_out_file_name}" | grep -E ${GO_LINT_REGEX} + fi + done done exit 1 else From 503332874753676e4d9dad5d0bbb81791d04a260 Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Thu, 30 Jan 2025 18:02:31 +0530 Subject: [PATCH 09/14] some addition to regex for failures Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index 90c04664..138d8f14 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -3,12 +3,14 @@ TMP_DIR=/tmp/ BASE_REPO_PATH=$(mktemp -d ${TMP_DIR}replace-verify.XXX) GH_BASE_URL_KS=https://github.com/kubesaw/ GH_BASE_URL_CRT=https://github.com/codeready-toolchain/ -declare -a REPOS=("${GH_BASE_URL_KS}ksctl" "${GH_BASE_URL_CRT}host-operator" "${GH_BASE_URL_CRT}member-operator" "${GH_BASE_URL_CRT}registration-service" "${GH_BASE_URL_CRT}toolchain-e2e") +declare -a REPOS=("${GH_BASE_URL_CRT}host-operator") C_PATH=${PWD} ERROR_REPO_LIST=() ERROR_FILE_LIST=() STD_OUT_FILE_LIST=() GO_LINT_REGEX="[\s\w.\/]*:[0-9]*:[0-9]*:[\w\s)(*.\`]*" +ERROR_REGEX="Error[:]*" #unit test or any other failure we log goes into stdoutput, hence making that regex too to fetch the error +FAIL_REGEX="FAIL[:]*" #unit test or any other failure we log goes into stdoutput, hence making that regex too to fetch the error echo Initiating verify-replace on dependent repos for repo in "${REPOS[@]}" @@ -28,6 +30,7 @@ do echo "Repo cloned successfully" cd ${repo_path} make pre-verify 2> >(tee ${err_file}) + rc=$? if [ ${rc} -ne 0 ]; then ERROR_REPO_LIST+="$(basename ${repo}) " ERROR_FILE_LIST+="${err_file} " @@ -67,7 +70,7 @@ if [ ${#ERROR_REPO_LIST[@]} -ne 0 ]; then for std_out_file_name in ${STD_OUT_FILE_LIST[*]} do if [[ ${std_out_file_name} =~ ${error_repo_name} ]]; then - cat "${std_out_file_name}" | grep -E ${GO_LINT_REGEX} + cat "${std_out_file_name}" | grep -E ${GO_LINT_REGEX}|${ERROR_REGEX}|${FAIL_REGEX} fi done done From 2aaa5c9793a1bd5086a917555ca23589ac079651 Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Thu, 30 Jan 2025 19:11:34 +0530 Subject: [PATCH 10/14] improving the readability Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index 138d8f14..013e2dea 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -3,15 +3,13 @@ TMP_DIR=/tmp/ BASE_REPO_PATH=$(mktemp -d ${TMP_DIR}replace-verify.XXX) GH_BASE_URL_KS=https://github.com/kubesaw/ GH_BASE_URL_CRT=https://github.com/codeready-toolchain/ -declare -a REPOS=("${GH_BASE_URL_CRT}host-operator") +declare -a REPOS=("${GH_BASE_URL_KS}ksctl" "${GH_BASE_URL_CRT}host-operator" "${GH_BASE_URL_CRT}member-operator" "${GH_BASE_URL_CRT}registration-service" "${GH_BASE_URL_CRT}toolchain-e2e") C_PATH=${PWD} ERROR_REPO_LIST=() ERROR_FILE_LIST=() STD_OUT_FILE_LIST=() GO_LINT_REGEX="[\s\w.\/]*:[0-9]*:[0-9]*:[\w\s)(*.\`]*" -ERROR_REGEX="Error[:]*" #unit test or any other failure we log goes into stdoutput, hence making that regex too to fetch the error -FAIL_REGEX="FAIL[:]*" #unit test or any other failure we log goes into stdoutput, hence making that regex too to fetch the error - +ERROR_REGEX="Error[:]*/|FAIL[:]*" #unit test or any other failure we log from our controllers other places goes into stdoutput, hence making that regex too, to fetch the error more precisely echo Initiating verify-replace on dependent repos for repo in "${REPOS[@]}" do From f7d055f73ed0e432f141b2197b6b6465ac763621 Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Thu, 30 Jan 2025 19:13:36 +0530 Subject: [PATCH 11/14] silly removal miss Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index 013e2dea..35280b55 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -68,7 +68,7 @@ if [ ${#ERROR_REPO_LIST[@]} -ne 0 ]; then for std_out_file_name in ${STD_OUT_FILE_LIST[*]} do if [[ ${std_out_file_name} =~ ${error_repo_name} ]]; then - cat "${std_out_file_name}" | grep -E ${GO_LINT_REGEX}|${ERROR_REGEX}|${FAIL_REGEX} + cat "${std_out_file_name}" | grep -E ${GO_LINT_REGEX}|${ERROR_REGEX} fi done done From 87667555e9832fcda13cbe97aa2a70d8b28703f9 Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Fri, 31 Jan 2025 11:57:17 +0530 Subject: [PATCH 12/14] regex update Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index 35280b55..ecb605cb 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -9,7 +9,10 @@ ERROR_REPO_LIST=() ERROR_FILE_LIST=() STD_OUT_FILE_LIST=() GO_LINT_REGEX="[\s\w.\/]*:[0-9]*:[0-9]*:[\w\s)(*.\`]*" -ERROR_REGEX="Error[:]*/|FAIL[:]*" #unit test or any other failure we log from our controllers other places goes into stdoutput, hence making that regex too, to fetch the error more precisely +ERROR_REGEX="[E\|e][R\|r][R\|r][O\|o][R\|r][:]*\|[F\|f][A\|a][I\|i][l\|L][:]*\|expected[:]*\|actual[:]*" #unit test or any other failure we log from our controllers or other places goes into stdoutput + #(since we log it and its not a failure in running the command or dependency check), + #hence making that regex too, to fetch the error more precisely + echo Initiating verify-replace on dependent repos for repo in "${REPOS[@]}" do From 5faf06da06884af4bd2a5c9f7140faeee5f70aca Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Fri, 31 Jan 2025 13:02:09 +0530 Subject: [PATCH 13/14] grep -E not working using quotes Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index ecb605cb..e7644d44 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -71,7 +71,7 @@ if [ ${#ERROR_REPO_LIST[@]} -ne 0 ]; then for std_out_file_name in ${STD_OUT_FILE_LIST[*]} do if [[ ${std_out_file_name} =~ ${error_repo_name} ]]; then - cat "${std_out_file_name}" | grep -E ${GO_LINT_REGEX}|${ERROR_REGEX} + cat "${std_out_file_name}" | grep "${GO_LINT_REGEX}\|${ERROR_REGEX}" fi done done From 8c2f1d7cc022516ce04e407762c96b93aecd3752 Mon Sep 17 00:00:00 2001 From: Feny Mehta Date: Fri, 31 Jan 2025 15:49:00 +0530 Subject: [PATCH 14/14] cosmetic changes Signed-off-by: Feny Mehta --- scripts/verify-replace.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/verify-replace.sh b/scripts/verify-replace.sh index e7644d44..dcd4c7fd 100755 --- a/scripts/verify-replace.sh +++ b/scripts/verify-replace.sh @@ -55,23 +55,23 @@ if [ ${#ERROR_REPO_LIST[@]} -ne 0 ]; then echo "Below are the repos with error: " for error_repo_name in ${ERROR_REPO_LIST[*]} do + echo + echo ========================================================================================= + echo + echo "${error_repo_name} has the following errors " + echo + echo ========================================================================================= + echo for error_file_name in ${ERROR_FILE_LIST[*]} do if [[ ${error_file_name} =~ ${error_repo_name} ]]; then - echo - echo ========================================================================================= - echo - echo "${error_repo_name} has the following errors " - echo - echo ========================================================================================= - echo cat "${error_file_name}" fi done for std_out_file_name in ${STD_OUT_FILE_LIST[*]} do if [[ ${std_out_file_name} =~ ${error_repo_name} ]]; then - cat "${std_out_file_name}" | grep "${GO_LINT_REGEX}\|${ERROR_REGEX}" + cat "${std_out_file_name}" | grep -C 5 "${GO_LINT_REGEX}\|${ERROR_REGEX}" fi done done