Skip to content

Implemented deprecation log

Arran Walker requested to merge ajwalker/deprecation-log into master

What does this MR do?

Adds a MVC deprecation logger, allowing deprecation visibility, whilst also providing a basic suppression mechanism for potentially spammy deprecations.

Example

deprecate.Warningln(logger, "2227", "14.0 will replace the 'build_script' with 'step_script'")

will output:

deprecation[2227](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/2227): 14.0 will replace the 'build_script' with 'step_script'

Setting the environment variable SUPPRESS_DEPRECATION_2227 would suppress this warning.

Why was this MR needed?

We warn of deprecations using various techniques already (&3212 (closed)), but we haven't yet created a standard around logging them.

Notes for reviewer

For this MVC, I've focused on the simplest way of supporting suppressions: environment variables. This will work for both gitlab-runner and the helper binary.

This allows suppressions to be supported at both the job level gitlab.ci.yml (under variables) and the runner config by specifying environment variables.

Later we may be able to add support for suppressing an already warned deprecation within a certain scope (such as within a single job excution).

What are the relevant issue numbers?

#26442 (closed)

Edited by Arran Walker

Merge request reports