Add name field to Cluster Agent Token
What does this MR do?
- Add name field Clusters::AgentToken model. This field is now required when creating new tokens. We currently have tokens in the database with
null
names so it's not required for old tokens. There is a follow-up issue to address old tokens. - Update GraphQL to include new name field in queries and
create
mutation - Update associated docs and tests
Screenshots (strongly suggested)
Migrations
migrate
== 20210224133337 AddNameFieldToClusterAgentToken: migrating ==================
-- add_column(:cluster_agent_tokens, :name, :text)
-> 0.0022s
== 20210224133337 AddNameFieldToClusterAgentToken: migrated (0.0022s) =========
== 20210225135533 LimitClusterTokenSize: migrating ============================
-- transaction_open?()
-> 0.0000s
-- current_schema()
-> 0.0002s
-- execute("ALTER TABLE cluster_agent_tokens\nADD CONSTRAINT check_2b79dbb315\nCHECK ( char_length(name) <= 255 )\nNOT VALID;\n")
-> 0.0010s
-- current_schema()
-> 0.0002s
-- execute("SET statement_timeout TO 0")
-> 0.0005s
-- execute("ALTER TABLE cluster_agent_tokens VALIDATE CONSTRAINT check_2b79dbb315;")
-> 0.0010s
-- execute("RESET ALL")
-> 0.0006s
== 20210225135533 LimitClusterTokenSize: migrated (0.0119s) ===================
rollback
== 20210225135533 LimitClusterTokenSize: reverting ============================
-- execute("ALTER TABLE cluster_agent_tokens\nDROP CONSTRAINT IF EXISTS check_2b79dbb315\n")
-> 0.0011s
== 20210225135533 LimitClusterTokenSize: reverted (0.0062s) ===================
== 20210224133337 AddNameFieldToClusterAgentToken: reverting ==================
-- remove_column(:cluster_agent_tokens, :name, :text)
-> 0.0025s
== 20210224133337 AddNameFieldToClusterAgentToken: reverted (0.0043s) =========
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Emily Ring