On Mon, Apr 18, 2022 at 3:16 PM 'Daniel Beck' via Jenkins Developers <
[email protected]> wrote:

> Potentially doable via readResolve as well.
>
>
Unfortunately you cannot do this sort of thing via `readResolve` so far as
I know.

Ideally there would be some API which you could call from `readResolve` or
otherwise mark a class which, if loaded in the context of some top-level
model object (in this case `Project`), would trigger a callback after the
top-level load completes, which you could use to immediately rewrite the
reference, add to `OldDataMonitor`, etc.

In the absence of that, your only option is to add a global initialization
hook which scans all build steps in all projects. Obviously this adds
startup overhead for everyone who installs your plugin, even if it is
unused. You could use a `GlobalConfiguration` (or simple `FileBoolean`) to
track whether the translation has been run before.

Another common use case is migrating `Secret` to `credentialsId`.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2v5kykDcTky_Y_9eT93n%2BDJ_sfK7LO6P0rph13ismRvQ%40mail.gmail.com.

Reply via email to