Skip to content

Capture job executor value in ci_runners table

What does this MR do and why?

Describe in detail what your merge request does and why.

bin/rails db:migrate RAILS_ENV=development
== 20211208111425 AddExecutorTypeColumnToCiRunners: migrating =================
-- add_column(:ci_runners, :executor_type, :smallint, {:null=>true})
   -> 0.0036s
== 20211208111425 AddExecutorTypeColumnToCiRunners: migrated (0.0037s) ========
bin/rails db:rollback RAILS_ENV=development
== 20211208111425 AddExecutorTypeColumnToCiRunners: reverting =====================
-- remove_column(:ci_runners, :executor_type, :smallint, {:null=>true})
   -> 0.0023s
== 20211208111425 AddExecutorTypeColumnToCiRunners: reverted (0.0045s) ============

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

image

The second query shows the ci_runners record after being populated by the /jobs/request endpoint hit by the GitLab Runner.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Run migration: bin/rails db:migrate RAILS_ENV=development

  2. Register a runner against the local GDK:

    gitlab-runner register -config /tmp/config.gdk.toml \
            --non-interactive \
            --executor "shell" \
            --url "http://gdk.localhost:3000/" \
            --description "Gitlab Org test runner" \
            --tag-list "shell,gdk,mac,test" \
            --run-untagged="false" \
            --locked="false" \
            --access-level="not_protected" \
            --registration-token="$GITLAB_TOKEN"
  3. Start the runner:

    gitlab-runner run -config /tmp/config.gdk.toml
  4. Open a Rails console: rails c

  5. Query for the executor on the last-registered runner:

    Ci::Runner.select(:id, :executor_type).last

    Expected result: 2021-12-08_at_17.53

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Part of #345361 (closed)

Edited by Pedro Pombeiro

Merge request reports