Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
El entorno de ejecución de Ruby
Descripción general
Tu función de Cloud Run Functions se ejecuta en un entorno que consta de una versión del sistema operativo, además de paquetes de complementos, compatibilidad con lenguajes y la biblioteca de Functions Framework que admite e invoca la función.
Este entorno se identifica mediante la versión del lenguaje y se conoce como el entorno de ejecución.
Para obtener información sobre los entornos de ejecución en general y saber qué versión de Ubuntu usa cada entorno de ejecución de Ruby, consulta el entorno de ejecución de Cloud Run Functions.
Selecciona tu entorno de ejecución
Cloud Run Functions admite varias versiones de Ruby, que se enumeran en la
página Compatibilidad con el entorno de ejecución. Puedes
seleccionar el entorno de ejecución de Ruby que prefieras para tu función durante la implementación.
gcloud
Si usas Google Cloud CLI, especifica el entorno de ejecución mediante el parámetro --runtime. NAME especifica el nombre de la función. Por ejemplo:
Para que Cloud Run Functions encuentre la definición de tu función, tu código fuente debe seguir una estructura específica. Consulta Escribe funciones de Cloud Run para obtener más información.
Preparación de funciones
Puedes preparar una función directamente desde la consola de Google Cloud o escribirla en tu máquina local y subirla. Si deseas preparar tu máquina local para el desarrollo de Ruby, consulta Configura un entorno de desarrollo de Ruby.
La biblioteca que invoca tu función es el Functions Framework para Ruby.
Especifica dependencias
Puedes especificar dependencias para tu función si las agregas a un archivo de proyecto.
Para obtener más información, consulta Especifica dependencias en Ruby.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-04-23 (UTC)"],[[["\u003cp\u003eCloud Run functions utilize a runtime environment that includes the operating system, language support, and the Functions Framework library, with the specific environment determined by the selected Ruby version.\u003c/p\u003e\n"],["\u003cp\u003eYou can choose from several supported Ruby runtimes when deploying your Cloud Run function, with the available versions listed on the Runtime support page.\u003c/p\u003e\n"],["\u003cp\u003eWhen using the Google Cloud CLI, the \u003ccode\u003e--runtime\u003c/code\u003e parameter allows you to specify the desired Ruby runtime for your function during deployment.\u003c/p\u003e\n"],["\u003cp\u003eCloud Run functions require a specific source code structure for the system to locate your function's definition; therefore, it's imperative to follow the guidance given in the Writing Cloud Run functions documentation.\u003c/p\u003e\n"],["\u003cp\u003eRuby supports only CloudEvent functions as event-driven function types, and you can manage dependencies for your function by adding them to a designated project file, as detailed in the Specifying dependencies in Ruby guide.\u003c/p\u003e\n"]]],[],null,["# The Ruby Runtime\n================\n\nOverview\n--------\n\nYour Cloud Run function runs in an environment consisting of an operating\nsystem version plus add-on packages, language support, and\nthe Functions Framework library that supports and invokes your function.\nThis environment is identified by the language version, and is known as the\nruntime.\n\nFor information about runtimes in general, and to learn which Ubuntu version\neach Ruby runtime uses, see the [Cloud Run functions execution\nenvironment](/functions/1stgendocs/concepts/execution-environment#ruby).\n\nSelect your runtime\n-------------------\n\nCloud Run functions supports several versions of Ruby, listed on the\n[Runtime support](/functions/1stgendocs/runtime-support#ruby) page. You can\nselect the preferred Ruby runtime for your function during deployment. \n\n### gcloud\n\nIf you're using the Google Cloud CLI, specify the runtime\nby using the `--runtime` parameter. \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e specifies the\nfunction name. For example: \n\n```bash\ngcloud functions deploy NAME --no-gen2 --runtime ruby33 --trigger-http\n```\n\nFor more deployment parameters, see [Deploy a Cloud Run function](/functions/1stgendocs/deploy#basics).\n\n### Console\n\nIf you're using the Google Cloud console, see the [Google Cloud console\nquickstart](/functions/1stgendocs/console-quickstart-1st-gen) for detailed instructions.\n\nSource code structure\n---------------------\n\nFor Cloud Run functions to find your function's definition, your\nsource code must follow a specific structure. See\n[Writing Cloud Run functions](/functions/1stgendocs/writing#structuring_source_code)\nfor more information.\n\nFunction preparation\n--------------------\n\nYou can prepare a function directly from the Google Cloud console or write it on\nyour local machine and upload it. To prepare your local machine for Ruby\ndevelopment, see [Setting up a Ruby development environment](/ruby/docs/setup).\nThe library that invokes your function is the\n[Ruby Functions Framework](/functions/1stgendocs/functions-framework).\n| **Note:** The only type of [event-driven functions](/functions/1stgendocs/writing#types_of_cloud_functions) Ruby supports are [CloudEvent functions](/functions/1stgendocs/writing#cloudevent_functions).\n\nSpecifying dependencies\n-----------------------\n\nYou can specify dependencies for your function by adding them to a project file.\nFor more information, see [Specifying dependencies in\nRuby](/functions/1stgendocs/writing/specifying-dependencies-ruby).\n\nWhat's next\n-----------\n\n- [Create your first Ruby function](/functions/1stgendocs/create-deploy-http-ruby-1st-gen) from scratch."]]