Jenkins rpm issue

Running on a Rocky Linux Machine

I have an issue where Jenkins loses permissions to some directories, when my company’s auto patching runs. Ended up finding out that as part of the patching they run rpm --setperms for all items. For jenkins it’s:

rpm --setperms jenkins-2.452.1-1.1.noarch

This command is removing all read, write and execute permissions to /var/cache/jenkins/ and /var/lib/jenkins/ , which causes the jenkins service to fail.

I can fix Jenkins by running chmod 750 on those directories, but I’d like to prevent the issue from happening.

As far as I understand rpm --setperms should be fixing any potential issues with permissions, instead of causing issues.
I have installed jenkins using these instructions: Redhat Jenkins Packages

Is there something I can do to correct the behaviour of

rpm --setperms jenkins-2.452.1-1.1.noarch

?

The best choice is probably to not run that command. A Linux Training Academy article describes the common use cases for that command and warns that the command can be harmful.