diff --git a/cmd_gen/main.go b/cmd_gen/main.go index 84a0a89..d8cb224 100644 --- a/cmd_gen/main.go +++ b/cmd_gen/main.go @@ -371,11 +371,9 @@ func main() { } compatReports = commonci.ValidatorAndVersionsDiff(compatReports, skippedValidators) - if !pushToMaster { - // Notify later CI steps of the validators that should be reported as a compatibility report. - if err := ioutil.WriteFile(commonci.CompatReportValidatorsFile, []byte(compatReports), 0444); err != nil { - log.Fatalf("error while writing compatibility report validators file %q: %v", commonci.CompatReportValidatorsFile, err) - } + // Notify later CI steps of the validators that should be reported as a compatibility report. + if err := ioutil.WriteFile(commonci.CompatReportValidatorsFile, []byte(compatReports), 0444); err != nil { + log.Fatalf("error while writing compatibility report validators file %q: %v", commonci.CompatReportValidatorsFile, err) } _, compatValidatorsMap := commonci.GetValidatorAndVersionsFromString(compatReports) @@ -418,17 +416,13 @@ func main() { log.Printf("Not activating skipped validator: %s", commonci.AppendVersionToName(validatorId, version)) continue } - if pushToMaster && compatValidatorsMap[validatorId][version] { - log.Printf("Not activating compatibility report validator for push to master: %s", commonci.AppendVersionToName(validatorId, version)) - continue - } if pushToMaster && version == "head" { log.Printf("Skipping badge posting for @head revision for %s", commonci.AppendVersionToName(validatorId, version)) continue } // Post initial PR status. - if !compatValidatorsMap[validatorId][version] { + if !pushToMaster && !compatValidatorsMap[validatorId][version] { if errs := postInitialStatus(h, validatorId, version); errs != nil { log.Fatal(errs) } diff --git a/post_results/main.go b/post_results/main.go index b1cd6b5..6a2f06c 100644 --- a/post_results/main.go +++ b/post_results/main.go @@ -647,13 +647,13 @@ func postResult(validatorId, version string) error { pushToMaster = true } - if !pushToMaster { - compatReportsStr, err := readFile(commonci.CompatReportValidatorsFile) - if err != nil { - return fmt.Errorf("postResult: %v", err) - } - compatValidators, compatValidatorsMap := commonci.GetValidatorAndVersionsFromString(compatReportsStr) + compatReportsStr, err := readFile(commonci.CompatReportValidatorsFile) + if err != nil { + return fmt.Errorf("postResult: %v", err) + } + compatValidators, compatValidatorsMap := commonci.GetValidatorAndVersionsFromString(compatReportsStr) + if !pushToMaster { if validatorId == "compat-report" { log.Printf("Processing compatibility report for %s", compatReportsStr) return postCompatibilityReport(compatValidators) @@ -700,6 +700,12 @@ func postResult(validatorId, version string) error { log.Fatalf("error while writing output file %q: %v", outputFile, err) return err } + + // Skip PR status reporting if validator is part of compatibility report. + if compatValidatorsMap[validatorId][version] { + log.Printf("Validator %s part of compatibility report, skipping reporting standalone PR status.", commonci.AppendVersionToName(validatorId, version)) + return nil + } } var url, gistID string diff --git a/validators/compat_report.sh b/validators/compat_report.sh index a54f44b..4a65aaa 100755 --- a/validators/compat_report.sh +++ b/validators/compat_report.sh @@ -3,6 +3,11 @@ ROOT_DIR=/workspace USERCONFIG_DIR=$ROOT_DIR/user-config +if [ -z $_PR_NUMBER ]; then + echo "skipping: don't post compatibility report for push to master" + exit 0 +fi + if ! [ -s $USERCONFIG_DIR/compat-report-validators.txt ]; then echo "skipping: no validators to report in compatibility report" exit 0