lib/google/serverless/exec.rb
##
# Create an execution for a rake task.
#
# @param name [String] Name of the task
# @param args [Array<String>] Args to pass to the task
# @param env_args [Array<String>] Environment variable settings, each
#     of the form `NAME=value`.
# @param service [String,nil] Name of the service. If omitted, obtains
#     the service name from the config file.
# @param config_path [String,nil] App Engine config file to get the
#     service name from if the service name is not provided directly.
#     If omitted, defaults to the value returned by
#     {Google::Serverless::Exec.default_config_path}.
# @param version [String,nil] Version string. If omitted, defaults to the
#     most recently created version of the given service (which may not
#     be the one currently receiving traffic).
# @param timeout [String,nil] Timeout string. If omitted, defaults to the
#     value returned by {Google::Serverless::Exec.default_timeout}.
# @param wrapper_image [String,nil] The fully qualified name of the
#     wrapper image to use. (Applies only to the "cloud_build" strategy.)
# @param strategy [String,nil] The execution strategy to use, or `nil` to
#     choose a default based on the App Engine (flexible or standard) or Cloud  Run
#     environments. Allowed values are `nil`, `"deployment"` (which is the
#     default for App Engine Standard), and `"cloud_build"` (which is the default
#     for App Engine Flexible and Cloud Run).
# @param gcs_log_dir [String,nil] GCS bucket name of the cloud build log
#     when strategy is "cloud_build". (ex. "gs://BUCKET-NAME/FOLDER-NAME")
# @param product [Symbol] The serverless product to use. If omitted, defaults to
#     the value returned by {Google::Serverless::Exec#default_product}
Create an execution for a rake task.
Create an execution for a rake task .
def new_rake_task name, args: [], env_args: [],
                          service: nil, config_path: nil, version: nil,
                          timeout: nil, project: nil, wrapper_image: nil,
                          strategy: nil, gcs_log_dir: nil, product: nil
          escaped_args = args.map do |arg|
            arg.gsub(/[,\[\]]/) { |m| "\\#{m}" }
          end
          name_with_args =
            if escaped_args.empty?
              name
            else
              "#{name}[#{escaped_args.join ','}]"
            end
          new ["bundle", "exec", "rake", name_with_args] + env_args,
              service: service, config_path: config_path, version: version,
              timeout: timeout, project: project, wrapper_image: wrapper_image,
              strategy: strategy, gcs_log_dir: gcs_log_dir, product: product
        end
def new_rake_task name , args : [ ] , env_args : [ ] , service : nil , config_path : nil , version : nil , timeout : nil , project : nil , wrapper_image : nil , strategy : nil , gcs_log_dir : nil , product : nil escaped_args = args . map do | arg | arg . gsub ( / [, \[ \] ] / ) { | m | "\\#{m}" } end name_with_args = if escaped_args . empty? name else "#{name}[#{escaped_args.join ','}]" end new [ "bundle" , "exec" , "rake" , name_with_args ] + env_args , service : service , config_path : config_path , version : version , timeout : timeout , project : project , wrapper_image : wrapper_image , strategy : strategy , gcs_log_dir : gcs_log_dir , product : product end
Create an execution for a rake task.
Create an execution for a rake task .
name
Name of the task
Name of the task
args
Args to pass to the task
Args to pass to the task
env_args
Environment variable settings, each of the form `NAME=value`.
Environment variable settings each of the form ` NAME = value ` .
service
Name of the service. If omitted, obtains the service name from the config file.
Name of the service . If omitted obtains the service name from the config file .
config_path
App Engine config file to get the service name from if the service name is not provided directly. If omitted, defaults to the value returned by {Google::Serverless::Exec.default_config_path}.
App Engine config file to get the service name from if the service name is not provided directly . If omitted defaults to the value returned by { Google :: Serverless :: Exec . default_config_path } .
the value returned by {Google::Serverless::Exec.default_config_path}
version
Version string. If omitted, defaults to the most recently created version of the given service (which may not be the one currently receiving traffic).
Version string . If omitted defaults to the most recently created version of the given service ( which may not be the one currently receiving traffic ) .
the most recently created version of the given service (which may not be the one currently receiving traffic)
timeout
Timeout string. If omitted, defaults to the value returned by {Google::Serverless::Exec.default_timeout}.
Timeout string . If omitted defaults to the value returned by { Google :: Serverless :: Exec . default_timeout } .
the value returned by {Google::Serverless::Exec.default_timeout}
project
wrapper_image
The fully qualified name of the wrapper image to use. (Applies only to the "cloud_build" strategy.)
The fully qualified name of the wrapper image to use . ( Applies only to the " cloud_build " strategy . )
strategy
The execution strategy to use, or `nil` to choose a default based on the App Engine (flexible or standard) or Cloud Run environments. Allowed values are `nil`, `"deployment"` (which is the default for App Engine Standard), and `"cloud_build"` (which is the default for App Engine Flexible and Cloud Run).
The execution strategy to use or ` nil ` to choose a default based on the App Engine ( flexible or standard ) or Cloud Run environments . Allowed values are ` nil ` ` " deployment " ` ( which is the default for App Engine Standard ) and ` " cloud_build " ` ( which is the default for App Engine Flexible and Cloud Run ) .
gcs_log_dir
GCS bucket name of the cloud build log when strategy is "cloud_build". (ex. "gs://BUCKET-NAME/FOLDER-NAME")
GCS bucket name of the cloud build log when strategy is " cloud_build " . ( ex . " gs : // BUCKET - NAME / FOLDER - NAME " )
product
The serverless product to use. If omitted, defaults to the value returned by {Google::Serverless::Exec#default_product}
The serverless product to use . If omitted defaults to the value returned by { Google :: Serverless :: Exec#default_product }
the value returned by {Google::Serverless::Exec#default_product}