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

Provide Perforce environment for scripts

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • p4-plugin
    • None
    • Jenkins 2.89.2
      P4 Plugin 1.8.5

      Our Jenkins build wraps build scripts and makefiles which are also used by developers.

      Some scripts will use the Perforce p4 command during their invocation – for example, to determine the mapped path of a file or directory, or to extract the version number of a file for documentation purposes.

      Developers already have their environment set-up and will be using p4 both on the command line, from IDEs, and from within the build scripts.

      However the Jenkins build does not have a valid Perforce environment as required by p4, even though it the build is operating with a workspace.

      Please make the P4 environment that defines the workspace available to shell commands invoked from the Jenkinsfile.  If necessary, via a "withEnv()" type context.

      Workaround

      I acknowledge that the P4 Plugin exports a set of variables to the environment; however these do not have the naming required by p4.  Therefore I have a custom step which uses these to create P4 Config and P4 Tickets files in the root of the workspace, and exports a P4CONFIG variable.  This needs to be called in each stage of the pipeline in which shell commands may invoke p4.

      Have I overlooked something?

      Is there a {{"withEnv ("p4") {...}"-}}like step already that I don't know about that will do this?

            Unassigned Unassigned
            simon_watts Simon Watts
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: