Unable to copy jobs from older to new version of Jenkins

918 views
Skip to first unread message

Shifa Shaikh

unread,
May 2, 2020, 11:30:11 AM5/2/20
to Jenkins Users
Unable to import jobs of Jenkins old version: 2.224 to Jenkins New version: 2.234

After I copy the job from old to new Jenkins home the Jenkins console UI throws this error:

**You have data stored in older format and/or unreadable data.**

Here is the old config.xml of a very simple job:

<?xml version='1.1' encoding='UTF-8'?>
<flow-definition plugin="workfl...@2.33">
 
<actions/>
 
<description></description>
 
<keepDependencies>false</keepDependencies>
 
<properties>
   
<com.sonyericsson.rebuild.RebuildSettings plugin="reb...@1.31">
     
<autoRebuild>false</autoRebuild>
     
<rebuildDisabled>false</rebuildDisabled>
   
</com.sonyericsson.rebuild.RebuildSettings>
 
</properties>
 
<definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workfl...@2.70">
   
<script>node {
    agent any
    stages
{
        stage
(&apos;build user&apos;) {


            steps
{
                     wrap
([$class: &apos;BuildUser&apos;]) {
                         
//echo &quot;${BUILD_USER}&quot;
                         def user
= env.BUILD_USER_ID
           
}
       
}
   
}
}


}</script>
   
<sandbox>true</sandbox>
 
</definition>
 
<triggers/>
 
<disabled>false</disabled>
</flow-definition>

Next is the same job created in the newer version of Jenkins:

<?xml version='1.1' encoding='UTF-8'?>
<flow-definition plugin="workfl...@2.39">
 
<description></description>
 
<keepDependencies>false</keepDependencies>
 
<properties>
   
<com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty plugin="build-failu...@1.25.1">
     
<doNotScan>false</doNotScan>
   
</com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty>
 
</properties>
 
<definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workfl...@2.80">
   
<script>node {
    agent any
    stages
{
        stage
(&apos;build user&apos;) {


            steps
{
                     wrap
([$class: &apos;BuildUser&apos;]) {
                         
//echo &quot;${BUILD_USER}&quot;
                         def user
= env.BUILD_USER_ID
           
}
       
}
   
}
}


}</script>
   
<sandbox>true</sandbox>
 
</definition>
 
<triggers/>
 
<disabled>false</disabled>
</flow-definition>

Can someone please suggest how I can flawlessly import the jobs of the old Jenkins to the new Jenkins?

I have about 75 complex Jenkins jobs and creating each manually on the new version of Jenkins will be trivial and could be error-prone.

Can you please suggest?

Mark Waite

unread,
May 2, 2020, 11:57:53 AM5/2/20
to Jenkins Users
Did you read the details behind the message that you have data in an unreadable format?  When that appears on my Jenkins instance, I can click the user interface button and it shows the details of the data that can't be read.

Usually the message will tell you why Jenkins cannot read the data.  For example, if your job definition refers to a plugin that existed in the previous installation and does not exist in the new installation, the Jenkins will (correctly) report that the data cannot be read in the new instance, since the plugin that reads that data is not installed.

If you want stability on the Jenkins instance, then you might consider using the long term support release rather than the weekly release.

If you want the very latest improvements, then the weekly release is a good choice.

--
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/d43e2995-ca92-42d1-9859-d86739f445aa%40googlegroups.com.

Shifa Shaikh

unread,
May 2, 2020, 1:10:44 PM5/2/20
to jenkins...@googlegroups.com
@Mark thank you for the reply but i beg to differ. 

Please understand that the issue is not what about a plugin reference  in the old versus in the newer version (whether you go for long term release or weekly release)

My Jenkins job has a single "execute shell" that prints "Hi" message. so plugin dependency is not the reason for the error. 

You can replicate the issue on the said versions of Jenkins. Create a very basic Jenkins DSL job in older version with no plugin dependencies. Then copy the job to the newer stable Jenkins release. You will still see the error I'm reporting.

Mark Waite

unread,
May 2, 2020, 1:48:19 PM5/2/20
to Jenkins Users
Unfortunately, I can't duplicate the problem you're describing.  Please provide precise steps that others can use to see the problem that you are seeing.

Here are the steps that I tried:
  1. Clear my Jenkins home directory
  2. Create a branch, create and run a docker image using Jenkins 2.222.3 with latest plugin versions - this creates a Jenkins home directory with over 150 jobs of various types
  3. Stop that docker image
  4. Create a new 2.224 branch, create and run a docker image using Jenkins 2.224 with latest plugin versions - this reuses the same Jenkins home directory with over 150 jobs of various  types
  5. Confirm there were no warnings related to unreadable data or data format
  6. Stop that docker image
  7. Create a new 2.234 branch, create and run a docker image using Jenkins 2.234 with latest plugin versions - this reuses the same Jenkins home directory with over 150 jobs of various  types
  8. Confirm there were no warnings related to unreadable data or data format
I'm not clear what you mean by "very basic Jenkins DSL job".  The samples I've provided include:
  • Folders
  • Freestyle projects
  • Declarative Pipeline jobs defined inside the job itself
  • Scripted PIpeline jobs
  • Pipeline jobs defined in SCM
  • Multibranch Pipeline jobs
Mark Waite

Shifa Shaikh

unread,
May 2, 2020, 1:53:59 PM5/2/20
to Jenkins Users
@Mark when I click the "manage" button next to the error for a project named "Free_hand", I get the below message:

Manage Old Data
When there are changes in how data is stored on disk, Jenkins uses the following strategy: data is migrated to the new structure when it is loaded, but items/records are not resaved in the new format. This allows for downgrading Jenkins if necessary. However, it can also leave data on disk in the old format indefinitely. The table below lists items/records containing such data, and the Jenkins version(s) where the data structure was changed.

Sometimes errors occur while reading data (if a plugin adds some data and that plugin is later disabled, if migration code is not written for structure changes, or if Jenkins is downgraded after it has already written data not readable by the older version). These errors are logged, but the unreadable data is then skipped over, allowing Jenkins to start up and function properly.

Type    Name    Version
No old data was found.
Unreadable Data
It is ok to leave unreadable data in these items/records, as Jenkins will simply ignore it. To avoid the log messages at Jenkins startup you can permanently delete the unreadable data by resaving these items/records using the button below the list.

Type    Name    Error
hudson.model.FreeStyleProject   Free_hand       CannotResolveClassException: com.sonyericsson.rebuild.RebuildSettings
hudson.model.FreeStyleBuild     Free_hand #1    CannotResolveClassException: com.sonyericsson.rebuild.RebuildAction
hudson.model.FreeStyleBuild     Free_hand #2    CannotResolveClassException: com.sonyericsson.rebuild.RebuildCause, CannotResolveClassException: com.sonyericsson.rebuild.RebuildAction
hudson.model.FreeStyleBuild     Free_hand #5    CannotResolveClassException: com.sonyericsson.rebuild.RebuildAction
hudson.model.FreeStyleBuild     Free_hand #3    CannotResolveClassException: com.sonyericsson.rebuild.RebuildCause, CannotResolveClassException: com.sonyericsson.rebuild.RebuildAction
hudson.model.FreeStyleBuild     Free_hand #7    CannotResolveClassException: com.sonyericsson.rebuild.RebuildAction
hudson.model.FreeStyleBuild     Free_hand #6    CannotResolveClassException: com.sonyericsson.rebuild.RebuildAction
hudson.model.FreeStyleBuild     Free_hand #4    CannotResolveClassException: com.sonyericsson.rebuild.RebuildCause, CannotResolveClassException: com.sonyericsson.rebuild.RebuildAction

   
<com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty plugin="build-failure-anal...@1.25.1">

     
<doNotScan>false</doNotScan>
   
</com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty>
 
</properties>
 
<definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workfl...@2.80">
   
<script>node {
    agent any
    stages
{
        stage
(&apos;build user&apos;) {


            steps
{
                     wrap
([$class: &apos;BuildUser&apos;]) {
                         
//echo &quot;${BUILD_USER}&quot;
                         def user
= env.BUILD_USER_ID
           
}
       
}
   
}
}


}</script>
   
<sandbox>true</sandbox>
 
</definition>
 
<triggers/>
 
<disabled>false</disabled>
</flow-definition>

Can someone please suggest how I can flawlessly import the jobs of the old Jenkins to the new Jenkins?

I have about 75 complex Jenkins jobs and creating each manually on the new version of Jenkins will be trivial and could be error-prone.

Can you please suggest?

--
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 jenkins...@googlegroups.com.

Mohtashim S

unread,
May 2, 2020, 2:07:52 PM5/2/20
to jenkins...@googlegroups.com
@Mark I guess you are pulling the same project in different versions of Jenkins from github and they work fine in all the versions. I agree and understand that they should and is actually working fine. 

My problem is a little different. Do the below. 

Consider we have 

1. Jenkins version "2.224" with Jenkins home directory as /app/Jenkins/old_home
2. Jenkins version "2.234"  with Jenkins home directory as /app/Jenkins/new_home

Create a DSL job "Free_hand" in 2.224 with Execute Shell that prints "hello" [ Note: no plugin dependencies ]

Now, copy the "Free_hand" folder from inside the old version Jenkins job -> "/app/Jenkins/old_home/jobs/Free_hand"  and paste it in the Jenkins_Home/jobs -> "/app/Jenkins/new_home/jobs/Free_hand"  folder of newer Jenkins_Home 2.234

You will not see the "Free_hand" project in the new version of Jenkins even after the copy. 

Restart the newer version of Jenkins. You will now see the Free_hand project visible along with the error message in the notification that I'm reporting.
 



--
R e g a r d s,

<Mohtashim>

<Subject Matter Expert>

Mark Waite

unread,
May 2, 2020, 2:27:42 PM5/2/20
to Jenkins Users
On Sat, May 2, 2020 at 11:54 AM Shifa Shaikh <shif...@gmail.com> wrote:
@Mark when I click the "manage" button next to the error for a project named "Free_hand", I get the below message:

Manage Old Data
When there are changes in how data is stored on disk, Jenkins uses the following strategy: data is migrated to the new structure when it is loaded, but items/records are not resaved in the new format. This allows for downgrading Jenkins if necessary. However, it can also leave data on disk in the old format indefinitely. The table below lists items/records containing such data, and the Jenkins version(s) where the data structure was changed.

Sometimes errors occur while reading data (if a plugin adds some data and that plugin is later disabled, if migration code is not written for structure changes, or if Jenkins is downgraded after it has already written data not readable by the older version). These errors are logged, but the unreadable data is then skipped over, allowing Jenkins to start up and function properly.

Type    Name    Version
No old data was found.
Unreadable Data
It is ok to leave unreadable data in these items/records, as Jenkins will simply ignore it. To avoid the log messages at Jenkins startup you can permanently delete the unreadable data by resaving these items/records using the button below the list.


The message says " It is ok to leave unreadable data in these items/records, as Jenkins will simply ignore it".  The message is accurate.  You can clear that message and save the jobs without the offending data.

The messages in the table indicate that a class cannot be found.  That class is provided by the Rebuilder plugin (google search for "Jenkins com.sonyericsson.rebuild.RebuildAction").

If you no longer need the Rebuilder plugin, you can remove the references to the plugin from your job definition XML files by saving them from a Jenkins instance which does not have the plugin installed.  You could also remove those references from the job definition config.xml file with a text editor if you prefer.

Mark Waite
 

   
<com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty plugin="build-failu...@1.25.1">
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/b54ffdfb-ef9c-44dc-8b38-6a8fe04f5aff%40googlegroups.com.

Mark Waite

unread,
May 2, 2020, 3:12:30 PM5/2/20
to Jenkins Users
On Sat, May 2, 2020 at 12:07 PM Mohtashim S <mohta...@gmail.com> wrote:
@Mark I guess you are pulling the same project in different versions of Jenkins from github and they work fine in all the versions. I agree and understand that they should and is actually working fine. 


No, that sample repository includes Freestyle jobs, Declarative Pipeline jobs with the job definition inside the config.xml file, Declarative Pipeline and Scripted Pipeline jobs with the job definition in SCM, and multibranch Pipeline jobs.

 
My problem is a little different. Do the below. 

Consider we have 

1. Jenkins version "2.224" with Jenkins home directory as /app/Jenkins/old_home
2. Jenkins version "2.234"  with Jenkins home directory as /app/Jenkins/new_home

Create a DSL job "Free_hand" in 2.224 with Execute Shell that prints "hello" [ Note: no plugin dependencies ]

Now, copy the "Free_hand" folder from inside the old version Jenkins job -> "/app/Jenkins/old_home/jobs/Free_hand"  and paste it in the Jenkins_Home/jobs -> "/app/Jenkins/new_home/jobs/Free_hand"  folder of newer Jenkins_Home 2.234

You will not see the "Free_hand" project in the new version of Jenkins even after the copy. 


I assume from this description that Jenkins was already running in the new location.  Jenkins assumes it has control of the contents of the Jenkins home directory.  Copying a new directory with a job definition into a running Jenkins instance will not be detected until the next Jenkins restart.

 
Restart the newer version of Jenkins. You will now see the Free_hand project visible along with the error message in the notification that I'm reporting.
 

See my reply to Shifa Shaikh that describes the details of the messages seen in that case.  If you have different details or more details, please provide them.

Mark Waite
 
Reply all
Reply to author
Forward
0 new messages