Last active
March 4, 2022 08:39
-
-
Save cccaternberg/3b7f0a9a10ed255c99987a2bee925e26 to your computer and use it in GitHub Desktop.
hudson.model.DirectoryBrowserSupport.CSP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd $JENKINS_HOME | |
mkdir -p init.groovy.d/ | |
#see https://www.jenkins.io/doc/book/managing/groovy-hook-scripts/ | |
#open file with vi | |
vi init.groovy.d//init.groovy | |
#add the follwing and save | |
#init.groovy | |
import jenkins.model.Jenkins | |
import hudson.model.* | |
import java.util.logging.Logger | |
Logger.global.info("[Running] startup script") | |
//Properties müssen auf die CAP Gemini properties angepasst werden! | |
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "default-src 'self'; style-src 'self' 'unsafe-inline';") | |
System.getProperty("hudson.model.DirectoryBrowserSupport.CSP") | |
Jenkins.instance.save() | |
#Exit and save | |
#chamge owner and permissions | |
chown -R cloudbees-core-cm.cloudbees-core-cm init.groovy.d/* | |
chmod a+x init.groovy.d/* | |
#restart | |
systemctl restart cloudbees-core-cm | |
#go to jenkins script console after restart and run | |
System.getProperty("hudson.model.DirectoryBrowserSupport.CSP") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment