From 2a5c1654577c0363afa370e9ba812d7310a7da50 Mon Sep 17 00:00:00 2001 From: Cody Oss <6331106+codyoss@users.noreply.github.com> Date: Thu, 6 Apr 2023 16:44:12 -0500 Subject: [PATCH] chore: onboard compute to owlbot (#7705) --- .github/.OwlBot.yaml | 3 +++ internal/gapicgen/generator/config.go | 10 ---------- internal/gapicgen/generator/gapics.go | 4 ---- internal/gapicgen/generator/genproto.go | 20 ++++++++------------ internal/postprocessor/config.yaml | 5 ++--- 5 files changed, 13 insertions(+), 29 deletions(-) diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml index 5e13281a3def..3bb5b95fcb59 100644 --- a/.github/.OwlBot.yaml +++ b/.github/.OwlBot.yaml @@ -47,6 +47,7 @@ deep-remove-regex: # - /cloudbuild/apiv1/v2/ - /cloudbuild/apiv2/ - /clouddms/apiv1/ + - /compute/apiv1 - /contactcenterinsights/apiv1/ - /container/apiv1/ - /containeranalysis/apiv1beta1/ @@ -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 diff --git a/internal/gapicgen/generator/config.go b/internal/gapicgen/generator/config.go index 2cecf3828c56..07dfb19362e5 100644 --- a/internal/gapicgen/generator/config.go +++ b/internal/gapicgen/generator/config.go @@ -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, diff --git a/internal/gapicgen/generator/gapics.go b/internal/gapicgen/generator/gapics.go index 989d91518f99..142ff0daed3a 100644 --- a/internal/gapicgen/generator/gapics.go +++ b/internal/gapicgen/generator/gapics.go @@ -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) diff --git a/internal/gapicgen/generator/genproto.go b/internal/gapicgen/generator/genproto.go index 4402e61fce21..5e7dc06f53b1 100644 --- a/internal/gapicgen/generator/genproto.go +++ b/internal/gapicgen/generator/genproto.go @@ -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 @@ -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) @@ -201,12 +195,14 @@ func goPkg(fileName string) (string, error) { // protoc executes the "protoc" command on files named in fileNames, and outputs // to "/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 diff --git a/internal/postprocessor/config.yaml b/internal/postprocessor/config.yaml index 58d2a7b5a8ff..e47b96da1cef 100644 --- a/internal/postprocessor/config.yaml +++ b/internal/postprocessor/config.yaml @@ -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 @@ -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