Don't run tests when updating teleport.e. (#13096)

This commit is contained in:
Krzysztof Skrzętnicki
2022-06-09 10:10:54 +00:00
committed by GitHub
parent 8e82baafcb
commit 7eada745bc
3 changed files with 19 additions and 15 deletions
@@ -26,13 +26,14 @@ import (
"syscall"
"time"
"github.com/gravitational/trace"
log "github.com/sirupsen/logrus"
"github.com/gravitational/teleport/.cloudbuild/scripts/internal/artifacts"
"github.com/gravitational/teleport/.cloudbuild/scripts/internal/changes"
"github.com/gravitational/teleport/.cloudbuild/scripts/internal/etcd"
"github.com/gravitational/teleport/.cloudbuild/scripts/internal/git"
"github.com/gravitational/teleport/.cloudbuild/scripts/internal/secrets"
"github.com/gravitational/trace"
log "github.com/sirupsen/logrus"
)
const (
@@ -86,8 +87,7 @@ func innerMain() error {
return trace.Wrap(err, "Failed analyzing code")
}
hasOnlyDocChanges := ch.Docs && (!ch.Code)
if hasOnlyDocChanges {
if !ch.Code {
log.Println("No code changes detected. Skipping tests.")
return nil
}
+5 -5
View File
@@ -25,14 +25,15 @@ import (
"path/filepath"
"time"
"github.com/gravitational/trace"
log "github.com/sirupsen/logrus"
"github.com/gravitational/teleport/.cloudbuild/scripts/internal/artifacts"
"github.com/gravitational/teleport/.cloudbuild/scripts/internal/changes"
"github.com/gravitational/teleport/.cloudbuild/scripts/internal/customflag"
"github.com/gravitational/teleport/.cloudbuild/scripts/internal/etcd"
"github.com/gravitational/teleport/.cloudbuild/scripts/internal/git"
"github.com/gravitational/teleport/.cloudbuild/scripts/internal/secrets"
"github.com/gravitational/trace"
log "github.com/sirupsen/logrus"
)
// main is just a stub that prints out an error message and sets a nonzero exit
@@ -106,7 +107,7 @@ func parseCommandLine() (commandlineArgs, error) {
return args, nil
}
// run parses the command line, performs the highlevel docs change check
// run parses the command line, performs the high level docs change check
// and creates the marker file if necessary
func run() error {
args, err := parseCommandLine()
@@ -140,8 +141,7 @@ func run() error {
return trace.Wrap(err, "Failed analyzing code")
}
hasOnlyDocChanges := ch.Docs && (!ch.Code)
if hasOnlyDocChanges {
if !ch.Code {
log.Println("No code changes detected. Skipping tests.")
return nil
}
@@ -31,8 +31,9 @@ import (
// Changes describes the kind of changes found in the analysed workspace.
type Changes struct {
Docs bool
Code bool
Docs bool
Code bool
Enterprise bool
}
// Analyze examines the workspace for specific changes using its git history,
@@ -57,15 +58,18 @@ func Analyze(workspaceDir string, targetBranch string, commitSHA string) (Change
case path == "":
continue
case path == "e":
report.Enterprise = true
case isDocChange(path):
report.Docs = report.Docs || true
report.Docs = true
default:
report.Code = report.Code || true
report.Code = true
}
if report.Docs && report.Code {
// There's no sense in exhaustively listing all of the changes if
if report.Docs && report.Code && report.Enterprise {
// There's no sense in exhaustively listing all the changes if
// the answer won't change, so bail early.
break
}