That description seems like a bug to me, though I can't see anything in the
Docker scripts that helps me understand where the problem would be.  If I
understand your description correctly, you need both the init.groovy.d
scripts and the install-plugins.sh call before you see the problem.  The
groovy scripts seem to be making standard calls to load and save
configuration, and the install-plugins.sh script doesn't seem to make any
changes to the root config.xml file.

I believe the https://github.com/jenkinsci/docker repository has a place
for bug reports.  You probably want to submit a detailed description there,
in hopes one of the maintainers is able to help.

Mark Waite

On Wed, Dec 28, 2016 at 8:39 AM Stefan Rademacher <sr...@web.de> wrote:

> Thanks for your reply. I tried to narrow things down:
>
> A simple Dockerfile, that only copies "my" config.xml to
> /usr/share/jenkins/ref/ works fine. The config.xml is kept unmodified as
> expected.
> (The only thing, that is different between "my" config.xml and a default
> config.xml is the line <disableSignup>false</disableSignup>, which is true
> by default.)
> FROM jenkins:alpine
> COPY config.xml /usr/share/jenkins/ref/
> See
> https://github.com/sradi/jenkins-provisioning-problem/tree/5eea71d967cba618884aafb2b74245f75d0900e8
>
> Adding some scripts to init.groovy.d (change number of executors and
> create a default user 'admin')... Still everything works as expected.
> See
> https://github.com/sradi/jenkins-provisioning-problem/tree/12a431ccac229b3d24f5404e0aedc7d02810a8b1
>
> Additionally run 'install-plugins.sh'... PROBLEM OCCURS: The config.xml is
> unexpectedly modified (disableSignup is reset to 'true').
> FROM jenkins:alpine
> RUN /usr/local/bin/install-plugins.sh matrix-auth
> COPY init.groovy.d/* /usr/share/jenkins/ref/init.groovy.d/
> COPY config.xml /usr/share/jenkins/ref/
> See
> https://github.com/sradi/jenkins-provisioning-problem/tree/e073854ecd0e017d53f804c45a971399080efb46
>
> When I only keep the plugin installation in my Dockerfile and remove any
> init script, the problem again, does NOT occur.
> See
> https://github.com/sradi/jenkins-provisioning-problem/tree/d1a8b5a70016701db2559804896a77921b67ab17
>
> *Summary*: As soon as I use an init script, that e. g. changes my numer
> of executors AND use install-plugins.sh in my Dockerfile, the problem
> occurs.
>
> The problem can be reproduced, if you checkout the different commits of
> the repository, mentioned above, and run the following commands:
> docker build --rm -t jenkinsproblem:latest .
> docker run -p 8080:8080 -p 50000:50000 -d --name jenkinsproblem_1
> jenkinsproblem
> # run this several times, until you see, that numExecutors is changed to
> '0'. If 'disableSignup' changed from 'false' to 'true' the problem is
> reproduced.
> docker exec jenkinsproblem_1 cat /var/jenkins_home/config.xml
>
> Hope, anyone can help me. Is this a bug?
>
> Thanks a lot and best regards
> Stefan
>
>
>
> Am Montag, 19. Dezember 2016 17:59:21 UTC+1 schrieb Mark Waite:
>
> Since you're adding the configuration in your Dockerfile, it should be
> there when the docker image is created.  Since you can see it for the first
> few seconds in the running image, I think that means the jenkins.sh startup
> process which copies from "ref" to "/var/jenkins_home" did what it was
> expected to do (though there is a risk you're seeing it before jenkins.sh
> copies in the file from ref/config.xml).
>
> Since a change is happening after jenkins.sh has copied the ref content
> into the runtime location, I assume it must be something other than the
> jenkins.sh startup process which is replacing your modified ref/config.xml
> file with a different config.xml file.  However, I don't know of anything
> after that which could make that type of change.
>
> Are you entirely sure that the modified file is in the /var/jenkins_home
> directory even after the jenkins.sh script has run?
>
> I regularly use a modified config.xml to configure a Jenkins Docker
> instance, and it has worked quite well for me.  If you'd like to compare
> how mine is configured, you could look at
> https://github.com/MarkEWaite/docker/blob/lts-with-plugins/ref/config.xml
>  .
>
> Thanks,
> Mark Waite
>
> On Mon, Dec 19, 2016 at 12:27 AM Stefan Rademacher <radema...@gmail.com>
> wrote:
>
> Hi there,
>
> I am currently working on a Docker image, that is derived from
> jenkins:alpine.
> In my Dockerfile I copy a config.xml in the the reference content
> directory (/usr/share/jenkins/ref) and add some xml content with
> Ansible-XML. (The content added, is a cloud configuration for a Docker host)
>
> After starting my container, I can see my config.xml in /var/jenkins_home
> for a couple of seconds.
> After that, it is overwritten with a default config.xml. This seems to
> happen, some time during the start of the server. The problem cannot even
> be solved by using the filename config.xml.override, as suggested in the
> docs of the official docker image.
>
> Weirdly, I can’t reproduce this error, when I start Jenkins without
> docker. In that case, my custom config.xml is kept as is on the first start
> of Jenkins.
>
> In Jenkins.java (
> https://github.com/jenkinsci/jenkins/blob/3e2e01717976a1f1221874bfd576429c5c48b8a6/core/src/main/java/jenkins/model/Jenkins.java#L3015)
> I can’t find anything, that explains the overwriting of my config.xml.
>
> Does anyone have an idea, why this happens?
>
> Thanks and best regards
> Stefan Rademacher
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-use...@googlegroups.com.
>
>
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/3CA43885-85DD-4530-9FC8-9F2465F949FD%40gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-users/3CA43885-85DD-4530-9FC8-9F2465F949FD%40gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/8027cc17-e759-498f-acf8-4bb512d92851%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/8027cc17-e759-498f-acf8-4bb512d92851%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFmi9ERf1%2Bj8-hZw0%3DT33ZdfOQswx%3DvB6R7n_d4p-fTEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to