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

Add option to lock the created workspace to a host

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major Major
    • p4-plugin
    • None

      this request feature is purely for p4maven/maven release plugin integration where p4jenkins is used to create initial workspace.

      during maven release, p4maven needs to discover the client name it is working on by scanning thru the entire list of available clients.

      my many CI clusters are huge and we use the same account on many jenkins master/slave instances to create workspaces. However, p4jenkins currently created the worksapce but leave the hostname empty.

      If the hostname is locked in for each workspace, p4maven can narrow down to a much much smaller list during it release-prepare step

          [JENKINS-24512] Add option to lock the created workspace to a host

          dan tran added a comment -

          I went ahead with the upgrade. It works and I think https://issues.jenkins-ci.org/browse/JENKINS-26589 is fixed as well. Thanks

          dan tran added a comment - I went ahead with the upgrade. It works and I think https://issues.jenkins-ci.org/browse/JENKINS-26589 is fixed as well. Thanks

          Paul Allen added a comment -

          Added feature in 1.1.3

          Paul Allen added a comment - Added feature in 1.1.3

          dan tran added a comment -

          I am seeing inconsistency in the hostname. For example, p4jenkins sets to full FQDN name of a slave, however at the save the command 'hostname' which is equivalent to InetAddress.getLocalHost().getHostName() return short name.

          Did you configure the client's at the master or at the slave node??

          dan tran added a comment - I am seeing inconsistency in the hostname. For example, p4jenkins sets to full FQDN name of a slave, however at the save the command 'hostname' which is equivalent to InetAddress.getLocalHost().getHostName() return short name. Did you configure the client's at the master or at the slave node??

          dan tran added a comment -

          Per Java API: InetAddress.getLocalHost().getHostName() returns host shortname

          and hostname command also returns short name.

          This means we need to have the client's hostname not to use fqdn format, but short format instead

          This is the error, I am currently seeing

          [ERROR] Client 'xxxx' can only be used from host 'hhhhh.fqdn.name.com'.

          dan tran added a comment - Per Java API: InetAddress.getLocalHost().getHostName() returns host shortname and hostname command also returns short name. This means we need to have the client's hostname not to use fqdn format, but short format instead This is the error, I am currently seeing [ERROR] Client 'xxxx' can only be used from host 'hhhhh.fqdn.name.com'.

          Paul Allen added a comment -

          The 'master' and 'slave' hostnames are calculated in different ways. The simplest way to fix this might be with string manipulation, where I fetch the FQDN for the 'slave' from the Node object and then chop the domain bit off.

          Paul Allen added a comment - The 'master' and 'slave' hostnames are calculated in different ways. The simplest way to fix this might be with string manipulation, where I fetch the FQDN for the 'slave' from the Node object and then chop the domain bit off.

          dan tran added a comment -

          That works

          dan tran added a comment - That works

          Paul Allen added a comment -

          Ok the short name will not work in some situations. This all comes down to how DNS is resolved on the Host. The easiest is to run a remote invocation on the slave to find out it's hostname (as the slave resolves it).

          I have submitted the change to Main:

          https://swarm.workshop.perforce.com/changes/11531

          Paul Allen added a comment - Ok the short name will not work in some situations. This all comes down to how DNS is resolved on the Host. The easiest is to run a remote invocation on the slave to find out it's hostname (as the slave resolves it). I have submitted the change to Main: https://swarm.workshop.perforce.com/changes/11531

          dan tran added a comment -

          It works with my local p4jenkins 1.4-SNAPSHOT ( do you have a latest snapshot deploy somewhere?). However, I am not able to run the test on my windows box. May relate to my environment. I only have linux env at work which does not have access to workshop.perforce.com:1666

          Do you timeframe to fix https://issues.jenkins-ci.org/browse/JENKINS-26589?. I need the client configuration to stay unchanged when there is no file changes since I can run p4maven on this workspace anytime

          dan tran added a comment - It works with my local p4jenkins 1.4-SNAPSHOT ( do you have a latest snapshot deploy somewhere?). However, I am not able to run the test on my windows box. May relate to my environment. I only have linux env at work which does not have access to workshop.perforce.com:1666 Do you timeframe to fix https://issues.jenkins-ci.org/browse/JENKINS-26589? . I need the client configuration to stay unchanged when there is no file changes since I can run p4maven on this workspace anytime

          dan tran added a comment -

          my bad, all my test fails since I am using java 8. With java 7 only one test fails

          dan tran added a comment - my bad, all my test fails since I am using java 8. With java 7 only one test fails

          Paul Allen added a comment -

          Resolved in 1.1.4

          Paul Allen added a comment - Resolved in 1.1.4

            p4paul Paul Allen
            dantran dan tran
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: