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

AgentConfigFiles could be more defensive

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • support-core-plugin
    • None
    • support-core:2.56

      While analyzing instances, I have seen cases where the nodes/slave/ directory contains many agents but the config.xml could not be found. This results in many files `nodes/slave/<slaveName>/config.xml` containing the exception:

      --- WARNING: Could not attach <JENKINS_HOME>/nodes/<agentName>/config.xml as it cannot currently be found ---
      
      java.io.FileNotFoundException: File '<JENKINS_HOME>/nodes/<agentName>/config.xml' does not exist
      	at org.apache.commons.io.FileUtils.openInputStream(FileUtils.java:292)
      	at org.apache.commons.io.FileUtils.readFileToString(FileUtils.java:1765)
      	at org.apache.commons.io.FileUtils.readFileToString(FileUtils.java:1800)
      	at com.cloudbees.jenkins.support.configfiles.SecretHandler.findSecrets(SecretHandler.java:96)
      	at com.cloudbees.jenkins.support.configfiles.XmlRedactedSecretFileContent.getInputStream(XmlRedactedSecretFileContent.java:25)
      	at com.cloudbees.jenkins.support.api.FileContent.writeTo(FileContent.java:85)
      	at com.cloudbees.jenkins.support.SupportPlugin.writeBundle(SupportPlugin.java:316)
      	at com.cloudbees.jenkins.support.SupportPlugin.writeBundle(SupportPlugin.java:278)
      	at com.cloudbees.jenkins.support.SupportPlugin$PeriodicWorkImpl.lambda$doRun$0(SupportPlugin.java:820)
      	at java.lang.Thread.run(Unknown Source)
              [...]
      

      This suggests that the $JENKINS_HOME/nodes directory contains some kind of obsolete / corrupted directories. Maybe this could happen with ephemeral agents. In any case I do believe that https://github.com/jenkinsci/support-core-plugin/blob/support-core-2.56/src/main/java/com/cloudbees/jenkins/support/configfiles/AgentsConfigFile.java could be more defensive

            allan_burdajewicz Allan BURDAJEWICZ
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: