do not support null on workspaces_agent_config_version after 17.5

MR - Remove support for nil in workspaces_agent_conf... (!170223 - merged)

Description

Following the comment here, we will need to remove the support on nil workspaces_agent_config_version on workspaces table.

raise of RuntimeError, and an error message which says something like this:

'#workspaces_agent_config' cannot be called until '#workspaces_agent_config_version' is set by the 'before_validation' hook. To automatically set it, call 'workspace.valid?', which will call '#set_workspaces_agent_config_version'.

We also would like to uncomment the validation on workspaces_agent_config_version after 17.5

    # TODO: uncomment this line with below issue in 17.6
    # https://gitlab.com/gitlab-org/gitlab/-/issues/493992
    # validates :workspaces_agent_config_version, presence: true, if: -> { agent&.workspaces_agent_config }

Acceptance Criteria

  • check prod data and make sure no workspace has nil as agent config version
  • Update the code to raise runtime error if nil
  • uncomment validation on workspaces_agent_config_version
  • add/update unit testing

Technical Requirements

NA

Design Requirements

NA

Impact Assessment

NA

User Story

NA

Edited Oct 23, 2024 by zli
Assignee Loading
Time tracking Loading