Skip to content

Add regex fields to the container expiration policy update mutation

What does this MR do?

In !32944 (merged), a GraphQL update mutation for container expiration policies was added.

It was later find out that two input fields were missing (#196784 (comment 357409416)): name_regex and name_regex_keep. #220789 (closed) has been created to deal with this.

This MR adds them as input fields.

Design choices

  • Note that in !34063 (merged), we added validation at the model level so that a container expiration policy can't be saved.
  • We could just add the two missing input fields and let the model go 💥 when an invalid regex is passed
  • We can also do a much better thing (implemented in this MR)
  • The result is that the code flow doesn't execute the #resolve function of the mutation. The parameters are rejected by the GraphQL scalar itself = shorter code execution = several database requests saved = 🚀
  • Nice bonus. Being a custom scalar, the type can be re-used by any other custom type.

Screenshots

GraphiQL editor:

Screenshot_2020-06-11_at_15.27.39

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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 David Fernandez

Merge request reports