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

When changing directories in Job within Kubernetes worker, durabletask returns a nonexistent error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins ver. 2.222.3
      Kubernetes Plugin 1.25.4
      Durable Task 1.3.4

      Jenkins running on a container in a VM
      Jenkins Workers running on Kubernetes Cluster

      LAUNCH_DIAGNOSTICS has been set to TRUE

      When running a job in a Kubernetes worker, with the podTemplate

      Agent ci-base-v2-t6hf0 is provisioned from template ci-base-v2
      ---
      apiVersion: "v1"
      kind: "Pod"
      metadata:
        labels:
          jenkins: "slave"
          jenkins/label: "ci-base-v2-k8s"
        name: "ci-base-v2-t6hf0"
      spec:
        containers:
        - args:
          - "cat"
          command:
          - "/bin/sh"
          - "-c"
          image: "<X>/ci-base-v2:latest"
          imagePullPolicy: "Always"
          name: "workload"
          resources:
            limits: {}
            requests: {}
          securityContext:
            privileged: false
            runAsGroup: 1000
            runAsUser: 1000
          tty: true
          volumeMounts:
          - mountPath: "/var/run/docker.sock"
            name: "volume-0"
            readOnly: false
          - mountPath: "/home/jenkins/agent"
            name: "workspace-volume"
            readOnly: false
          workingDir: "/home/jenkins/agent"
        - env:
          - name: "JENKINS_SECRET"
            value: "********"
          - name: "JENKINS_TUNNEL"
            value: "<X>"
          - name: "JENKINS_AGENT_NAME"
            value: "ci-base-v2-t6hf0"
          - name: "JENKINS_NAME"
            value: "ci-base-v2-t6hf0"
          - name: "JENKINS_AGENT_WORKDIR"
            value: "/home/jenkins/agent"
          - name: "JENKINS_URL"
            value: "https://<X>"
          image: "jenkins/jnlp-slave:4.0.1-1"
          name: "jnlp"
          resources:
            requests:
              cpu: "100m"
              memory: "256Mi"
          volumeMounts:
          - mountPath: "/var/run/docker.sock"
            name: "volume-0"
            readOnly: false
          - mountPath: "/home/jenkins/agent"
            name: "workspace-volume"
            readOnly: false
        hostNetwork: false
        nodeSelector:
          beta.kubernetes.io/os: "linux"
        restartPolicy: "Never"
        securityContext: {}
        volumes:
        - hostPath:
            path: "/var/run/docker.sock"
          name: "volume-0"
        - emptyDir:
            medium: ""
          name: "workspace-volume"
      
      Running on ci-base-v2-t6hf0 in /home/jenkins/agent/workspace/DevOps/<X>/test-check-cred
      

       

      And attempting to checkout a git repo into a different directory via `dir`

      // code placeholder
      
      ...stages {
          stage('test kubeconfig') {
              parallel {
                  stage('test1'){
            steps {
                dir ('/home/jenkins/go'){
                    checkout([
                      $class: 'GitSCM',
                      branches: [[name: 'origin/master']],
                      doGenerateSubmoduleConfigurations: false,
                      submoduleCfg: [],
                      userRemoteConfigs: [[credentialsId: 'jenkins-bot-with-token', url: "https://<X>/command-center"]]
                    ]) ...

      I got an error with with the following error:

      08:33:41  sh: 1: cannot create /home/jenkins/go@tmp/durable-a40581a0/jenkins-log.txt: Directory nonexistent
      08:33:41  sh: 1: cannot create /home/jenkins/go@tmp/durable-a40581a0/jenkins-result.txt.tmp: Directory nonexistent
      08:33:41  mv: cannot stat '/home/jenkins/go@tmp/durable-a40581a0/jenkins-result.txt.tmp': No such file or directory
      

      But when I don't change directories, the build passes.

      When running the same CI job on a Docker Host Worker, changing directories does not cause any errors.

       

            Unassigned Unassigned
            davidchua David Chua
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: