Diagnose Job Execution with Web Terminal
Sometimes, when a job is running, things don’t go as you would expect, and it would be helpful if one can have a shell to aid debugging. This tutorial demonstrates how to achieve it with pause command and web terminal introduced since 9.0
Request a Trial Subscription
Web terminal requires a subscription to use. Switch to menu item Administration / Subscription Management, request a trial subscription key and install it into OneDev if you do not have an active subscription:
Enable Shell Access for Executor
Site administrator can always open web termimnal for running jobs. For project managers without site administration permission, you will need to enable shell access for relevant executors like below:
User can do harm with shell access. Make sure that executor with this enabled can only be used by trust jobs via job requirement setting in a production environment.
Open Web Terminal for Running Job
Now when a job runs with shell access enabled executor, project managers will be able to open the interactive shell to check the live environment. This works for all executor types.
Add Pause Instruction to Command Step
Often you need to pause execution of the job so that you can easily check live environment at particular point. For CI jobs executing command step, you can do so by inserting pause instruction like below:
echo "before pause"
@pause@
echo "after pause"
Run the job and the step will pause at the desired point:
After finishing analyzing, you may resume the job by clicking the resume link, or just cancel the job if you do not want it to execute anymore.