I'm trying to modify the existing EnvInject plugin so that the Environment Variables
link it puts on a build's page is hidden. If I'm understanding the Jenkins API correctly, I should be able to do this by finding where the Action
interface is implemented and having getIconFileName()
return null
.
I found that method implemented in EnvInjectAction.java and modified it to return null
, but this had no effect--the link is still visible on build pages. I even tried modifying getDisplayName()
and getUrlName()
to also return null
, but this also had no effect. Here is the modified method:
public String getIconFileName() {
return null;
}
I've taken care to follow the instructions for deploying a custom build of a core plugin from the Jenkins plugin tutorial, and I've also tried rebooting the machine that Jenkins is running on, all to no avail.
I'm clearly missing something vital, but I can't figure out what it could be. What else do I need to do to make the plugin not display the Environment Variables link?
The notion of pinned plugins applies to plugins that are bundled with Jenkins, such as the Matrix Authorization plugin. If you do nothing special, whenever Jenkins is upgraded, its bundled plugins overwrite whatever versions of the plugins are currently installed in $JENKINS_HOME.
Why do you want to do that? To hide sensitive information?
Are you aware of that even if you remove the link the variables can be displayed via:http://jenkins/job/YourJob/1/injectedEnvVars
?
Or according to the EnvInjectPlugin-VariablesTraceability:
"You can also get build environment variables by the followingHTTP GET URL: <jenkins_url>/job/<job_name>/<build_number>/injectedEnvVars/export
"
However, if it's just to remove the link and modifying the plugin is not a must add the following to Jenkins' run/jenkins/war/css/style.css
:
a[href*='/injectedEnvVars'] {
display: none;
}
Make a backup copy of the adapted style.css
since it might get overwritten with a:
$ sudo service jenkins --full-restart
You can use a custom CSS with the following:
Manage Jenkins → Configure System → Theme → URL of theme CSS: ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With