Skip to content

GraphQL: Expose executor field in CiRunner

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR exposes the new executor_type Ci::Runner enum model field in the corresponding GraphQL type as a string type field (executorName). The executor_type field has been introduced in !76368 (merged).

The new field is added behind a new FF graphql_ci_runner_executor so that we can still change this to an enum value if needed based on frontend input. cc @mrincon

Screenshots or screen recordings

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

2021-12-20_at_15.07

How to set up and validate locally

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

NOTE: This MR is based on !76368 (merged) which contains a database migration, so you'll need to run bin/rails db:migrate RAILS_ENV=development to add the field to the table.

Assuming you have a GitLab Runner already registered with your GDK, you can open the Rails console (rails c) and manually set the executor_type value of the latest runner:

# Register a gitlab-runner if none is yet registered
gitlab-runner register \
        --non-interactive \
        --executor "shell" \
        --url "http://gdk.test:3000/" \
        --description="test runner" \
        --tag-list "shell,gdk,mac,test" \
        --run-untagged="false" \
        --locked="false" \
        --access-level="not_protected" \
        --registration-token="${YOUR_TOKEN}"
# Update the runner executor type
Ci::Runner.last.update!(executor_type: :docker_ssh_machine)

Feature.enable :graphql_ci_runner_executor

and then query for it in GraphiQL (e.g. http://gdk.test:3000/-/graphql-explorer):

query getRunners {
  runners(last:1, sort:CREATED_ASC) {
    nodes {
      id
      description
      shortSha
      contactedAt
      executorName
    }
  }
}

The expected result is a node containing "executorName": "docker-ssh+machine".

MR acceptance checklist

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

Closes #345361 (closed)

Edited by Pedro Pombeiro

Merge request reports