Skip to content

Commit

Permalink
fix: delete appendpath funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
smorihira committed Sep 9, 2024
1 parent 1acf269 commit 01022fe
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions hack/actions/gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,36 +356,30 @@ const (
buildkitSyftScanner = "buildkit-syft-scanner"
)

func (data *Data) appendPaths(paths ...string) {
data.PullRequestPaths = append(data.PullRequestPaths, paths...)
}

func (data *Data) appendComponentsPaths() {
func (data *Data) setPullRequestPaths() {
switch data.Name {
// the benchmark components trigger each other, not just themselves
case benchJob:
data.appendPaths(
data.PullRequestPaths = append(data.PullRequestPaths,
cmdBenchOperatorsPath,
pkgBenchOperatorsPath,
)
case benchOperator:
data.appendPaths(
data.PullRequestPaths = append(data.PullRequestPaths,
cmdBenchJobsPath,
pkgBenchJobsPath,
)
case agentFaiss, agentNgt:
data.appendPaths(agentInternalPath)
data.PullRequestPaths = append(data.PullRequestPaths, agentInternalPath)
default:
if strings.Contains(strings.ToLower(data.Name), gateway) {
data.appendPaths(gatewayInternalPath)
data.PullRequestPaths = append(data.PullRequestPaths, gatewayInternalPath)
}
}
}

func (data *Data) appendContainerTypeDependingPaths() {
switch data.ContainerType {
case HelmOperator:
data.appendPaths(
data.PullRequestPaths = append(data.PullRequestPaths,
chartPath,
valuesPath,
templatesPath,
Expand All @@ -395,13 +389,13 @@ func (data *Data) appendContainerTypeDependingPaths() {
operatorSDKVersionPath,
)
case DevContainer, CIContainer:
data.appendPaths(
data.PullRequestPaths = append(data.PullRequestPaths,
apisGrpcPath,
apisProtoPath,
hackPath,
)
case Go:
data.appendPaths(
data.PullRequestPaths = append(data.PullRequestPaths,
apisGrpcPath,
apisProtoPath,
goModPath,
Expand All @@ -415,10 +409,10 @@ func (data *Data) appendContainerTypeDependingPaths() {
switch data.Name {
case discovererK8s, indexOperator, gatewayMirror, readreplicaRotate, agentNgt, benchJob, benchOperator:
default:
data.appendPaths(excludeK8sPath)
data.PullRequestPaths = append(data.PullRequestPaths, excludeK8sPath)
}
case Rust:
data.appendPaths(
data.PullRequestPaths = append(data.PullRequestPaths,
apisGrpcPath,
apisProtoPath,
cargoLockPath,
Expand All @@ -433,22 +427,17 @@ func (data *Data) appendContainerTypeDependingPaths() {
)
}
if strings.EqualFold(data.Name, agentFaiss) || data.ContainerType == Rust {
data.appendPaths(faissVersionPath)
data.PullRequestPaths = append(data.PullRequestPaths, faissVersionPath)
}
if strings.EqualFold(data.Name, agentNgt) || data.ContainerType == Rust {
data.appendPaths(ngtVersionPath)
data.PullRequestPaths = append(data.PullRequestPaths, ngtVersionPath)
}
}

func (data *Data) setPullRequestPaths() {
data.appendComponentsPaths()
data.appendContainerTypeDependingPaths()

if data.Name == agentSidecar {
data.appendPaths(internalStoragePath)
data.PullRequestPaths = append(data.PullRequestPaths, internalStoragePath)
}
if !data.AliasImage {
data.appendPaths(makefilePath, makefileDirPath)
data.PullRequestPaths = append(data.PullRequestPaths, makefilePath, makefileDirPath)
}
}

Expand Down

0 comments on commit 01022fe

Please sign in to comment.