Skip to content

Properly fail a CI build with invalid session parameters

Stan Hu requested to merge sh-runner-handle-invalid-sesssion into master

If a CI runner sent an invalid URL for session, the build would fail with a confusing StateMachines::InvalidTransition and a 409 Conflict error. However, no conflict was actually present.

This happened because a bad URL would cause this error:

(byebug) build.drop!(:session_invalid)
*** StateMachines::InvalidTransition Exception: Cannot transition status via :drop from :pending (Reason(s): Runner session url is blocked: Only allowed schemes are https)

As a result, the server was conflating validation errors with state transition errors.

We now validate the runner session and handle it as a 400 Bad Request.

Relates to gitlab-runner#4360 (closed)

Edited by Stan Hu

Merge request reports