Skip to content

Commit

Permalink
chore: onboard compute to owlbot (#7705)
Browse files Browse the repository at this point in the history
  • Loading branch information
codyoss authored Apr 6, 2023
1 parent 7a9e211 commit 2a5c165
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .github/.OwlBot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ deep-remove-regex:
# - /cloudbuild/apiv1/v2/
- /cloudbuild/apiv2/
- /clouddms/apiv1/
- /compute/apiv1
- /contactcenterinsights/apiv1/
- /container/apiv1/
- /containeranalysis/apiv1beta1/
Expand Down Expand Up @@ -305,6 +306,8 @@ deep-copy-regex:
dest: /cloudbuild/apiv2
- source: /google/cloud/clouddms/v1/cloud.google.com/go/clouddms/apiv1
dest: /clouddms/apiv1
- source: /google/cloud/compute/v1/cloud.google.com/go/compute/apiv1
dest: /compute/apiv1
- source: /google/cloud/contactcenterinsights/v1/cloud.google.com/go/contactcenterinsights/apiv1
dest: /contactcenterinsights/apiv1
- source: /google/container/v1/cloud.google.com/go/container/apiv1
Expand Down
10 changes: 0 additions & 10 deletions internal/gapicgen/generator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,6 @@ func isMigrated(importPath string) bool {
}

var MicrogenGapicConfigs = []*MicrogenConfig{
// Cloud APIs
{
InputDirectoryPath: "google/cloud/compute/v1",
Pkg: "compute",
ImportPath: "cloud.google.com/go/compute/apiv1",
ApiServiceConfigPath: "compute_v1.yaml",
Transports: []string{"rest"},
ReleaseLevel: "ga",
NumericEnumsDisabled: true,
},
{
InputDirectoryPath: "google/cloud/texttospeech/v1",
stopGeneration: true,
Expand Down
4 changes: 0 additions & 4 deletions internal/gapicgen/generator/gapics.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,6 @@ func (g *GapicGenerator) microgen(conf *MicrogenConfig) error {
if !conf.NumericEnumsDisabled {
args = append(args, "--go_gapic_opt", "rest-numeric-enums")
}
// This is a bummer way of toggling diregapic generation, but it compute is the only one for the near term.
if conf.Pkg == "compute" {
args = append(args, "--go_gapic_opt", "diregapic")
}
if stubsDir := conf.getStubsDir(); stubsDir != "" {
// Enable protobuf/gRPC generation in the google-cloud-go directory.
args = append(args, "--go_out=plugins=grpc:"+g.googleCloudDir)
Expand Down
20 changes: 8 additions & 12 deletions internal/gapicgen/generator/genproto.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ var denylist = map[string]bool{
"google.golang.org/genproto/googleapis/cloud/ondemandscanning/v1": true,
}

// noGRPC is the set of APIs that do not need gRPC stubs.
var noGRPC = map[string]bool{
"google.golang.org/genproto/googleapis/cloud/compute/v1": true,
}

// GenprotoGenerator is used to generate code for googleapis/go-genproto.
type GenprotoGenerator struct {
genprotoDir string
Expand Down Expand Up @@ -145,14 +140,13 @@ func (g *GenprotoGenerator) Regen(ctx context.Context) error {
if !strings.HasPrefix(pkg, "google.golang.org/genproto") || denylist[pkg] || hasPrefix(pkg, skipPrefixes) {
continue
}
grpc := !noGRPC[pkg]
pk := pkg
fn := fileNames

if !isMigrated(pkg) {
grp.Go(func() error {
log.Println("running protoc on", pk)
return g.protoc(fn, grpc)
return g.protoc(fn)
})
} else {
log.Printf("skipping, %q has been migrated", pkg)
Expand Down Expand Up @@ -201,12 +195,14 @@ func goPkg(fileName string) (string, error) {

// protoc executes the "protoc" command on files named in fileNames, and outputs
// to "<genprotoDir>/generated".
func (g *GenprotoGenerator) protoc(fileNames []string, grpc bool) error {
stubs := fmt.Sprintf("--go_out=%s/generated", g.genprotoDir)
if grpc {
stubs = fmt.Sprintf("--go_out=plugins=grpc:%s/generated", g.genprotoDir)
func (g *GenprotoGenerator) protoc(fileNames []string) error {
args := []string{
"--experimental_allow_proto3_optional",
fmt.Sprintf("--go_out=%s/generated", g.genprotoDir),
fmt.Sprintf("--go_out=plugins=grpc:%s/generated", g.genprotoDir),
"-I", g.googleapisDir,
"-I", g.protoSrcDir,
}
args := []string{"--experimental_allow_proto3_optional", stubs, "-I", g.googleapisDir, "-I", g.protoSrcDir}
args = append(args, fileNames...)
c := execv.Command("protoc", args...)
c.Dir = g.genprotoDir
Expand Down
5 changes: 2 additions & 3 deletions internal/postprocessor/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,8 @@ service-configs:
service-config: cloudbuild_v1.yaml
- input-directory: google/devtools/cloudbuild/v2
service-config: cloudbuild_v2.yaml
- input-directory: google/cloud/compute/v1
service-config: compute_v1.yaml
- input-directory: google/devtools/containeranalysis/v1beta1
service-config: containeranalysis_v1beta1.yaml
- input-directory: google/firestore/admin/v1
Expand Down Expand Up @@ -635,9 +637,6 @@ service-configs:
- input-directory: google/cloud/tasks/v2beta3
service-config: cloudtasks_v2beta3.yaml
import-path: cloud.google.com/go/cloudtasks/apiv2beta3
- input-directory: google/cloud/compute/v1
service-config: compute_v1.yaml
import-path: cloud.google.com/go/compute/apiv1
- input-directory: google/devtools/containeranalysis/v1beta1/grafeas
service-config: ../containeranalysis_v1beta1.yaml
import-path: cloud.google.com/go/containeranalysis/apiv1beta1
Expand Down

0 comments on commit 2a5c165

Please sign in to comment.