Store Runner semver value on version update
What does this MR do and why?
Describe in detail what your merge request does and why.
This MR is part of a sequence of MRs that will ultimately result in being able to efficiently count the number of out-of-date CI runners in a given scope (instance/namespace/project). Please refer to the table below for more details:
Sequence | MR | notes |
---|---|---|
1 | semver version text column (major.minor.patch) on top of the existing ci_runners.version column. |
|
2 |
Store Runner semver value on version update (!89024 - merged) | Ensures that semver column is kept up-to-date based on version value. |
3 | Backfill runner semver column (!89054 - merged) | Adds batched background migration to backfill semver column from version values. |
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
gitlab-runner register
Registering new runner with $ gitlab-runner register -config ~/.gitlab-runner/config.gdk.toml \
--executor "shell" \
--url "http://gdk.test:3000/" \
--description "Project test runner" \
--tag-list "shell,mac,gdk,test" \
--run-untagged="false" \
--locked="false" \
--access-level="not_protected" --non-interactive \
--registration-token="$REGISTRATION_TOKEN"
Runtime platform arch=arm64 os=darwin pid=69344 revision=d0c550e3 version=14.11.0~beta.29.gd0c550e3
WARNING: Running in user-mode.
WARNING: Use sudo for system-mode:
WARNING: $ sudo gitlab-runner...
Registering runner... succeeded runner=GR1348941cP2Uu5f_
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
GDK log contains a clean semver value:
Ci::Runner Create (7.2ms) INSERT INTO "ci_runners" ("created_at", "updated_at", "description", "name", "version", "revision", "platform", "architecture", "run_untagged", "ip_address", "runner_type", "token_encrypted", "semver") VALUES ('2022-06-03 09:12:30.649527', '2022-06-03 09:12:30.649527', 'Project test runner', 'gitlab-runner', '14.11.0~beta.29.gd0c550e3', 'd0c550e3', 'darwin', 'arm64', FALSE, '127.0.0.1', 3, 'pzNKVJfsBoebzaS8yEXFKQ+p99rMf/zOEOMvzm/0AZ248u45', '14.11.0') RETURNING "id" /*application:web,correlation_id:01G4MDCMWCRXJDBPA4E8SPDQFR,endpoint_id:POST /api/:version/runners,db_config_name:ci,line:/app/services/ci/runners/register_runner_service.rb:11:in `execute'*/
↳ app/services/ci/runners/register_runner_service.rb:11:in `execute'
GDK PostgreSQL console shows the field correctly filled:
gitlabhq_development> \c gitlabhq_development_ci
gitlabhq_development_ci> SELECT id, created_at, version, semver FROM ci_runners WHERE version IS NOT NULL ORDER BY id desc LIMIT 1
+------+----------------------------+---------------------------+---------------+
| id | created_at | version | semver |
|------+----------------------------+---------------------------+---------------+
| 1207 | 2022-06-03 09:12:30.649527 | 14.11.0~beta.29.gd0c550e3 | 14.11.0 |
+------+----------------------------+---------------------------+---------------+
SELECT 1
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.
Part of #339523 (closed)
Edited by Pedro Pombeiro