Skip to content

Housekeeper: Validate configuration on start

Manoj M J requested to merge manojmj-master-patch-95108 into master

What does this MR do and why?

Premise

On pair programming session with @bmarjanovic today on housekeeper - Bojan had missed added the required ENV variables needed for housekeeper to work on an actual run, namely HOUSEKEEPER_GITLAB_API_TOKEN and HOUSEKEEPER_TARGET_PROJECT_ID on his current terminal window.

In most cases this is ok - we get quick feedback on the terminal due to a KeyError raised from within some point inside Housekeeper::Runner.

But, in this specific case, the keep being run was a BIG one.

So, it takes anywhere between 1-2 minutes to run through the keep to create the changed files.

And then, it tries to push - and this is where we get the feedback on the terminal that says key not found: "HOUSEKEEPER_GITLAB_API_TOKEN" (KeyError), at which point we fix it by adding that environment variable.

However, in such a scenario, we have already lost a minute or two waiting for the output, which unfortunately just stops midway due to the missing configuration. Add to that, once a keep errors out, we have to manually discard the changed files to run the keep again.

Solution

All this can be avoided and time can be saved if we just provide feedback about missing configuration keys right when Housekeeper::Runner starts going, and not when trying to push - which is what this MR does.

The error will look like this:

Screenshot_2024-06-04_at_11.22.34_PM

(Yes, same error as before but you get the feedback instantly than after a couple of minutes)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Manoj M J

Merge request reports