mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-03 20:40:45 -05:00
Add a new `github` changed file group that includes everything in the `.github` directory. Further refine the `pipeline` group to only include scripts, workflows, and actions files in `.github`. We also move the `CODEOWNERS` file into `.github/` to simplify `github` grouping. As `build` logic responds to changes to the `pipeline` group this will result in no longer building and testing everything for simple changes in `github` that don't affect the pipeline. Signed-off-by: Ryan Cragun <me@ryan.ec> Co-authored-by: Ryan Cragun <me@ryan.ec>
This commit is contained in:
parent
d1b34cf00c
commit
3dace284b9
4 changed files with 23 additions and 9 deletions
0
CODEOWNERS → .github/CODEOWNERS
vendored
0
CODEOWNERS → .github/CODEOWNERS
vendored
|
|
@ -23,6 +23,7 @@ var DefaultFileGroupCheckers = []FileGroupCheck{
|
|||
FileGroupCheckerDocs,
|
||||
FileGroupCheckerEnos,
|
||||
FileGroupCheckerEnterprise,
|
||||
FileGroupCheckerGithub,
|
||||
FileGroupCheckerGoToolchain,
|
||||
FileGroupCheckerPipeline,
|
||||
FileGroupCheckerProto,
|
||||
|
|
@ -204,6 +205,15 @@ func FileGroupCheckerEnterprise(ctx context.Context, file *File) FileGroups {
|
|||
return nil
|
||||
}
|
||||
|
||||
// FileGroupCheckerGithub is a file group checker that groups Github files
|
||||
func FileGroupCheckerGithub(ctx context.Context, file *File) FileGroups {
|
||||
if hasBaseDir(file.Name(), ".github") {
|
||||
return FileGroups{FileGroupGithub}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// FileGroupCheckerGoToolchain is a file group checker that groups based on the file modifying the
|
||||
// Go toolchain or dependencies.
|
||||
func FileGroupCheckerGoToolchain(ctx context.Context, file *File) FileGroups {
|
||||
|
|
@ -227,10 +237,11 @@ func FileGroupCheckerPipeline(ctx context.Context, file *File) FileGroups {
|
|||
switch {
|
||||
case
|
||||
hasBaseDir(name, ".build"),
|
||||
hasBaseDir(name, ".github"),
|
||||
hasBaseDir(name, filepath.Join(".github", "workflows")),
|
||||
hasBaseDir(name, filepath.Join(".github", "actions")),
|
||||
hasBaseDir(name, filepath.Join(".github", "scripts")),
|
||||
hasBaseDir(name, "scripts"),
|
||||
hasBaseDir(name, filepath.Join("tools", "pipeline")),
|
||||
name == "CODEOWNERS",
|
||||
name == "Dockerfile",
|
||||
name == "Makefile":
|
||||
return FileGroups{FileGroupPipeline}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,13 @@ func TestFileGroupDefaultCheckers(t *testing.T) {
|
|||
|
||||
for filename, groups := range map[string]FileGroups{
|
||||
".build/entrypoint.sh": {FileGroupPipeline},
|
||||
".github/actions/changed-files/actions.yml": {FileGroupPipeline},
|
||||
".github/workflows/build.yml": {FileGroupPipeline},
|
||||
".github/workflows/build-artifacts-ce.yml": {FileGroupCommunity, FileGroupPipeline},
|
||||
".github/workflows/build-artifacts-ent.yml": {FileGroupEnterprise, FileGroupPipeline},
|
||||
".github/workflows/backport-ce-ent.yml": {FileGroupCommunity, FileGroupPipeline},
|
||||
".github/actions/changed-files/actions.yml": {FileGroupGithub, FileGroupPipeline},
|
||||
".github/workflows/build.yml": {FileGroupGithub, FileGroupPipeline},
|
||||
".github/workflows/build-artifacts-ce.yml": {FileGroupCommunity, FileGroupGithub, FileGroupPipeline},
|
||||
".github/workflows/build-artifacts-ent.yml": {FileGroupEnterprise, FileGroupGithub, FileGroupPipeline},
|
||||
".github/workflows/backport-ce-ent.yml": {FileGroupCommunity, FileGroupGithub, FileGroupPipeline},
|
||||
".github/scripts/pr_comment.sh": {FileGroupGithub, FileGroupPipeline},
|
||||
".github/CODEOWNERS": {FileGroupGithub},
|
||||
".go-version": {FileGroupGoToolchain},
|
||||
".release/ibm-pao/eboms/5900-BJ8.essentials.csv": {FileGroupEnterprise},
|
||||
"audit/backend_ce.go": {FileGroupGoApp, FileGroupCommunity},
|
||||
|
|
@ -62,7 +64,6 @@ func TestFileGroupDefaultCheckers(t *testing.T) {
|
|||
"vault_ent/requires_ent.go": {FileGroupGoApp, FileGroupEnterprise},
|
||||
"website/content/api-docs/index.mdx": {FileGroupDocs},
|
||||
"CHANGELOG.md": {FileGroupChangelog},
|
||||
"CODEOWNERS": {FileGroupPipeline},
|
||||
"Dockerfile": {FileGroupPipeline},
|
||||
"Makefile": {FileGroupPipeline},
|
||||
"README.md": {FileGroupDocs},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
// Package changed is a package for inspecting and categorizing changed files into groups
|
||||
package changed
|
||||
|
||||
import (
|
||||
|
|
@ -20,7 +21,7 @@ type (
|
|||
Files []*File
|
||||
// FileGroup is group name describing a class of file the changed file belongs to
|
||||
FileGroup string
|
||||
// FileGroup is a set of groups a changed file belongs to. Use FileGroups.Add() instead of append()
|
||||
// FileGroups is a set of groups a changed file belongs to. Use FileGroups.Add() instead of append()
|
||||
// to ensure uniqueness and ordering
|
||||
FileGroups []FileGroup
|
||||
)
|
||||
|
|
@ -32,6 +33,7 @@ const (
|
|||
FileGroupDocs FileGroup = "docs"
|
||||
FileGroupEnos FileGroup = "enos"
|
||||
FileGroupEnterprise FileGroup = "enterprise"
|
||||
FileGroupGithub FileGroup = "github"
|
||||
FileGroupGoApp FileGroup = "app"
|
||||
FileGroupGoToolchain FileGroup = "gotoolchain"
|
||||
FileGroupPipeline FileGroup = "pipeline"
|
||||
|
|
|
|||
Loading…
Reference in a new issue