Skip to content

Add Image Resizer config defaults

Aleksei Lipniagov requested to merge add-img-resizing-configs into master

What does this MR do?

Add default Image Resizer config values.
They were added in gitlab-workhorse!615 (merged).
If (while) they are missing, we are falling back to the same defaults, but in the Workhorse code.

Defaulting to max(2, num_cores / 2) was a result of this discussion: gitlab-org/charts/gitlab!1595 (comment 433518692)

Charts MR: gitlab-org/charts/gitlab!1595 (merged)
CNG MR: gitlab-org/build/CNG!534 (merged)

Related issues

gitlab-workhorse#298 (closed)

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion

Test plan

  1. Enable Image Resizing feature: Run Feature.enable(:dynamic_image_resizing_requester); Feature.enable(:dynamic_image_resizing_owner) in Rails console
  2. Verify we're resizing the avatar: login into GL; upload the avatar for your user if it is using the placeholder; open the avatar pic, add ?width=15 to the request; You should see the resized image (mind the browser cache)
  3. Update configs with max_filesize = X, where X is small. I suggest 1 (1kb). The typical avatar is bigger, so the resizer will fallback to the original image.
  4. Apply config changes, reconfigure
  5. Open the avatar with ?width=15 again. Note that the resizing is falling back to default because of too aggressive config: you the original, 200x200 image will be returned, and you will see ImageResizer: 93700b exceeds maximum file size of Xb in the Workhorse logs (where X is the limitation you set on step 3)

Required

  • Merge Request Title, and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • Pipeline is green on dev.gitlab.org if the change is touching anything besides documentation or internal cookbooks -- how to check it?
  • trigger-package has a green pipeline running against latest commit

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes -- How it should look like?
  • [-] Documentation created/updated -- Which docs should I update? The feature is not enabled by default for now on top of this. How do we handle this?
  • [-] Tests added -- I am not sure we need tests for such change. There are tests in WH project.
  • [-] Integration tests added to GitLab QA -- not sure if we need those and how they should look like
  • Equivalent MR/issue for the GitLab Chart opened
Edited by Matthias Käppler

Merge request reports