Docker: /usr/share/jenkins/ref files not updated

Created on 5 Dec 2017  ·  3Comments  ·  Source: jenkinsci/docker

In jenkins-support script there is this section that copies over files under the ref directory.

if [[ ! -e $JENKINS_HOME/${rel} || $f = *.override ]]
        then
            action="INSTALLED"
            log=true
            mkdir -p "$JENKINS_HOME/${dir:23}"
            cp -r "${f}" "$JENKINS_HOME/${rel}";
        else
            action="SKIPPED"
        fi

I am extending the base lts-alpine container with some init.groovy.d scripts.

I have a few init.groovy.d scripts that configure agents/jobs/credentials. If I add new logic to one of these files it is not copied over because the file already exists.

I think it would be better for these files/directories to be managed through a hash comparison as these files do not have a version value like the plugins do.

As a work around I am making a symlink for each file so that the file gets linked to the original file.

# Make a .override file for each file so it copies it over upon jenkins startup.
RUN find /usr/share/jenkins/ref/init.groovy.d -type f -exec ln -s '{}' '{}'.override \;

Actual result

Updated files are not copied over.

Expected outcome

Updated files are copied over.

All 3 comments

existing files are not copied over to prevent overriding changes made through the web ui

I think this could be closed. I do not see an easy way to handle this that could be handled at the level of the Jenkins Docker image.
Or @arthurvanduynhoven if you have an idea to be able to differentiate files changed/used by the user and things that were not and that upgrading the image should update, please provide your thoughts.

Closing as per my last comment. Feel free to reopen once/if you think there's a way to handle this. Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mpv945 picture mpv945  ·  7Comments

greenrobot picture greenrobot  ·  7Comments

subesokun picture subesokun  ·  4Comments

jiankafei picture jiankafei  ·  7Comments

manoj150283 picture manoj150283  ·  3Comments