Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Cloud Code memungkinkan Anda menerapkan perubahan dengan cepat pada aplikasi selama
sesi pengembangan atau debug untuk mendapatkan loop masukan yang lebih cepat. Dengan begitu, Anda dapat menjalankan sesi Kubernetes dan Cloud Run yang diemulasi dalam mode tonton.
Setelan untuk konfigurasi Kubernetes dan Cloud Run
Anda dapat mengonfigurasi mode tonton di konfigurasi Cloud Code Kubernetes dan Cloud Run di Run > Edit configurations di tab Run:
Mode tonton
Deskripsi
On demand
Nilai default untuk konfigurasi run baru.
Cloud Code hanya membangun ulang dan men-deploy ulang aplikasi Anda saat dipicu. Untuk memicu mode Sesuai permintaan, klik Trigger Build and Deploy atau tekan Option+Cmd+Comma di Mac OS atau Ctrl+Alt+Comma di Windows (binding tombol default).
Membangun ulang dan men-deploy ulang aplikasi Anda setelah Anda menyimpan perubahan apa pun.
Opsi ini tidak tersedia dalam mode debug.
Menyesuaikan keymap Trigger Build and Deploy
Binding tombol default untuk Trigger Build and Deploy adalah:
Mac OS: Option+Cmd+Comma
Windows: Ctrl+Alt+Comma
Untuk mengubah binding tombol default:
Buka Preferensi > Keymap.
Di kotak penelusuran Keymap, masukkan "trigger build and deploy".
Klik kanan hasil penelusuran Trigger Build and Deploy, lalu pilih Add Keyboard Shortcut.
Masukkan kombinasi pintasan yang Anda inginkan (misalnya, Shift+R), lalu klik Oke, kemudian klik Oke di jendela Preferensi. Tindakan ini akan menambahkan pengikatan tombol baru Anda ke fungsi Trigger Build and Deploy, sehingga pengikatan tombol default dan yang baru akan berfungsi.
Anda juga dapat menghapus pengikatan tombol default dengan mengklik kanan hasil penelusuran Trigger Build and Deploy dan memilih opsi Remove.
Menerapkan perubahan saat melakukan proses debug
Dengan Cloud Code, Anda dapat men-debug aplikasi sambil membuat perubahan pada, dan
melakukan iterasi pada, kode sumber. Fitur ini tersedia untuk pengembangan Kubernetes dan pengembangan lokal Cloud Run.
Untuk menerapkan perubahan pada kode saat men-debug, lakukan hal berikut:
Pastikan mode Sesuai permintaan diaktifkan di Run > Edit Configurations (opsi default).
Luncurkan konfigurasi run dalam mode debug dengan mengklik Debug.
Kasus penggunaan umum
Bagian ini menguraikan skenario umum tentang cara men-debug dengan mode lihat diaktifkan di IDE Anda.
Melakukan proses debug aplikasi Kubernetes dengan mode lihat diaktifkan
Anda adalah developer yang membangun aplikasi yang berjalan di Kubernetes, dan menggunakan Cloud Code untuk melakukan iterasi pada aplikasi Anda. Anda menemukan bug dalam kode Anda.
Anda meluncurkan konfigurasi Develop on Kubernetes, dan:
Pilih Sesuai permintaan untuk membangun ulang dan men-deploy ulang aplikasi.
Luncurkan konfigurasi run dalam mode debug dengan mengklik Debug.
Anda menetapkan titik henti sementara di dekat bug yang diperkirakan, meluncurkan aplikasi, dan menggunakan debugger untuk mencari tahu apa itu bug.
Anda memperbaiki bug saat sesi pengembangan masih berjalan (debugger masih terlampir). Sekarang Anda ingin mengonfirmasi bahwa masalah telah diperbaiki.
Anda memicu mode Sesuai permintaan yang memberi tahu Cloud Code dan Skaffold untuk membangun ulang dan men-deploy ulang aplikasi, dengan mengklik Trigger Build and Deploy atau menekan Option+Cmd+Comma di Mac OS atau Ctrl+Alt+Comma di Windows (binding tombol default).
Notifikasi akan muncul dan meminta Anda mengonfirmasi: "Menerapkan kembali perubahan akan menyebabkan debugger dihentikan dan dilampirkan kembali, sehingga berpotensi menghilangkan status debug saat ini". Anda memiliki opsi untuk membatalkan, melanjutkan, atau tidak pernah diberi tahu lagi.
Setelah mengklik continue:
Debugger dihentikan
Aplikasi dibangun ulang dan di-deploy ulang
Debugger dilampirkan kembali
Sekarang Anda dapat memverifikasi perubahan dan men-debug lagi sesuai kebutuhan.
Mendapatkan dukungan
Untuk mengirimkan masukan atau melaporkan masalah di IDE IntelliJ, buka
Tools > Cloud Code > Help / About > Submit
feedback or report an issue untuk melaporkan masalah di GitHub.
[[["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-08-11 UTC."],[[["\u003cp\u003eCloud Code's watch mode allows for rapid application changes during development or debugging, offering a faster feedback loop in Kubernetes and emulated Cloud Run sessions.\u003c/p\u003e\n"],["\u003cp\u003eWatch mode can be set to "On demand," where manual triggering is required via the "Trigger Build and Deploy" button or specified keyboard shortcuts, or "On file save" for automatic rebuilds and redeploys when changes are saved, though the latter is unavailable in debug mode.\u003c/p\u003e\n"],["\u003cp\u003eThe "Trigger Build and Deploy" function, which defaults to \u003ccode\u003eOption+Cmd+Comma\u003c/code\u003e on Mac OS and \u003ccode\u003eCtrl+Alt+Comma\u003c/code\u003e on Windows, can have custom key bindings configured in the IDE's Keymap settings.\u003c/p\u003e\n"],["\u003cp\u003eWhen debugging with "On demand" mode, triggering a rebuild and redeploy will terminate and reattach the debugger, and a prompt will appear to confirm this action before proceeding.\u003c/p\u003e\n"],["\u003cp\u003eUsing watch mode, a developer can fix a bug during a debug session, trigger a rebuild and redeployment, then reattach the debugger to verify changes without restarting the application manually.\u003c/p\u003e\n"]]],[],null,["# Watch modes in Cloud Code for IntelliJ\n\nCloud Code allows you to quickly apply changes to your application during\na development or debug session for a faster feedback loop. This lets you run your Kubernetes and\nemulated Cloud Run sessions in *watch mode*.\n\nTo learn more about how deployment works, please see the\n[Skaffold documentation.](https://skaffold.dev/docs/workflows/dev/#file-watcher-and-watch-modes)\n\nSettings for Kubernetes and Cloud Run configurations\n----------------------------------------------------\n\nYou can configure watch mode in the Cloud Code Kubernetes and Cloud Run configurations at **Run** \\\u003e **Edit configurations** on the **Run** tab:\n\n### Customizing the Trigger Build and Deploy keymap\n\nThe default key bindings for **Trigger Build and Deploy** are:\n\n- Mac OS: `Option+Cmd+Comma`\n- Windows: `Ctrl+Alt+Comma`\n\nTo change the default key bindings:\n\n1. Navigate to **Preferences** \\\u003e **Keymap**.\n2. In the Keymap search bar, enter \"trigger build and deploy\".\n3. Right-click the Trigger Build and Deploy search result and select **Add Keyboard Shortcut**.\n4. Enter shortcut combination you prefer (for example, `Shift+R`) and click **OK** , then click **OK** in the Preferences window. This adds your new key binding to the Trigger Build and Deploy function, so that both the default and your new key binding will work.\n5. You can also remove the default key binding by right-clicking the Trigger Build and Deploy search result and selecting the **Remove** option.\n\nApplying changes while debugging\n--------------------------------\n\nWith Cloud Code, you can debug an application while making changes to, and\niterating on, source code. This is available for Kubernetes development and Cloud Run local\ndevelopment.\n| **Note:** Certain runtimes support other modes of live updating; for example, Java and HotSwap over JDWP. HotSwap, while limited by the types of changes supported, maintains your debugger state. This design, which operates over [Skaffold](/skaffold) debug, assumes the debugger will be destroyed and reattached on change. These other modes of updating code will continue to be supported independently.\n\nTo apply changes to your code while debugging, perform the following:\n\n1. Ensure On-demand mode is enabled in **Run** \\\u003e **Edit Configurations** (the default option).\n2. Launch the run configuration in debug mode by clicking **Debug**.\n\n### Common use case\n\nThis section outlines a common scenario of how you can debug with watch mode enabled in your IDE.\n\n\n#### Debugging a Kubernetes application with watch mode enabled\n\nYou're a developer building an application that runs on Kubernetes, and use Cloud Code to iterate on your app. You discovered a bug in your code.\n\n1. You launch the Develop on Kubernetes run configuration, and:\n 1. Select **On demand** to rebuild and redeploy the app.\n 2. Launch the run configuration in debug mode by clicking **Debug**.\n2. You set a breakpoint near the expected bug, launch the app, and use the debugger to figure out what the bug is.\n3. You fix the bug while the development session is still running (the debugger is still attached). You now want to confirm that the issue is fixed.\n4. You trigger On-demand mode which tells Cloud Code and [Skaffold](/skaffold) to rebuild and redeploy the application, by clicking **Trigger Build and Deploy** or pressing `Option+Cmd+Comma` on Mac OS or `Ctrl+Alt+Comma` on Windows (the default key bindings).\n5. A notification appears and asks you to confirm: \"Redeploying your changes will cause the debugger to be stopped and reattached, potentially losing your current debug state\". You have the option to either cancel, continue, or to never be notified again.\n6. After clicking **continue**:\n - The debugger is terminated\n - The application is rebuilt and redeployed\n - The debugger is reattached\n7. You can now verify the changes and debug again as needed.\n\nGet support\n-----------\n\nTo submit feedback or report an issue in your IntelliJ IDE, go to **Tools** \\\u003e **Cloud Code** \\\u003e **Help / About** \\\u003e **Submit\nfeedback or report an issue** to report an issue on [GitHub](https://github.com/GoogleCloudPlatform/cloud-code-intellij/issues)."]]