0

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: './'
2
  • 1
    Did you retry now? functions take sometine time to rollout all the instances. Commented Mar 21, 2020 at 12:16
  • @guillaumeblaquiere, Yes i did, i don't think that is the problem because the deployment version is increased. That means i hope the deployment is done and ready to use. Thanks Commented Mar 22, 2020 at 1:15

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

@DazWikin, Thanks much, it worked, couldn't find much resources on how to do this in quick search.
Super! I agree that there documentation could be improved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.