diff --git a/cmd_gen/main.go b/cmd_gen/main.go index 3e82e21..9c768af 100644 --- a/cmd_gen/main.go +++ b/cmd_gen/main.go @@ -200,7 +200,7 @@ function run-dir() { status=0 $cmd "${options[@]}" "${script_options[@]}" "$@" &> ${prefix}pass || status=1 if [[ $status -eq "0" ]]; then - python "${output_file}" &> ${prefix}pass || status=1 + python "${output_file}" &>> ${prefix}pass || status=1 fi if [[ $status -eq "1" ]]; then mv ${prefix}pass ${prefix}fail @@ -236,9 +236,9 @@ function run-dir() { $cmd "${options[@]}" "${script_options[@]}" "$@" &> ${prefix}pass || status=1 cd "$outdir" if [[ $status -eq "0" ]]; then - go mod init &> ${prefix}pass || status=1 - go mod tidy &> ${prefix}pass || status=1 - go build &> ${prefix}pass || status=1 + go mod init &>> ${prefix}pass || status=1 + go mod tidy &>> ${prefix}pass || status=1 + go build &>> ${prefix}pass || status=1 fi if [[ $status -eq "1" ]]; then mv ${prefix}pass ${prefix}fail diff --git a/cmd_gen/main_test.go b/cmd_gen/main_test.go index 83b9f34..1bac902 100644 --- a/cmd_gen/main_test.go +++ b/cmd_gen/main_test.go @@ -166,7 +166,7 @@ function run-dir() { status=0 $cmd "${options[@]}" "${script_options[@]}" "$@" &> ${prefix}pass || status=1 if [[ $status -eq "0" ]]; then - python "${output_file}" &> ${prefix}pass || status=1 + python "${output_file}" &>> ${prefix}pass || status=1 fi if [[ $status -eq "1" ]]; then mv ${prefix}pass ${prefix}fail @@ -206,9 +206,9 @@ function run-dir() { $cmd "${options[@]}" "${script_options[@]}" "$@" &> ${prefix}pass || status=1 cd "$outdir" if [[ $status -eq "0" ]]; then - go mod init &> ${prefix}pass || status=1 - go mod tidy &> ${prefix}pass || status=1 - go build &> ${prefix}pass || status=1 + go mod init &>> ${prefix}pass || status=1 + go mod tidy &>> ${prefix}pass || status=1 + go build &>> ${prefix}pass || status=1 fi if [[ $status -eq "1" ]]; then mv ${prefix}pass ${prefix}fail diff --git a/post_results/main.go b/post_results/main.go index fbabae8..3d40d45 100644 --- a/post_results/main.go +++ b/post_results/main.go @@ -99,6 +99,10 @@ func init() { flag.StringVar(&version, "version", "", "(optional) specific version of the validator tool.") } +func blockQuote(s string) string { + return "```\n" + s + "\n```" +} + // sprintLineHTML prints a single list item to be put under a top-level summary item. func sprintLineHTML(format string, a ...interface{}) string { return fmt.Sprintf("
  • "+format+"
  • \n", a...) @@ -440,11 +444,12 @@ func parseModelResultsHTML(validatorId, validatorResultDir string, condensed boo } if !condensed || !modelPass { - // Display bash command that produced the validator result. + // Display bash command that produced the validator result if it exists. var bashCommandSummary string if bashCommand != "" && bashCommandModelDirName == modelDirName && bashCommandModelName == modelName { bashCommandSummary = fmt.Sprintf("%s  %s\n
    %s
    \n", commonci.Emoji("cmd"), "bash command", bashCommand) } + // Also display the error string. modelHTML.WriteString(sprintSummaryHTML(status, modelName, bashCommandSummary+outString)) } } @@ -496,7 +501,7 @@ func getResult(validatorId, resultsDir string, condensed bool) (string, bool, ve } // For per-model validators, an execution failure suggests a CI infra failure. if validator.IsPerModel { - outString = "Validator script failed -- infra bug?\n" + outString + outString = fmt.Sprintf("Validator script failed -- infra bug?\n%s", blockQuote(outString)) } pass = false case validator.IsPerModel && validatorId == "misc-checks": diff --git a/post_results/main_test.go b/post_results/main_test.go index 55bfb0e..7f7514d 100644 --- a/post_results/main_test.go +++ b/post_results/main_test.go @@ -317,7 +317,9 @@ Passed. inValidatorId: "oc-pyang", wantPass: false, wantOut: `Validator script failed -- infra bug? -Test failed with no stderr output.`, +` + "```" + ` +Test failed with no stderr output. +` + "```", wantCondensedOutSame: true, }, { name: "basic non-pyang pass", @@ -510,7 +512,7 @@ Failed. inValidatorResultDir: "testdata/oc-pyang-script-fail", inValidatorId: "oc-pyang", wantPass: false, - wantOut: "Validator script failed -- infra bug?\nI failed\n", + wantOut: "Validator script failed -- infra bug?\n```\nI failed\n\n```", wantCondensedOutSame: true, }, { name: "openconfig-version, revision version, and .spec.yml checks all pass",