![](/img/trans.png)
[英]Google Cloud Function Deployment with firebase deploy: does nothing
[英]Cloud function deployment issue
当我部署云功能时,我收到以下错误。
我正在使用go mod,我能够从我的沙箱构建并运行所有集成测试,
其中一个云函数依赖使用私有github repo,
当我部署云功能时go:github.com/myrepo/ptrie@v0.1。:git fetch -f origin refs / heads / :refs / heads / refs / tags / :refs / tags / in / builder / pkg / mod / cache / vcs / 41e03711c0ecff6d0de8588fa6de21a2c351c59fd4b0a1b685eaaa5868c5892e:退出状态128:致命:无法读取“ https://github.com ”的用户名:终端提示被禁用
您可能希望在Github中创建个人访问令牌,然后配置git以使用该令牌。
该命令看起来像这样:
git config --global url."https://{YOUR TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
在那之后,git应该能够从您的私人仓库中读取
如何使用endly自动化你的云功能构建,在这种情况下你会使用go mod与供应商,你的私人仓库将被添加到供应商文件夹,确保你添加.gcloudignore不包括go.mod,go.sum
@ .gcloudignore
go.mod
go.sum
最终使用具有凭证的私人仓库的自动化工作流程可能如下所示
@ deploy.yaml
init:
appPath: $WorkingDirectory(.)
target:
URL: ssh://127.0.0.1/
credentials: localhost
myGitSecret: ${secrets.private-git}
pipeline:
secretInfo:
action: print
comments: print git credentials (debuging only_
message: $AsJSON($myGitSecret)
package:
action: exec:run
comments: vendor build for deployment speedup
target: $target
checkError: true
terminators:
- Password
- Username
secrets:
#secret var alias: secret file i.e ~/.secret/private-git.json
gitSecrets: private-git
commands:
- export GIT_TERMINAL_PROMPT=1
- export GO111MODULE=on
- unset GOPATH
- cd ${appPath}/
- go mod vendor
- '${cmd[3].stdout}:/Username/? $gitSecrets.Username'
- '${output}:/Password/? $gitSecrets.Password'
deploy:
action: gcp/cloudfunctions:deploy
'@name': MyFn
timeout: 540s
availableMemoryMb: 2048
entryPoint: MyFn
runtime: go111
eventTrigger:
eventType: google.storage.object.finalize
resource: projects/_/buckets/${matcherConfig.Bucket}
source:
URL: ${appPath}/
最后查看云功能 e2e测试和部署自动化
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.