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

Stashing doesn't work in containers and there's no way to debug it

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I'm trying to use declarative pipeline with Kubernetes plugin version 1.30.1. I've confirmed that the files I want to stash exist in $WORKSPACE directory, yet stash fails with

      hudson.AbortException: No files included in stash ‘dist-pypi-3.7’
      	at org.jenkinsci.plugins.workflow.flow.StashManager.stash(StashManager.java:128)
      	at org.jenkinsci.plugins.workflow.support.steps.stash.StashStep$Execution.run(StashStep.java:115)
      	at org.jenkinsci.plugins.workflow.support.steps.stash.StashStep$Execution.run(StashStep.java:103)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      

      This message is obviously worthless, since it doesn't tell where stash was hoping to find the files, so there's no way to fix the error.

      The code causing the error looks more or less like this:

      {
          podTemplate(containers: [
              containerTemplate(
                  name: 'python',
                  image: "python:${PYTHON_VERSION}",
                  command: 'sleep',
                  args: '99d'
              )
          ]) {
              node(POD_LABEL) {
                  git url: 'https://github.com/wvxvw/*****.git', branch: 'main'
                  container('python') {
                      sh "python${PYTHON_VERSION} -m venv .venv"
                      sh './.venv/bin/python -m pip install wheel'
                      sh './.venv/bin/python ./setup.py bdist_egg'
                      sh 'ls ./dist/'
                      sh "ls ${WORKSPACE}"
                      sh 'pwd'
                      sh 'env'
                      stash includes: './dist/*.*',
                          name: "dist-pypi-${PYTHON_VERSION}"
                  }
              }
          }
      }
      

        Attachments

          Activity

          Hide
          mwinter69 Markus Winter added a comment - - edited

          I think the problem is that your includes is not valid.

          This simple pipeline also fails:

           

          node {
           dir ('dist') {
             bat label: '', script: 'echo test > my.log'
           }
           stash includes: './dist/*.*', name: 'test'
          }
           
          

          Changing it to '/dist/.' should make it work

          Show
          mwinter69 Markus Winter added a comment - - edited I think the problem is that your includes is not valid. This simple pipeline also fails:   node { dir ( 'dist' ) { bat label: '', script: ' echo test > my.log' } stash includes: './dist/*.*' , name: 'test' }   Changing it to '/dist/ . ' should make it work
          Hide
          wvxvw Whatever added a comment - - edited

          And why is this not valid? Why changing relative path to absolute should make this work? This makes no sense... The documentation says that it should accept patterns in the same way Ant does. If your examples should indeed work, this is nothing like Ant. Then either documentation needs to be updated, or the behavior corrected.

          Show
          wvxvw Whatever added a comment - - edited And why is this not valid? Why changing relative path to absolute should make this work? This makes no sense... The documentation says that it should accept patterns in the same way Ant does. If your examples should indeed work, this is nothing like Ant. Then either documentation needs to be updated, or the behavior corrected.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            wvxvw Whatever
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: