Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-72923

thinBackup will not reload config or accept pre-created config after Jenkins start

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • thinbackup-plugin
    • None

      The environment info above provides both versions of things, and configurations of things.  I'll summarize what I ran into here.

       

      1. If I use a Groovy init script to provide a thinBackup.xml file in /var/jenkins_home it isn't used by the plugin.  The desired settings do not appear when navigating to the "ThinBackup" section of "Manage Jenkins".  The file was correctly created by the Groovy script, but the changes are not found in the UI. I  tried using "Reload Configuration From Disk" within "Manage Jenkins", but nothing changed.  I tried using the Script Console and running "jenkins.model.Jenkins.getInstance().reload()" but yet again, nothing changed.
      2. Just in case I missed some subtle mistake in the config file I had crafted, I tried removing it, initialling ThinBackup manually to trigger it to create thinBackup.xml.  Then I manually changed one setting in the file (I altered "/var/jenkins_backup" to "/var/jenkins_backup2"). Attempts to reload the configuration from disk, once again, did not work.
      3. I have verified that the plugin does indeed function. I can manually configure it, and manually trigger backups to the desired backup location.
      4. If I install some entirely unrelated plugin and set Jenkins to restart once the plugin is available, THEN AND ONLY THEN can I navigate to the ThinBackup settings and see the changes applied from disk.

      As far as I can tell, the only opportunity to use automation to initialize the ThinBackup plugin with a desired configuration is before Jenkins starts.  Once Jenkins has started, no joy.

          [JENKINS-72923] thinBackup will not reload config or accept pre-created config after Jenkins start

          Reid added a comment - - edited

          For anybody that wants to do the same kind of thing with a helm-based install, I was able to figure out a workaround that did not entail hacking any of the existing template files, nor creating a custom container image.

          1. add a template file to the chart to create a ConfigMap with the key "thinBackup.xml" whose value is your desired file content.
          2. in your helm values.yaml, or in an equivalent you use with Helmsman to to selected overrides of the default values.yaml, add two sections:
            1. an entry in persistence.volumes for a volume naming the config map you created above.
            2. an entry in persistence.mounts with the same volume name from above 
              mountPath: '/var/jenkins_home/thinBackup.xml'subPath: 'thinBackup.xml'

          All of this presumes you have already done something to create a backup destination to give the path for in the configuration.  In my case, that was a PVC/PV combo also added to the helm chart's templates directory, and that volume is also mounted via persistence.volumes and persistence.mounts information.

          The end result was that I was able to see a backup happen after a fresh install, without ever logging in, due only to the cron schedule and backup destination info that had been supplied in the ConfigMap.

          Reid added a comment - - edited For anybody that wants to do the same kind of thing with a helm-based install, I was able to figure out a workaround that did not entail hacking any of the existing template files, nor creating a custom container image. add a template file to the chart to create a ConfigMap with the key "thinBackup.xml" whose value is your desired file content. in your helm values.yaml, or in an equivalent you use with Helmsman to to selected overrides of the default values.yaml, add two sections: an entry in persistence.volumes for a volume naming the config map you created above. an entry in persistence.mounts with the same volume name from above  mountPath: '/var/jenkins_home/thinBackup.xml'subPath: 'thinBackup.xml' All of this presumes you have already done something to create a backup destination to give the path for in the configuration.  In my case, that was a PVC/PV combo also added to the helm chart's templates directory, and that volume is also mounted via persistence.volumes and persistence.mounts information. The end result was that I was able to see a backup happen after a fresh install, without ever logging in, due only to the cron schedule and backup destination info that had been supplied in the ConfigMap.

            tofuatjava Thomas Fürer
            rmpinchback Reid
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: