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

No way to set P4HOST (for Assembla hosted repo)

      Trying to build my Java project using CloudBees' DEV@Cloud (cloud-hosted Jenkins). Repository is on Assembla (cloud-hosted Perforce). Build will be using a freestyle job.

      The problem as far as I can see is that Assembla requires you to set P4HOST to a certain value, or else you cannot connect. I can connect to Perforce from my laptop so long as P4HOST is set. If it's not set, I get the same error as on CloudBees' build servers ('partner exited unexpectedly') - see attachment "console_cloudbees.txt"

      I tried to workaround through 'Configure Jenkins' => 'Global properties' => 'Environment variables'. This gets me further for p4 commands in the shell script, but it doesn't seem to affect the Perforce plugin.

      Please add a way to configure P4HOST (or indeed any arbitrary P4* variable) either through the Perforce plugin, or else just get the environment from global configuration.

          [JENKINS-19699] No way to set P4HOST (for Assembla hosted repo)

          Ben Golding added a comment -

          For P4HOST specifically you can also do 'p4 -H <host> <command> [<args> ...]'

          Ben Golding added a comment - For P4HOST specifically you can also do 'p4 -H <host> <command> [<args> ...] '

          robin johnson added a comment -

          Not sure where to add -H <host> within Jenkins.

          Or, looking for a way to run a pre-config script so that the jenkins environment has the P4HOST already setup.

          fyi, I'm on a mac. My shells work with p4 just fine, but I configure p4 environment variables as part of my shell startup. (including HOST).

          ...so where's the sneaky place where we can add this into Jenkins?

          robin johnson added a comment - Not sure where to add -H <host> within Jenkins. Or, looking for a way to run a pre-config script so that the jenkins environment has the P4HOST already setup. fyi, I'm on a mac. My shells work with p4 just fine, but I configure p4 environment variables as part of my shell startup. (including HOST). ...so where's the sneaky place where we can add this into Jenkins?

          robin johnson added a comment -

          I ended up wrapping p4 in a shell script that contained p4 -H <host>

          #!/bin/bash
          /usr/bin/p4 -H projectkono $@

          Then I set Jenkins to use my shells script as the official p4 install

          robin johnson added a comment - I ended up wrapping p4 in a shell script that contained p4 -H <host> #!/bin/bash /usr/bin/p4 -H projectkono $@ Then I set Jenkins to use my shells script as the official p4 install

          Ben Golding added a comment -

          @robin: this seems an OK workaround.

          Nicolas De Loof also suggested to use this plugin
          https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin
          to inject the P4HOST environment variable before SCM checkout.
          I didn't try that yet, but it should work.

          Ben Golding added a comment - @robin: this seems an OK workaround. Nicolas De Loof also suggested to use this plugin https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin to inject the P4HOST environment variable before SCM checkout. I didn't try that yet, but it should work.

            Unassigned Unassigned
            bgolding Ben Golding
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: