This topic describes how to use a pipeline job of Alibaba Cloud DevOps Flow to build online debugging for troubleshooting.
Enable the Debug mode
To enable the Debug mode, go to the Edit page of the pipeline and select Specify Container Environment as the build environment. Only jobs running in the specified container environment support enabling the Debug mode. In the Advanced Settings section, turn on Enable Debug mode. After the Debug mode is enabled, the build environment is retained for a period of time after the job is complete. You can log on to the environment to perform debugging.
The build environment supports two retention policies:
Keep the build environment only when the job fails: The environment is retained only when the job fails. The environment is not retained if the job is executed successfully or only the red line checkpoint fails the check.
Keep the build environment regardless of whether the job is executed successfully: The build environment is retained, regardless of whether the job is executed successfully. If you do not need to retain the environment, you can release the environment from the run log card.
You can set the retention period of the build environment in minutes. When the retention period expires, the environment is automatically revoked.

The Debug mode can be enabled only for jobs running in the specified container environment. If your job runs in the default environment, you must edit the pipeline to add the job again from the job list (Specify Container Environment is selected for new jobs by default). You only need to modify the relevant SDK version or command script when you add a job.
After the Debug mode is enabled, the retention period of the build environment is included in the core-minutes statistics of organization pipeline job build. The pay-as-you-go billing method is used. For more information, see Build resource usage.
Log on to the environment in debugging mode
After the Debug mode is enabled and a job is complete, click Debugging on the job card to log on to the build environment.

In the environment, run commands on the command-line interface (CLI) to perform operations such as viewing logs to help troubleshoot or debug build issues. The logon window supports the Full Screen and Open in New Window modes. If you choose to open the logon window in a new window, a new connection is established.

Release the build environment
If you no longer require the build environment, you can use one of the following methods to release the environment. Once the environment is released, it cannot be accessed again.
Wait until the Build Environment Retention Period exipires so that the environment is automatically released.
Click Destroy the build environment now on the job card to manually release the environment.
After the debugging, click Log out and destroy the build environment in the logon window.

