Jika Anda membuat fungsi baru, lihat Panduan Memulai Konsol di Cloud Run. Konten di halaman ini hanya berlaku untuk fungsi lama yang sudah ada yang dibuat dengan Cloud Functions v1 API.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Runtime Ruby
Ringkasan
Fungsi Cloud Run Anda berjalan di lingkungan yang terdiri dari versi sistem operasi plus paket add-on, dukungan bahasa, dan library Functions Framework yang mendukung dan memanggil fungsi Anda.
Lingkungan ini diidentifikasi berdasarkan versi bahasa, dan dikenal sebagai runtime.
Untuk informasi tentang runtime secara umum, dan untuk mempelajari versi Ubuntu yang digunakan setiap runtime Ruby, lihat lingkungan eksekusi fungsi Cloud Run.
Memilih runtime Anda
Fungsi Cloud Run mendukung beberapa versi Ruby, yang tercantum di halaman Dukungan runtime. Anda dapat memilih runtime Ruby yang diinginkan untuk fungsi Anda selama deployment.
gcloud
Jika Anda menggunakan Google Cloud CLI, tentukan runtime
menggunakan parameter --runtime. NAME menentukan
nama fungsi. Contoh:
Agar fungsi Cloud Run dapat menemukan definisi fungsi Anda, kode sumber harus mengikuti struktur tertentu. Lihat artikel Menulis fungsi Cloud Run untuk mengetahui informasi selengkapnya.
Persiapan fungsi
Anda dapat menyiapkan fungsi langsung dari konsol Google Cloud atau menulisnya di komputer lokal, lalu menguploadnya. Guna menyiapkan mesin lokal untuk pengembangan Ruby, lihat Menyiapkan lingkungan pengembangan Ruby.
Library yang memanggil fungsi Anda adalah Framework Fungsi Ruby.
Menentukan dependensi
Anda dapat menentukan dependensi untuk fungsi Anda dengan menambahkannya ke file project.
Untuk informasi selengkapnya, lihat Menentukan dependensi di
Ruby.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-05 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."]]