diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 11150e839a35dc5a2f8815098afacb819ed4077c..745ecf6fc08aeecc598bf4488290f6dc53b22a27 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -200,7 +200,7 @@ class Runner < Ci::ApplicationRecord validates :config, json_schema: { filename: 'ci_runner_config' } - validates :maintenance_note, length: { maximum: 255 } + validates :maintenance_note, length: { maximum: 1024 } alias_attribute :maintenance_note, :maintainer_note diff --git a/db/migrate/20220221102333_change_maintenance_note_limit_in_ci_runner.rb db/migrate/20220221102333_change_maintainer_note_limit_in_ci_runner.rb b/db/migrate/20220221102333_change_maintenance_note_limit_in_ci_runner.rb db/migrate/20220221102333_change_maintainer_note_limit_in_ci_runner.rb new file mode 100644 index 0000000000000000000000000000000000000000..98930691b3b35f906364c16b11d41e548eb91372 --- /dev/null +++ b/db/migrate/20220221102333_change_maintenance_note_limit_in_ci_runner.rb db/migrate/20220221102333_change_maintainer_note_limit_in_ci_runner.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class ChangeMaintainerNoteLimitInCiRunner < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + def up + add_text_limit :ci_runners, :maintainer_note, 1024, constraint_name: check_constraint_name(:ci_runners, :maintainer_note, 'max_length_1MB') + remove_text_limit :ci_runners, :maintainer_note, constraint_name: check_constraint_name(:ci_runners, :maintainer_note, 'max_length') + end + + def down + # no-op: Danger of failing if there are records with length(maintainer_note) > 255 + end +end diff --git a/db/schema_migrations/20220221102333 b/db/schema_migrations/20220221102333 new file mode 100644 index 0000000000000000000000000000000000000000..dfc13fd28a0dc911b3834019208aff56652a13ce --- /dev/null +++ b/db/schema_migrations/20220221102333 @@ -0,0 +1 @@ +7aa2cf28363e914ad83c61d45321f701a68111122c75abeb54430c4035d56677 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index e54bf96f88726c724b00cd477ff9c2d4625153c7..e606742cf576c62fcdca6e45be655a3877e70f34 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -12400,7 +12400,7 @@ CREATE TABLE ci_runners ( executor_type smallint, maintainer_note text, token_expires_at timestamp with time zone, - CONSTRAINT check_56f5ea8804 CHECK ((char_length(maintainer_note) <= 255)) + CONSTRAINT check_ce275cee06 CHECK ((char_length(maintainer_note) <= 1024)) ); CREATE SEQUENCE ci_runners_id_seq diff --git a/doc/api/runners.md b/doc/api/runners.md index 3423a02c0782858a19f6fbd0a1e2bb5df1af4174..393236cd42526c8928115b298c84de3a05b72e1f 100644 --- a/doc/api/runners.md +++ b/doc/api/runners.md @@ -660,7 +660,7 @@ POST /runners | `access_level` | string | no | The access_level of the runner; `not_protected` or `ref_protected` | | `maximum_timeout` | integer | no | Maximum timeout set when this runner handles the job | | `maintainer_note` | string | no | [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/350730), see `maintenance_note` | -| `maintenance_note` | string | no | Free-form maintenance notes for the runner (255 characters) | +| `maintenance_note` | string | no | Free-form maintenance notes for the runner (1024 characters) | ```shell curl --request POST "https://gitlab.example.com/api/v4/runners" \