jupyterhub / repo2docker-action

A GitHub action to build data science environment images with repo2docker and push them to registries.
MIT License
142 stars 28 forks source link

ERROR: file or directory not found: image-tests/ #109

Closed jnywong closed 7 months ago

jnywong commented 7 months ago

Describe the bug The action fails because the container cannot access the contents of the image-tests folder.

To Reproduce Steps to reproduce the behavior:

  1. I triggered the action defined in test.yaml with
    • NO_PUSH: "true"
    • DOCKER_REGISTRY: "quay.io"
    • REPO_DIR: /srv/repo
    • IMAGE_NAME: "jnywong/jupyter-scipy-pytest"
  2. Build fails at the step Build the image and push it ifNO_PUSHdisabled with the error message
   Executing the command: /bin/bash -c 
          export PYTEST_FLAGS="";

          # If there is a requirements.txt file inside image-tests, install it.
          # Useful if you want to install a bunch of pytest packages.
          [ -f image-tests/requirements.txt ] && \
              echo "Installing from image-tests/requirements.txt..." && \
              python3 -m pip install --no-cache -r image-tests/requirements.txt;

          # If pytest is not already installed in the image, install it.
          which py.test > /dev/null || \
              echo "Installing pytest inside the image..." && \
              python3 -m pip install --no-cache pytest > /dev/null;

          # If there are any .ipynb files in image-tests, install pytest-notebook
          # if necessary, and set PYTEST_FLAGS so notebook tests are run.
          ls image-tests/*.ipynb > /dev/null && \
              echo "Found notebooks, using pytest-notebook to run them..." && \
              export PYTEST_FLAGS="--nb-test-files ${PYTEST_FLAGS}" && \
              python3 -c "import pytest_notebook" 2> /dev/null || \
                  python3 -m pip install --no-cache pytest-notebook > /dev/null;

          py.test ${PYTEST_FLAGS} image-tests/

  ls: cannot access 'image-tests/*.ipynb': No such file or directory
  ERROR: file or directory not found: image-tests/

Expected behavior The image-tests directory exists in my repo, so I expect that this action would be able to ls this folder and run the tests.

Additional context The build still fails with the same error message even with an empty image-tests folder.

Even if you delete the image-tests folder entirely the action still fails because the action expects to copy this folder over during the build

  Step 4/8 : COPY image-tests image-tests
  COPY failed: file not found in build context or excluded by .dockerignore: stat image-tests: file does not exist
welcome[bot] commented 7 months ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

jnywong commented 7 months ago

I am starting to think that this error is because there isn't currently a container pushed to the container registry (I am starting from "fresh") when test.yaml is triggered.

jnywong commented 7 months ago

Okay yes, I have confirmed my suspicions above. I needed to make sure that the image defined by DOCKER_REGISTRY and IMAGE_NAME is non-empty and initialised with at least one build.