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

Kubernetes plugin creates workspace with linux-style root path on a Windows node

XMLWordPrintable

      Setup

      • Jenkins 2.303.3
      • P4 Plugin 1.11.6

      Where Jenkins master is running on Linux

      Running slaves on a Kubernetes cluster (configured as Cloud) as Pod Templates

       

      Repro Steps

       

      1. Create a pod template that will execute on a Windows Kubernetes node
      2. Create a pipeline that uses uses the pod template as its agent
      3. Attempt to checkout a p4 stream on the a container of the windows pod (it can be the jnlp container)

      Expectations

      The stream should be checked out at the current location

      Observations

      P4 fails to checkout with the following error:

       

      ERROR: P4: Task Exception: hudson.AbortException: P4JAVA: Error(s):
      Path 'C:/home/jenkins/agent/workspace/gpetit/gpetit-windows/...' is not under client's root '/home/jenkins/agent/workspace/gpetit/gpetit-windows'. 
      

       

      Additional Details

      The the pod template looks like this:
       

      apiVersion: "v1"
      kind: "Pod"
      metadata:  
        labels:
          jenkins/label: "windows-architecture-base"
      spec:
        containers:
        - image: "jenkins/inbound-agent:windowsservercore-ltsc2019"
          name: "jnlp"
        nodeSelector:
           kubernetes.io/os: "windows"
      

       

      The pipeline:

      pipeline {
          agent { label 'windows-architecture-base' }
      
          stages {
              stage('Checkout') {
                 steps {
                     script {
                          powershell "Get-ChildItem env:"
                          checkout perforce(
                              credential: 'gpetit-p4',
                              populate: autoClean(delete: true, modtime: false, parallel: [enable: true, minbytes: '1024', minfiles: '1', threads: '4'], pin: '', quiet: true, replace: true, tidy: false),
                              workspace: streamSpec(charset: 'none', format: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}', pinHost: false, streamName: '//depot/stream-main')
                              )
                      }
                  }
              }
          }
      }
      

      When printing environment variables, noteworthy is that the WORKSPACE is set as a linux path:

      WORKSPACE       /home/jenkins/agent/workspace/gpetit/gpetit-windows                           
      WORKSPACE_TMP   /home/jenkins/agent/workspace/gpetit/gpetit-windows@tmp
      

            Unassigned Unassigned
            gpetit Gaspard Petit
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: