Reputation: 708
I am trying to setup CI/CD pipeline with Google Cloud Build for deploying the Google Cloud Functions with GitHub repository.
I have managed to create the trigger and whenever i push changes to master branch, the build is triggering. But after the deployment and Cloud Function Version is incremented, when i invoke the cloud function, it still executing the old function.
Following is the buildconfig.yaml
steps:
- name: gcr.io/cloud-builders/git
args: ['clone', 'https://github.com/mayuran19/GCP-CloudFunction']
- name: gcr.io/cloud-builders/git
args: ['pull', 'https://github.com/mayuran19/GCP-CloudFunction', 'master']
- name: 'gcr.io/cloud-builders/gcloud'
args: ['functions', 'deploy', 'function-1', '--trigger-http', '--runtime', 'nodejs8', '--entry-point', 'helloWorld']
dir: './'
Upvotes: 0
Views: 1108
Reputation: 40326
It's challenging to debug Cloud Build but I think you're missing the correct deployment source.
The git clone ...
step creates /workspace/GCP-CloudFunction
But you gcloud functions deploy ...
from (default == /workspace
).
You need to point gcloud functions deploy ... --source=./GCP-CloudFunction
. (since you're in /workspace
; or --source=/workspace/GCP-CloudFunction
to be explicit).
A useful debugging mechanism is to add e.g. a busybox
step that ls -la /workspace
to ensure that, the workspace contains what you're expecting.
Upvotes: 1