-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preventing plugin setup wizard #310
Comments
Not sure. @kzantow do you know? |
If the initial admin user is actually created, it should print to the logs, see: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/jenkins/install/SetupWizard.java#L91-L153 You may also want to pass Optionally, you could |
If you actually just want to prevent the plugin setup, but you DO want the initial security setup, you can implement your own |
The problem with |
Hm, is there any way to provide a properties file or set system properties at boot time? Maybe hook into this somehow? https://github.com/jenkinsci/extras-executable-war/blob/master/src/main/java/Main.java#L171 |
at boot time yes, you can set |
I guess as things stand, either package it with a modification to the |
@carlossg Is there any update here? |
No updates. IIUC there is the option to skip the wizard but not a way to skip only plugin installation. |
@carlossg Again, a fairly trivial |
@kzantow yes, I mean there is no way for someone extending the image to just do that easily with a file marker or something like that |
In our case we created a new Jenkins image which automatically installs some plugins and creates a admin user with a default password. So there is no Jenkins setup visible and after starting the container you can directly use Jenkins. |
@foxylion I tried using the approach you described after looking at your Dockerfile but, I can't login to Jenkins. The Docker image built fine but when I try to login via the Jenkins web UI, I specify the default id and password that were also specified in the Dockefile and I get: Invalid login information. Please try again. Never mind, I looked closer at your Dockerfile and figured it out.... |
@ckmason You're missing the Groovy file to add the user: https://github.com/foxylion/docker-jenkins/blob/master/docker-images/master/default-user.groovy Edit: Ok. 😄 |
@foxylion -- I am having trouble making my own image using your ideas, so I've fallen back on using your image but that doesn't work either. Details in foxylion/docker-jenkins#1 |
@kzantow e.g.:
Is there a way to save images with Jenkins data? I want to use my Docker registry as a backup system |
Ok, found it out, its because of the Volume statement in the Dockerfile, removing it gets me to the expected behaviour. Line 21 in fd79401
|
@krm1 to clarify, volumes are not preserved into an image layer during commit. |
So @kzantow there is still no way to choose not to run the plugin install wizard at build time? |
@kzantow It is possible, have a look at my customized image: https://github.com/foxylion/docker-jenkins |
If you want to do this from just groovy, I think correct incantation is: import static jenkins.model.Jenkins.instance as jenkins
import jenkins.install.InstallState
if (!jenkins.installState.isSetupComplete()) {
println '--> Neutering SetupWizard'
InstallState.INITIAL_SETUP_COMPLETED.initializeState()
} |
@foxylion In your master docker image, I can see where you copy your groovy scripts, but where in the Dockerfile do you Run them? Sorry if I'm missing something totally obvious, I'm a docker noob! |
Ohh nm, it's because it's an init file. |
@coderanger 's incantation worked for me. Worth noting, I could not get it to work when executing through a $JENKINS_HOME/init.groovy hook. Inside the call to |
This is what was working for me inside docker for Jenkins version 2.107.3. basic-security.groovy
Then in Dockerfile
Also if you want preinstalled plugins when building the image, you will need to copy plugin installation script from orginal Jenkins docker repository and optionally a text file with plugins to be installed. install-plugins.sh https://github.com/jenkinsci/docker/blob/master/install-plugins.sh Plugins file example: Dockerfile
For me, the problem was default jenkins directory which is /var/lib/jenkins and preinstalled plugins go to /usr/share/jenkins/ref/plugins. Although the script should move installed plugins to /var/lib/jenkins/plugins, for some reason it didn't work. So I needed to change REF_DIR variable in install-plugins.sh script. After that, the script will install plugins directly to Jenkins home folder.
Alternatively, if you don't want to change file directly you can do it with sed while building the image: |
@cromat Unfortunately the code for disabling the wizard does not work as of 2.121.1 |
@foxylion after skip the setup wizard.the file jenkins.model.JenkinsLocationConfiguration.xml at jenkins_home was missed. and in that case when I access the BUILD_URL or JOB_URL then will ruturn null, so I have to click the save-button in system settings.and after that the file jenkins.model.JenkinsLocationConfiguration.xml was be created. and as you know the jenkinsUrl in that file which can't be predefined in Dockerfile. is there anything else I can do ? |
This seems to cause a great deal of confusion, see e.g.
etc. But many instructions seem wrong, outdated, etc. I can't yet find a method that actually works. The answer "oh, just click OK" isn't really cool. This is meant to be a CI system, surely making it unnecessarily painful to deploy in fully automated, testable, configuration managed manner isn't ideal. I was eventually able to make it behave with two
(Obviously my real run uses volumes etc, this is a minimal example) I've created #833 to request some changes |
After some trial and error, I was able to disable just the plugin installation phase of the installation wizard, without affecting the other sections. The code I'm using is here: https://github.com/gryphon-zone/jenkins/blob/7788a6f9668561d5631c4c4b12fc69ba3bec1d84/configuration/disable-plugin-install-wizard.groovy (worth noting, I'm doing other customization in the As mentioned in the comments for the groovy script, right now there isn't a dedicated installation state for the plugin configuration section of the wizard (or at least if there is, I couldn't find it), meaning it's possible that the script will break in a future release of Jenkins/start skipping more than just the plugin installation (if dedicated states are added in the future I'll update the script). Additionally, I'm using the deprecated Definitely agree that given the presence of the Also worth mentioning, adding |
Check for setup completed was wrong, added groovy script which bypasses plugin install but leaves admin password visible in logs. See jenkinsci/docker#310 jenkinsci/docker#608
I think the README should be corrected, as is it misleading in its current state. The README clearly states:
This is clearly wrong, so this should be removed from the README. |
This will prevent the setup wizard from the Dockerfile
|
My goal was to disable setup wizard and at the same time create first admin user Dockerfile:
groovy script default-user.groovy:
|
With jenkins 2.2.89.3 this gives me following exception: groovy.lang.MissingMethodException: No signature of method: hudson.security.FullControlOnceLoggedInAuthorizationStrategy.add() is applicable for argument types: (hudson.security.Permission, java.lang.String) values: [Permission[class hudson.model.Hudson,Administer], admin] Although admin user created, setup wizard disabled, this is just not nice to see. |
if I use
then I can avoid the wizard, but the admin password is not printed in the logs
Is there a way to just prevent the plugin setup?
The text was updated successfully, but these errors were encountered: