User Job Cancellation Calls Cancel API
This merge request improves how GitLab Runner handles job cancellation when using the step-runner execution mode. Previously, when users cancelled a running job, it would terminate abruptly without allowing cleanup tasks like uploading artifacts or cache to complete.
The changes introduce a "graceful cancellation" mechanism that allows the step-runner to receive the cancellation signal and run its cleanup phases before fully stopping. This ensures that important job artifacts and cache data are properly saved even when a job is cancelled.
The implementation adds a new callback system that connects the GitLab Runner's cancellation handling to the step-runner's built-in graceful shutdown process. When a user cancels a job, instead of immediately killing the process, the system now sends a cancellation request to the step-runner, which then completes its cleanup work before exiting with a "cancelled" status.
Additional improvements include better error handling for cancelled jobs (they now properly show as "JobCanceled" instead of unknown failures) and enhanced testing to ensure the cancellation flow works correctly. The changes also include some minor code organization improvements, like grouping type definitions and updating dependency versions.