Pritish
Pritish

Reputation: 774

How to exclude files and directories from deploying using cloudbuild yaml?

I deploying a cloud function in GCP using my cloudbuild yaml file. But, I want to exclude specific files and directories from deploying. How do I do it ?

Below is my yaml file:

steps:
- name: 'node:10.10.0'
  id: installing_npm
  args: ['npm', 'install']
  dir: 'API/groups'
- name: 'gcr.io/cloud-builders/gcloud'
  id: deploy
  args: [
          'functions', 'deploy', 'groups', 
          '--region=us-central1',
          '--source=.', 
          '--trigger-http', 
          '--runtime=nodejs8', 
          '--entry-point=App', 
          '--allow-unauthenticated',
          '[email protected]'
        ]
  dir: 'API/groups'

Attaching a screenshot below. In this screenshot, in the groups directory, I want to deploy only the directory src and the files package.json and package-lock.json and exclude the rest from the directory. As of now, the whole contents of groups directory are getting deployed which I don't want.

Upvotes: 2

Views: 4395

Answers (1)

Neo Anderson
Neo Anderson

Reputation: 6350

Either use --ignore-file to specify an ignore file, or create a .gcloudignore in the root directory of the execution context.

The .gcloudignore file uses the same syntax and behaves exactly as the well known .gitignore file.

Upvotes: 5

Related Questions