如何更改Cloud Functions部署中使用的捆绑器版本? [英] How to change the version of bundler used in Cloud Functions deployment?

查看:50
本文介绍了如何更改Cloud Functions部署中使用的捆绑器版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自几天前以来,对Cloud Functions的部署一直失败.

Deployments to Cloud Functions have been failing since a few days ago.

source "https://rubygems.org"

ruby "~> 2.7.0"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

gem "google-cloud-firestore"

部署脚本

$ 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

为什么?

这是自打包程序v2.2.8以来的打包程序回归.

Why?

This is bundler's regression since bundler v2.2.8.

此问题已在捆绑程序v2.2.10中修复

And this is fixed at bundler v2.2.10

所以我希望捆绑软件的版本低于v2.2.8或高于v2.2.10.

So I want the bundler version to be less than v2.2.8 or more than v2.2.10.

Cloud Functions部署( gcloud functions deploy )会自动运行 bundle install ,并使用在部署任务中安装的 bundler .

Cloud Functions deployment ( gcloud functions deploy ) automatically runs bundle install and uses bundler which installed in deployment task.

部署任务中的当前捆绑程序版本为v2.2.9

Current bundler version in deployment task is v2.2.9

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)

主要主题

gcloud函数部署没有一些更改捆绑程序版本的参数...

Main subject

gcloud functions deploy doesn't have some arguments to change bundler version...

https://cloud.google.com/sdk/gcloud/reference/functions/deploy?hl = ja

如何更改在Cloud Functions部署中使用的捆绑器版本?

How to change the version of bundler used in Cloud Functions deployment?

推荐答案

最终,我已经成功部署了以下对象.

Eventually I have successfully deployed with followings.

  1. gem install bundler --no-doc
  2. 删除 Gemfile.lock
  3. 重新创建 Gemfile.lock ( bundle install )

diff

$ 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

这篇关于如何更改Cloud Functions部署中使用的捆绑器版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆