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

Pin build at Perforce Label does not support variable expansion

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • p4-plugin
    • None
    • CentOS-7 (Linux CentOS-7 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux)

      Jenkins war (org.jenkins-ci.main:jenkins-war:2.138.2)

      P4 Plugin (1.9.3)

      The description for the "Pin a build at Perforce Label" indicates the following:

      When a build is triggered by Polling, Build Now or an external Action, the workspace will sync only to the specified label. Any other specified change or label will be ignored.

      Supports variable expansion e.g. ${VAR}. If 'now' is used, or a variable that expands to 'now', then the latest change is used (within the scope of the workspace view).

      This is not working.

      I tried ${SV_P4_CHANGELOG} where the value was not set, and hence is empty, and the tool is looking for the label SV_P4_CHANGELOG, as shown below

      Started by user aaaa
      [EnvInject] - Loading node environment variables.
      Building in workspace /a-directory
      (p4):cmd:... p4 client -o build_jenkins_centos
      p4 client -o build_jenkins_centos
      
      (p4):stop:4
      (p4):cmd:... p4 counter change
      p4 counter change
      
      (p4):stop:5
      (p4):cmd:... p4 changes -m1 -ssubmitted //build_jenkins_centos/...
      p4 changes -m1 -ssubmitted //build_jenkins_centos/...
      
      Change ##### on ####/##/## by developer@developermachine 'Fixed bug'
      (p4):stop:6
      (p4):cmd:... p4 label -o SV_P4_CHANGELOG
      p4 label -o SV_P4_CHANGELOG
      
      (p4):stop:7
      (p4):cmd:... p4 counter SV_P4_CHANGELOG
      p4 counter SV_P4_CHANGELOG
      
      (p4):stop:8
      (p4):cmd:... p4 repos -C
      p4 repos -C
      
      (p4):stop:9
      Building on Node: master
      (p4):cmd:... p4 client -o build_jenkins_centos
      p4 client -o build_jenkins_centos
      
      (p4):stop:4
      
      P4 Task: establishing connection.
      ... server: aaaaaaaa:####
      ... node: CentOS-7
      
      P4 Task: reverting all pending and shelved revisions.
      (p4):cmd:... p4 revert /a-directory/...
      p4 revert /a-directory/...
      
      /a-directory/... - file(s) not opened on this client.
      
      (p4):stop:5
      ... rm [abandoned files]
      duration: (19ms)
      
      P4 Task: cleaning workspace to match have list.
      (p4):cmd:... p4 reconcile -w -f /a-directory/...
      p4 reconcile -w -f /a-directory/...
      
      (p4):stop:6
      duration: 0m 47s
      
      (p4):cmd:... p4 label -o SV_P4_CHANGELOG
      p4 label -o SV_P4_CHANGELOG
      
      (p4):stop:7
      (p4):cmd:... p4 client -o SV_P4_CHANGELOG
      p4 client -o SV_P4_CHANGELOG
      
      (p4):stop:8
      (p4):cmd:... p4 counter SV_P4_CHANGELOG
      p4 counter SV_P4_CHANGELOG
      
      (p4):stop:9
      P4: Unable to find client/label/counter: SV_P4_CHANGELOG
      P4 Task: attempt: 1
      ERROR: P4: Task Exception: hudson.AbortException: P4: Unable to find client/label/counter: SV_P4_CHANGELOG
      Finished: FAILURE
      

      If I change the configuration value to "$SV_P4_CHANGELOG", dropping the braces, I start getting output such as this:

      p4):cmd:... p4 label -o $SV_P4_CHANGELOG
       p4 label -o $SV_P4_CHANGELOG
      
      (p4):stop:7
       (p4):cmd:... p4 client -o $SV_P4_CHANGELOG
       p4 client -o $SV_P4_CHANGELOG
      
      (p4):stop:8
       (p4):cmd:... p4 counter $SV_P4_CHANGELOG
       p4 counter $SV_P4_CHANGELOG
      
      (p4):stop:9
       P4: Unable to find client/label/counter: $SV_P4_CHANGELOG
       P4 Task: attempt: 1
       ERROR: P4: Task Exception: hudson.AbortException: P4: Unable to find client/label/counter: $SV_P4_CHANGELOG
       Finished: FAILURE
      
      

       



       

      This scenario is also observed on Ubuntu 18.

            p4karl Karl Wirth
            rocha_stratovan John Rocha
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: