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

Fix createSlave for RestartableJenkinsRule

    XMLWordPrintable

Details

    • 1746.v2b_3c5d1983b_e

    Description

      If you use JenkinsRule.createSlave (or createOnlineSlave) from a test based on RestartableJenkinsRule, it seems to work during the first session. But then the whole slave directory gets quietly deleted during the restart.

      Either this deletion should be suppressed, or there should be an alternate method to create a slave that actually survives the restart intact.

      See WorkflowTest.buildShellScriptAcrossRestart and BindingStepTest.cleanupAfterRestart.

      Attachments

        Issue Links

          Activity

            jglick Jesse Glick added a comment -

            The workaround is to add a DumbSlave manually.

            jglick Jesse Glick added a comment - The workaround is to add a DumbSlave manually.

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/BindingStepTest.java
            http://jenkins-ci.org/commit/credentials-binding-plugin/615c102baa4942f96e1bef415b67d628329060ce
            Log:
            Found workaround for JENKINS-26398, which was the key to getting this test to pass.

            Compare: https://github.com/jenkinsci/credentials-binding-plugin/compare/4640f27f13e4...615c102baa49

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/BindingStepTest.java http://jenkins-ci.org/commit/credentials-binding-plugin/615c102baa4942f96e1bef415b67d628329060ce Log: Found workaround for JENKINS-26398 , which was the key to getting this test to pass. Compare: https://github.com/jenkinsci/credentials-binding-plugin/compare/4640f27f13e4...615c102baa49

            Code changed in jenkins
            User: Jesse Glick
            Path:
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowTest.java
            http://jenkins-ci.org/commit/workflow-plugin/73d09e62b8b094f2865d1aab32044cf402965108
            Log:
            JENKINS-26398 Linking to a filed issue.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowTest.java http://jenkins-ci.org/commit/workflow-plugin/73d09e62b8b094f2865d1aab32044cf402965108 Log: JENKINS-26398 Linking to a filed issue.

            Code changed in jenkins
            User: Jesse Glick
            Path:
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowTest.java
            http://jenkins-ci.org/commit/workflow-plugin/dd5eaf7aa09cc509fb98f46816fad2b2b337b5ea
            Log:
            Merge pull request #34 from jenkinsci/JENKINS-26398-comment

            Linking to a filed issue

            Compare: https://github.com/jenkinsci/workflow-plugin/compare/375c1db37f91...dd5eaf7aa09c

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowTest.java http://jenkins-ci.org/commit/workflow-plugin/dd5eaf7aa09cc509fb98f46816fad2b2b337b5ea Log: Merge pull request #34 from jenkinsci/ JENKINS-26398 -comment Linking to a filed issue Compare: https://github.com/jenkinsci/workflow-plugin/compare/375c1db37f91...dd5eaf7aa09c
            jglick Jesse Glick added a comment -

            Could do that, but some of the tests also seem to require use of a JNLP slave, which is rather more complicated to model. Punting for the moment.

            jglick Jesse Glick added a comment - Could do that, but some of the tests also seem to require use of a JNLP slave, which is rather more complicated to model. Punting for the moment.

            Maybe split slave creation into KillableSlaveRule for example and bind it where required to JenkinsRule?

            integer Kanstantsin Shautsou added a comment - Maybe split slave creation into KillableSlaveRule for example and bind it where required to JenkinsRule?
            jglick Jesse Glick added a comment -

            I think would suffice to add methods to JenkinsRule.

            jglick Jesse Glick added a comment - I think would suffice to add methods to JenkinsRule .

            Code changed in jenkins
            User: Jesse Glick
            Path:
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowTest.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/ec779e6d6937e5d7777e11a03d415f76a11bff74
            Log:
            JENKINS-26398 Linking to a filed issue.
            Originally-Committed-As: 73d09e62b8b094f2865d1aab32044cf402965108

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/WorkflowTest.java http://jenkins-ci.org/commit/workflow-cps-plugin/ec779e6d6937e5d7777e11a03d415f76a11bff74 Log: JENKINS-26398 Linking to a filed issue. Originally-Committed-As: 73d09e62b8b094f2865d1aab32044cf402965108
            jglick Jesse Glick added a comment -

            Need to recheck with JenkinsSessionRule.

            jglick Jesse Glick added a comment - Need to recheck with JenkinsSessionRule .
            jglick Jesse Glick added a comment -

            Still a problem with JenkinsSessionRule. The issue is that JenkinsSessionRule.tmp survives restarts but JenkinsRule.env.temporaryDirectoryAllocator as used by createTmpDir does not, and createSlave still uses createTmpDir. Options include

            • use some other agent root dir (e.g. inside $JENKINS_HOME)
            • use a TemporaryFolder scoped to JenkinsSessionRule
            • allow JenkinsRule.env to be overridden from JenkinsSessionRule
            jglick Jesse Glick added a comment - Still a problem with JenkinsSessionRule . The issue is that JenkinsSessionRule.tmp survives restarts but JenkinsRule.env.temporaryDirectoryAllocator as used by createTmpDir does not, and createSlave still uses createTmpDir . Options include use some other agent root dir (e.g. inside $JENKINS_HOME ) use a TemporaryFolder scoped to JenkinsSessionRule allow JenkinsRule.env to be overridden from JenkinsSessionRule

            People

              jglick Jesse Glick
              jglick Jesse Glick
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: