It will be great if this plugin can be used as part of the Workflow plugin by some kind of DSL like:

      def freePort= PortAllocator.get()

          [JENKINS-31449] Port Allocator Pipeline support

          Liel Ran created issue -
          Jesse Glick made changes -
          Labels New: workflow

          Jesse Glick added a comment -

          PortAllocator would need to become a SimpleBuildWrapper. There are various places AbstractBuild would need to be replaced by Run, and similar minor changes. To survive Jenkins restarts, that means Port must become Serializable, cleanUp needs to be passed in sufficient context that Port need not keep unserializable state, and PortAllocationManager needs to become a persistent Extension (using load/save) with ports keeping only Run.externalizableId and INSTANCES being keyed by Node.name. Pool probably also needs to be come Serializable, enabling PooledPortType to work, and then other types like TomcatShutdownPortType needs to be modified to use static Serializable nested classes for cleanup work. Overall a fairly major refactoring, akin to what I had to do for JENKINS-26477.

          Jesse Glick added a comment - PortAllocator would need to become a SimpleBuildWrapper . There are various places AbstractBuild would need to be replaced by Run , and similar minor changes. To survive Jenkins restarts, that means Port must become Serializable , cleanUp needs to be passed in sufficient context that Port need not keep unserializable state, and PortAllocationManager needs to become a persistent Extension (using load / save ) with ports keeping only Run.externalizableId and INSTANCES being keyed by Node.name . Pool probably also needs to be come Serializable , enabling PooledPortType to work, and then other types like TomcatShutdownPortType needs to be modified to use static Serializable nested classes for cleanup work. Overall a fairly major refactoring, akin to what I had to do for JENKINS-26477 .

          Code changed in jenkins
          User: Jesse Glick
          Path:
          COMPATIBILITY.md
          http://jenkins-ci.org/commit/workflow-plugin/384ef03deb67580c1e3b99fd6551b39b21bc40b8
          Log:
          JENKINS-31449 Noting.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: COMPATIBILITY.md http://jenkins-ci.org/commit/workflow-plugin/384ef03deb67580c1e3b99fd6551b39b21bc40b8 Log: JENKINS-31449 Noting.
          Andres Rodriguez made changes -
          Assignee Original: ramapulavarthi [ ramapulavarthi ] New: Andres Rodriguez [ andresrc ]
          Andres Rodriguez made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Patrick Wolf made changes -
          Summary Original: workflow support New: Port Allocator Pipeline support
          Patrick Wolf made changes -
          Epic Link New: JENKINS-34657 [ 170293 ]
          Andres Rodriguez made changes -
          Status Original: In Progress [ 3 ] New: Open [ 1 ]
          Andres Rodriguez made changes -
          Assignee Original: Andres Rodriguez [ andresrc ]

            jbq jbq
            lielran Liel Ran
            Votes:
            20 Vote for this issue
            Watchers:
            24 Start watching this issue

              Created:
              Updated: