问题
I put the file on Github and connected with 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? Manually setup for Cloud Function works
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"
exports.firstci = (req, res) => {
let message = req.query.message || req.body.message || 'setup pineline, test finally cloud build!';
res.status(200).send(message);
};
回答1:
Nodejs 10 Runtime is still in beta. Try to put beta as following in your cloudbuild.yaml file and remove the 2 dir lines because it's not necessary.
cloudbuild.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']
来源:https://stackoverflow.com/questions/59882278/google-cloud-platform-cloud-build-rebuild-cloud-function-not-updated-the-content