diff --git a/.cloudbuild/scripts/cmd/integration-tests/main.go b/.cloudbuild/scripts/cmd/integration-tests/main.go index 3f64c8fee7a..a6efc1d0fd8 100644 --- a/.cloudbuild/scripts/cmd/integration-tests/main.go +++ b/.cloudbuild/scripts/cmd/integration-tests/main.go @@ -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 } diff --git a/.cloudbuild/scripts/cmd/unit-tests/main.go b/.cloudbuild/scripts/cmd/unit-tests/main.go index f45bb1e45af..773856e7501 100644 --- a/.cloudbuild/scripts/cmd/unit-tests/main.go +++ b/.cloudbuild/scripts/cmd/unit-tests/main.go @@ -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 } diff --git a/.cloudbuild/scripts/internal/changes/changes.go b/.cloudbuild/scripts/internal/changes/changes.go index 8603fe28841..b618216a39e 100644 --- a/.cloudbuild/scripts/internal/changes/changes.go +++ b/.cloudbuild/scripts/internal/changes/changes.go @@ -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 }