简体   繁体   English

谷歌云平台云构建重建云功能未更新内容

[英]google cloud platform cloud build rebuild cloud function not updated the content

I put the file on Github and connected with Google Cloud Repository.我把文件放在 Github 上并连接到 Google Cloud Repository。 Below is the .yaml file, when I update my index.js file, the Cloud Build rebuilds the Cloud Function, but why the content didn't get updated?下面是 .yaml 文件,当我更新 index.js 文件时,Cloud Build 重建了 Cloud Function,但为什么内容没有更新? Manually setup for Cloud Function works手动设置 Cloud Function 有效

steps:
- name: 'gcr.io/cloud-builders/yarn'
  args: ['install']
  dir: 'functions/autodeploy'
- name: 'gcr.io/cloud-builders/gcloud'
  args: ['functions', 'deploy', 'function-1', '--trigger-http', '--runtime', 'nodejs10', '--entry-point', 'firstci']
  dir: 'functions/autodeploy'

Below is the function exported from index.js, now Cloud Function should output "test finally", but after rebuild, it still output "test 3rd time"下面是 index.js 导出的函数,现在 Cloud Function 应该输出“test finally”,但重建后,它仍然输出“test 3rd time”

exports.firstci = (req, res) => {
  let message = req.query.message || req.body.message || 'setup pineline, test finally cloud build!';
  res.status(200).send(message);
};

Nodejs 10 Runtime is still in beta. Nodejs 10 运行时仍处于测试阶段。 Try to put beta as following in your cloudbuild.yaml file and remove the 2 dir lines because it's not necessary.尝试将 beta 如下放入您的 cloudbuild.yaml 文件并删除 2 dir 行,因为它不是必需的。

cloudbuild.yaml云构建.yaml

steps:
  - name: 'gcr.io/cloud-builders/yarn'
    args: ['install']
  - name: 'gcr.io/cloud-builders/gcloud'
    args: ['beta','functions', 'deploy', 'function-1', '--trigger-http', '-- runtime', 'nodejs10', '--entry-point', 'firstci']

I ran into this for a full day.我一整天都遇到了这个问题。 Ultimately, this is the yaml structure that successfully updated the Cloud Function content:最终,这是成功更新 Cloud Function 内容的 yaml 结构:

steps:
  - name: gcr.io/cloud-builders/gcloud
    args:
      - functions
      - deploy
      - my-function
      - '--trigger-topic'
      - my-topic
      - '--runtime'
      - dotnet3
      - '--entry-point'
      - Example.EntryPoint
      - '--region'
      - us-east1
      - '--allow-unauthenticated'
      - '--source=https://source.developers.google.com/projects/my-project/repos/github_dw_gcp/moveable-aliases/main/paths/cloud-functions/my-function'

This is called from a Cloud Build trigger after a push to a GCP Source Repository that is mirroed to GitHub.这是在推送到镜像到 GitHub 的 GCP 源代码库后从 Cloud Build 触发器调用的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM