2

我不太确定如何调试此错误,因为我在终端上我确定我的项目 ID 并且我已经使用我的 gcloud 登录。这是我的 -vdebug 错误:

INFO[0000] starting gRPC server on port 50051           
INFO[0000] starting gRPC HTTP server on port 50052      
INFO[0000] Skaffold &{Version:v1.12.0 ConfigVersion:skaffold/v2beta5 GitVersion: GitCommit:e680a831292e1c7efc54e0c6d40544ae141e6354 GitTreeState:clean BuildDate:2020-07-04T21:01:46Z GoVersion:go1.14.4 Compiler:gc Platform:darwin/amd64} 
DEBU[0000] config version "skaffold/v2alpha3" out of date: upgrading to latest "skaffold/v2beta5" 
DEBU[0000] validating yamltags of struct SkaffoldConfig 
DEBU[0000] validating yamltags of struct Metadata       
DEBU[0000] validating yamltags of struct Pipeline       
DEBU[0000] validating yamltags of struct BuildConfig    
DEBU[0000] validating yamltags of struct Artifact       
DEBU[0000] validating yamltags of struct Sync           
DEBU[0000] validating yamltags of struct SyncRule       
DEBU[0000] validating yamltags of struct ArtifactType   
DEBU[0000] validating yamltags of struct DockerArtifact 
DEBU[0000] validating yamltags of struct Artifact       
DEBU[0000] validating yamltags of struct Sync           
DEBU[0000] validating yamltags of struct SyncRule       
DEBU[0000] validating yamltags of struct ArtifactType   
DEBU[0000] validating yamltags of struct DockerArtifact 
DEBU[0000] validating yamltags of struct TagPolicy      
DEBU[0000] validating yamltags of struct GitTagger      
DEBU[0000] validating yamltags of struct BuildType      
DEBU[0000] validating yamltags of struct GoogleCloudBuild 
DEBU[0000] validating yamltags of struct DeployConfig   
DEBU[0000] validating yamltags of struct DeployType     
DEBU[0000] validating yamltags of struct KubectlDeploy  
DEBU[0000] validating yamltags of struct KubectlFlags   
INFO[0000] Using kubectl context: gke_udemy-ticketing-dev-285506_asia-southeast2-b_udemy-ticketing-dev 
DEBU[0000] Using builder: google cloud                  
DEBU[0000] setting Docker user agent to skaffold-v1.12.0 
Listing files to watch...
 - us.gcr.io/udemy-ticketing-dev-285506/auth
DEBU[0000] Found dependencies for dockerfile: [{package.json /app true} {. /app true}] 
 - us.gcr.io/udemy-ticketing-dev-285506/client
DEBU[0000] Found dependencies for dockerfile: [{package.json /app true} {. /app true}] 
INFO[0000] List generated in 10.566014ms                
Generating tags...
 - us.gcr.io/udemy-ticketing-dev-285506/auth -> DEBU[0000] Running command: [git describe --tags --always] 
DEBU[0000] Running command: [git describe --tags --always] 
DEBU[0000] unable to find git commit: running [git describe --tags --always]
 - stdout: ""
 - stderr: "fatal: not a git repository (or any of the parent directories): .git\n"
 - cause: exit status 128 
DEBU[0000] Using a fall-back tagger                     
us.gcr.io/udemy-ticketing-dev-285506/auth:latest
 - us.gcr.io/udemy-ticketing-dev-285506/client -> DEBU[0000] unable to find git commit: running [git describe --tags --always]
 - stdout: ""
 - stderr: "fatal: not a git repository (or any of the parent directories): .git\n"
 - cause: exit status 128 
DEBU[0000] Using a fall-back tagger                     
us.gcr.io/udemy-ticketing-dev-285506/client:latest
Some taggers failed. Rerun with -vdebug for errors.
INFO[0000] Tags generated in 12.246278ms                
Checking cache...
DEBU[0000] Found dependencies for dockerfile: [{package.json /app true} {. /app true}] 
DEBU[0000] Found dependencies for dockerfile: [{package.json /app true} {. /app true}] 
 - us.gcr.io/udemy-ticketing-dev-285506/auth: Not found. Building
 - us.gcr.io/udemy-ticketing-dev-285506/client: Not found. Building
INFO[0000] Cache check complete in 3.771983ms           
Building [us.gcr.io/udemy-ticketing-dev-285506/auth]...
DEBU[0000] Running command: [gcloud auth print-access-token --format=json] 
DEBU[0000] Command output: [{
  "token": "ya29.a0AfH6SMAdyo9b5C6-LCXuF_ZHJbMse712NYXc_UUR7IQr2gXxxeRyn7t9zmucETasrRdExizDwlOMNXvB0H40I24qhmIgCAL3yocSjhTz1JhQ5cHqgbPrlMTVI0VTFHe9PBu0Fzqy7J6MVQ-CACRnWD2iMAjDFjwUDqbivbmhxek"
}
] 
INFO[0000] unable to retrieve token: oauth2: token expired and refresh token is not set 
INFO[0000] falling back to application default credentials 

exiting dev mode because first build failed: couldn't build "us.gcr.io/udemy-ticketing-dev-285506/auth": creating bucket if not exists: googleapi: Error 400: User project specified in the request is invalid., invalid

当我确定我的项目 ID 时,如何获取请求中指定的用户项目无效?在我的终端和 skaffold.yaml 中,它肯定是正确的,很难找到解决方案,我被卡住了。

这是我的 skaffold.yaml:

apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  kubectl:
    manifests:
      - ./infra/k8s/*
build:
  googleCloudBuild:
    projectId: udemy-ticketing-dev-285506
  artifacts:
    - image: us.gcr.io/udemy-ticketing-dev-285506/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: "src/**/*.ts"
            dest: .
    - image: us.gcr.io/udemy-ticketing-dev-285506/client
      context: client
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: "**/*.js"
            dest: .
4

1 回答 1

7

所以经过大量的挖掘,我终于找到了适合我的解决方案:

gcloud auth 应用程序-默认登录

让我感到奇怪的是我已经登录了:

gcloud 身份验证登录

于 2020-08-05T08:36:43.243 回答