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

      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}"
                  }
              }
          }
      }
      

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

              Created:
              Updated: