gcloud_alpha_functions_deploy (1)
NAME
- gcloud alpha functions deploy - create or update a Google Cloud Function
SYNOPSIS
-
gcloud alpha functions deploy (NAME : --region=REGION) [--entry-point=ENTRY_POINT] [--memory=MEMORY] [--retry] [--runtime=RUNTIME] [--service-account=SERVICE_ACCOUNT] [--source=SOURCE] [--stage-bucket=STAGE_BUCKET] [--timeout=TIMEOUT] [--update-labels=[KEY=VALUE,...]] [--clear-env-vars | --env-vars-file=FILE_PATH | --set-env-vars=[KEY=VALUE,...] | --remove-env-vars=[KEY,...] --update-env-vars=[KEY=VALUE,...]] [--clear-labels | --remove-labels=[KEY,...]] [--trigger-bucket=TRIGGER_BUCKET | --trigger-http | --trigger-topic=TRIGGER_TOPIC | --trigger-event=EVENT_TYPE --trigger-resource=RESOURCE] [GCLOUD_WIDE_FLAG ...]
DESCRIPTION
(ALPHA) Create or update a Google Cloud Function.
POSITIONAL ARGUMENTS
-
-
- Function resource - The Cloud function name to deploy. The arguments in this group can be used to specify the attributes of this resource. (NOTE) Some attributes are not given arguments in this group but can be set in other ways. To set the [project] attribute: provide the argument [NAME] on the command line with a fully specified name; provide the argument [--project] on the command line; set the property [core/project]. This must be specified.
-
- NAME
-
ID of the function or fully qualified identifier for the function. This
positional must be specified if any of the other arguments in this group are
specified.
- --region=REGION
-
The Cloud region for the function. Overrides the default functions/region
property value for this command invocation.
- Function resource - The Cloud function name to deploy. The arguments in this group can be used to specify the attributes of this resource. (NOTE) Some attributes are not given arguments in this group but can be set in other ways. To set the [project] attribute: provide the argument [NAME] on the command line with a fully specified name; provide the argument [--project] on the command line; set the property [core/project]. This must be specified.
-
FLAGS
-
- --entry-point=ENTRY_POINT
-
By default when a Google Cloud Function is triggered, it executes a JavaScript
function with the same name. Or, if it cannot find a function with the same
name, it executes a function named function. You can use this flag to
override the default behavior, by specifying the name of a JavaScript function
that will be executed when the Google Cloud Function is triggered.
- --memory=MEMORY
-
Limit on the amount of memory the function can use.
Allowed values are: 128MB, 256MB, 512MB, 1024MB, and 2048MB. By default, a new function is limited to 256MB of memory. When deploying an update to an existing function, the function will keep its old memory limit unless you specify this flag.
- --retry
-
If specified, then the function will be retried in case of a failure.
- --runtime=RUNTIME
-
The runtime in which to run the function. Defaults to Node.js 6.
Choices:
-
- ---
- nodejs6: Node.js 6
- ---
- nodejs8: Node.js 8
- ---
- python37: Python 3.7
-
-
- --service-account=SERVICE_ACCOUNT
-
The email address of the IAM service account associated with the function at
runtime. The service account represents the identity of the running function,
and determines what permissions the function has.
If not provided, the function will use the project's default service account.
- --source=SOURCE
-
Location of source code to deploy.
Location of the source can be one of the following three options:
-
- ---
- Source code in Google Cloud Storage (must be a .zip archive),
- ---
- Reference to source repository or,
- ---
-
Local filesystem path (root directory of function source).
-
The value of the flag will be interpreted as a Cloud Storage location, if it
starts with gs://.
The value will be interpreted as a reference to a source repository, if it
starts with https://.
Otherwise, it will be interpreted as the local filesystem path. When deploying
source from the local filesystem, this command skips files specified in the
.gcloudignore file (see gcloud topic gcloudignore for more
information). If the .gcloudignore file doesn't exist, the command will
try to create it.
The minimal source repository URL is:
source.developers.google.com/projects/${PROJECT}/repos/${REPO}
By using the URL above, sources from the root directory of the repository on the
revision tagged master will be used.
If you want to deploy from a revision different from master, append one of
the following three sources to the URL:
-
- *
- /revisions/${REVISION},
- *
- /moveable-aliases/${MOVEABLE_ALIAS},
- *
-
/fixed-aliases/${FIXED_ALIAS}.
If you'd like to deploy sources from a directory different from the root, you
must specify a revision, a moveable alias, or a fixed alias, as above, and
append /paths/${PATH_TO_SOURCES_DIRECTORY} to the URL.
Overall, the URL should match the following regular expression:
- ^source\.developers\.google\.com/projects (?<accountId>[^/]+)/repos/(?<repoName>[^/]+) (((/revisions/(?<commit>[^/]+))|(/moveable-aliases/(?<branch>[^/]+))| (/fixed-aliases/(?<tag>[^/]+)))(/paths/(?<path>.*))?)?$
An example of a validly formatted source repository URL is:
- source.developers.google.com/projects/123456789/repos/testrepo moveable-aliases/alternate-branch/paths/path-to=source
If the source location is not explicitly set, new functions will deploy from the current directory. Existing functions keep their old source.
-
- --stage-bucket=STAGE_BUCKET
-
When deploying a function from a local directory, this flag's value is the name
of the Google Cloud Storage bucket in which source code will be stored.
- --timeout=TIMEOUT
-
The function execution timeout, e.g. 30s for 30 seconds. Defaults to original
value for existing function or 60 seconds for new functions. Cannot be more than
540s. See $ gcloud topic datetimes for information on duration formats.
- --update-labels=[KEY=VALUE,...]
-
List of label KEY=VALUE pairs to update. If a label exists its value is
modified, otherwise a new label is created.
Keys must start with a lowercase character and contain only hyphens (-), underscores (_), lowercase characters, and numbers. Values must contain only hyphens (-), underscores (_), lowercase characters, and numbers.
Label keys starting with deployment are reserved for use by deployment tools and cannot be specified manually.
-
At most one of these may be specified:
-
- --clear-env-vars
-
Remove all environment variables.
- --env-vars-file=FILE_PATH
-
Path to a local YAML file with definitions for all environment variables. All
existing environment variables will be removed before the new environment
variables are added.
- --set-env-vars=[KEY=VALUE,...]
-
List of key-value pairs to set as environment variables. All existing
environment variables will be removed first.
-
Only --update-env-vars and --remove-env-vars can be used together. If
both are specified, --remove-env-vars will be applied first.
-
- --remove-env-vars=[KEY,...]
-
List of environment variables to be removed.
- --update-env-vars=[KEY=VALUE,...]
-
List of key-value pairs to set as environment variables.
-
-
-
At most one of these may be specified:
-
- --clear-labels
-
Remove all labels. If --update-labels is also specified then
--clear-labels is applied first.
For example, to remove all labels:
- $ gcloud alpha functions deploy --clear-labels
To set the labels to exactly "foo" and "baz":
-
$ gcloud alpha functions deploy --clear-labels \
--update-labels foo=bar,baz=qux
- --remove-labels=[KEY,...]
-
List of label keys to remove. If a label does not exist it is silently
ignored.Label keys starting with deployment are reserved for use by
deployment tools and cannot be specified manually.
-
-
If you don't specify a trigger when deploying an update to an existing function
it will keep its current trigger. You must specify --trigger-topic,
--trigger-bucket, --trigger-http or (--trigger-event
AND --trigger-resource) when deploying a new function. At most one of
these may be specified:
-
- --trigger-bucket=TRIGGER_BUCKET
-
Google Cloud Storage bucket name. Every change in files in this bucket will
trigger function execution.
- --trigger-http
-
Function will be assigned an endpoint, which you can view by using the
describe command. Any HTTP request (of a supported type) to the endpoint
will trigger function execution. Supported HTTP request types are: POST, PUT,
GET, DELETE, and OPTIONS.
- --trigger-topic=TRIGGER_TOPIC
-
Name of Pub/Sub topic. Every message published in this topic will trigger
function execution with message contents passed as input data.
- --trigger-event=EVENT_TYPE
-
Specifies which action should trigger the function. For a list of acceptable
values, call gcloud functions event-types list.
- --trigger-resource=RESOURCE
-
Specifies which resource from --trigger-event is being observed. E.g.
if --trigger-event is
providers/cloud.storage/eventTypes/object.change,
--trigger-resource must be a bucket name. For a list of expected
resources, call gcloud functions event-types list.
-
GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --configuration, --flags-file, --flatten, --format, --help, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for details.
NOTES
This command is currently in ALPHA and may change without notice. If this command fails with API permission errors despite specifying the right project, you will have to apply for early access and have your projects registered on the API whitelist to use it. To do so, contact Support at cloud.google.com/support These variants are also available:
- $ gcloud functions deploy $ gcloud beta functions deploy