Skip to content

Commit

Permalink
Skip push validation for head revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
wenovus committed Jun 20, 2020
1 parent 439638f commit 82cc00c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cmd_gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,17 +319,17 @@ func main() {
}
}

badgeOnly := false
pushToMaster := false
// If it's a push on master, just upload badge for normal validators as the only action.
if prNumber == 0 {
if branchName != "master" {
log.Fatalf("cmd_gen: There is no action to take for a non-master branch push, please re-examine your push triggers")
}
badgeOnly = true
pushToMaster = true
}

// Skip testing non-widely used validators, as we don't need to post badges for those tools.
if badgeOnly {
if pushToMaster {
for validatorId, validator := range commonci.Validators {
if !validator.IsWidelyUsedTool {
// Here we assume simply that non widely-used checks don't have a version specified.
Expand Down Expand Up @@ -370,7 +370,7 @@ func main() {
}

compatReports = commonci.ValidatorAndVersionsDiff(compatReports, skippedValidators)
if !badgeOnly {
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)
Expand Down Expand Up @@ -417,6 +417,10 @@ func main() {
log.Printf("Not activating skipped validator %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] {
Expand Down

0 comments on commit 82cc00c

Please sign in to comment.