Ignore runner token prefix in short_sha
What does this MR do and why?
Describe in detail what your merge request does and why.
This MR fixes a behavior introduced in this milestone in Implement support for runner token prefix (!110275 - merged) for Add support for optional runner authentication ... (#383198 - closed). In that MR we introduced a token prefix, but given that short_sha
is computed from the first 9 characters of the token, we need to ignore the prefix if it is present.
NOTE: I haven't added a changelog trailer since the functionality is not released yet.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
[16] pry(main)> Ci::Runner.find(10001).short_sha
Ci::Runner Load (3.1ms) SELECT "ci_runners".* FROM "ci_runners" WHERE "ci_runners"."id" = 10001 LIMIT 1
=> "glrt-t9W"
[17] pry(main)> reload! # load the code from this MR
[18] pry(main)> Ci::Runner.find(10001).short_sha
Ci::Runner Load (1.2ms) SELECT "ci_runners".* FROM "ci_runners" WHERE "ci_runners"."id" = 10001 LIMIT 1
=> "t9Wkyj-HG" # the prefix is no longer returned in the short sha
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.