Skip to content

Commit

Permalink
Fix yet again
Browse files Browse the repository at this point in the history
  • Loading branch information
wenovus committed Jun 20, 2020
1 parent 152b4d4 commit f259559
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
14 changes: 4 additions & 10 deletions cmd_gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down
18 changes: 12 additions & 6 deletions post_results/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions validators/compat_report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f259559

Please sign in to comment.