Ruby 如何更改云功能部署中使用的bundler版本? 上下文

Ruby 如何更改云功能部署中使用的bundler版本? 上下文,ruby,google-cloud-platform,google-cloud-functions,Ruby,Google Cloud Platform,Google Cloud Functions,自几天前以来,云功能的部署一直在失败 Gemfile 部署脚本 部署脚本 主体 gcloud函数deploy没有更改捆绑程序版本的参数 如何更改云功能部署中使用的bundler版本?我也遇到了类似的问题,但是错误输出略有不同。有一个共同点是这句台词: Bundler found conflicting requirements for the Ruby version: 在做了一些挖掘和故障排除之后,我发现谷歌云功能代表我们锁定了捆绑平台。我不是一个ruby专家,但我怀疑这会影响从Gemfi

自几天前以来,云功能的部署一直在失败

Gemfile 部署脚本 部署脚本 主体
gcloud函数deploy
没有更改捆绑程序版本的参数


如何更改云功能部署中使用的bundler版本?

我也遇到了类似的问题,但是错误输出略有不同。有一个共同点是这句台词:

Bundler found conflicting requirements for the Ruby version:
在做了一些挖掘和故障排除之后,我发现谷歌云功能代表我们锁定了捆绑平台。我不是一个ruby专家,但我怀疑这会影响从Gemfile中读取信息的方式以及ruby版本

谷歌云功能的日志示例:

解决方案: 本地更新绑定器(我更新到2.2.14)。删除您的
Gemfile.lock
文件,然后重新运行
bundle安装
以生成
Gemfile.lock
。如果有任何需要修复的地方,这应该修复依赖项

最重要的是,它将更新你的
Gemfile.lock
中的
Platforms
部分,以符合谷歌的期望

在我的例子中,平台从
Ruby
更新为
x86\u 64-darwin-19


或者,如果可能的话,另一种方法可能是使用bundle更新平台。

最终我成功地部署了以下内容

  • gem安装捆绑程序--无文档
  • 删除
    Gemfile.lock
  • 重新创建
    Gemfile.lock
    捆绑安装
  • 差异
    $git--无寻呼机差异主
    diff——git a/Gemfile.lock b/Gemfile.lock
    索引5e7502b..b5642ab 100644
    ---a/Gemfile.lock
    +++b/Gemfile.lock
    @@-57,7+57,6@@GEM
    gapic普通(~>0.3)
    谷歌云错误(~>1.0)
    grpc-google-iam-v1(>=0.6.10,<2.0)
    -谷歌protobuf(3.15.5)
    google protobuf(3.15.5-universal-darwin)
    googleapis普通原型(1.3.11)
    google protobuf(~>3.14)
    @@-72,9+71,6@@GEM
    多重json(~>1.11)
    操作系统(>=0.9,<2.0)
    图章(~>0.14)
    -grpc(1.36.0)
    -google protobuf(~>3.14)
    -googleapis常见原型类型(~>1.0)
    grpc(1.36.0-universal-darwin)
    google protobuf(~>3.14)
    googleapis常见原型类型(~>1.0)
    @@-160,7+156,6@@GEM
    平台
    红宝石
    -x86_64-darwin-17
    依赖关系
    多滕夫
    @@-180,4+175,4@@RUBY版本
    ruby 2.7.2p137
    捆绑
    -   2.1.4
    +   2.2.14
    
    谢谢您的回答。最终我成功部署了!没问题,很高兴您能够成功部署!
    $ gcloud functions deploy my_func --region=us-central1 --memory=128MB --runtime=ruby27
    
    (snip)
    
    ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: Fetching gem metadata from https://rubygems.org/..........
    Resolving dependencies...
    Bundler found conflicting requirements for the Ruby version:
      In Gemfile:
        Ruby (~> 2.7.0)
    
        google-cloud-firestore was resolved to 2.4.1, which depends on
          google-cloud-firestore-v1 (~> 0.0) was resolved to 0.4.0, which depends on
            gapic-common (~> 0.3) was resolved to 0.4.0, which depends on
    google-protobuf (~> 3.15, >= 3.15.2) was resolved to 3.15.5, which
    depends on
                Ruby (< 3.1.dev, >= 2.3)
    
        google-cloud-firestore was resolved to 2.4.1, which depends on
          google-cloud-firestore-v1 (~> 0.0) was resolved to 0.4.0, which depends on
            gapic-common (~> 0.3) was resolved to 0.4.0, which depends on
              grpc (~> 1.36) was resolved to 1.36.0, which depends on
                Ruby (< 3.1.dev, >= 2.4); Error ID: af32a539
    
    source "https://rubygems.org"
    
    ruby "~> 2.7.0"
    
    git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
    
    
    gem "bundler", "!= 2.2.8", "!= 2.2.9" 
    
    $ gcloud functions deploy my_func --region=us-central1 --memory=128MB --runtime=ruby27
    
    (snip)
    
    Resolving dependencies...
    Bundler could not find compatible versions for gem "bundler":
      In Gemfile:
        bundler (!= 2.2.8, != 2.2.9)
    
      Current Bundler version:
        bundler (2.2.9)
    
    Bundler found conflicting requirements for the Ruby version:
    
    2021-03-10 13:13:01.764 PST
    Step #4 - "builder": Done "bundle lock --add-platform x86_64-linux" 
    
    $ git --no-pager diff main
    
    diff --git a/Gemfile.lock b/Gemfile.lock
    index 5e7502b..b5642ab 100644
    --- a/Gemfile.lock
    +++ b/Gemfile.lock
    @@ -57,7 +57,6 @@ GEM
           gapic-common (~> 0.3)
           google-cloud-errors (~> 1.0)
           grpc-google-iam-v1 (>= 0.6.10, < 2.0)
    -    google-protobuf (3.15.5)
         google-protobuf (3.15.5-universal-darwin)
         googleapis-common-protos (1.3.11)
           google-protobuf (~> 3.14)
    @@ -72,9 +71,6 @@ GEM
           multi_json (~> 1.11)
           os (>= 0.9, < 2.0)
           signet (~> 0.14)
    -    grpc (1.36.0)
    -      google-protobuf (~> 3.14)
    -      googleapis-common-protos-types (~> 1.0)
         grpc (1.36.0-universal-darwin)
           google-protobuf (~> 3.14)
           googleapis-common-protos-types (~> 1.0)
    @@ -160,7 +156,6 @@ GEM
    
     PLATFORMS
       ruby
    -  x86_64-darwin-17
    
     DEPENDENCIES
       dotenv
    @@ -180,4 +175,4 @@ RUBY VERSION
        ruby 2.7.2p137
    
     BUNDLED WITH
    -   2.1.4
    +   2.2.14