jupyterhub / repo2docker-action

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

Docker run tests defined in `image-tests` as root user #111

Closed jnywong closed 3 months ago

jnywong commented 5 months ago

Fixes #110

welcome[bot] commented 5 months ago

Thanks for submitting your first pull request! You are awesome! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. welcome You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

jnywong commented 5 months ago

Hmm, not sure why this change broke all the CI/CD tests...

sgibson91 commented 5 months ago

The error is:

docker.errors.DockerException: invalid tag 'localhost:5000/repo2docker-test:43c232c553a9': invalid reference format

😕

yuvipanda commented 5 months ago

@jnywong https://github.com/jupyterhub/repo2docker-action/pull/118 should fix the failing tests once merged.

jnywong commented 5 months ago

Hoorah the tests have passed 🎉

batpad commented 3 months ago

We are running into this as well - anything we can do to help get this merged, @yuvipanda ?

cc @sunu

welcome[bot] commented 3 months ago

Congrats on your first merged pull request in this project! :tada: congrats Thank you for contributing, we are very proud of you! :heart:

yuvipanda commented 3 months ago

Sorry for not commenting on this earlier, but I don't think this will fix it. My vague understanding is that this only happens when using Dockerfile, and in that case perhaps what's needed is a --chown for the COPY step. repo2docker does this automatically for non-Dockerfile uses, and we should probably document this for Dockerfile uses? I think @batpad did a little more investigation of this as well but it's not listed here.

I think running as root will break (or at least cause weird artifacts) for users that are using non-Dockerfile methods with repo2docker. For now, I'd like to revert this temporarily until we hear back from @batpad (or @sunu, who may have done the actual investigation). Sorry for not raising this earlier here :(

@jnywong @sgibson91 are you ok with reverting this?

batpad commented 3 months ago

So sorry for the delay commenting here - was hoping @sunu who looked into this could explain a bit better, but he's out sick today :(

I see the fix was to add something like this to the Dockerfile:

# enable image-tests; workaround for https://github.com/jupyterhub/repo2docker-action/issues/110
RUN chown -R ${NB_USER}:${NB_USER} /srv/repo

USER ${NB_USER}

You can see the Dockerfile here: https://github.com/sunu/ghg-workshop-python-image/blob/main/Dockerfile

Speaking to Yuvi a bit about this, it seems like we it maybe better to add this to the documentation as something you need to do if writing your own Dockerfile?

Apologies again for not commenting here earlier with a link to our workaround / fix in the Dockerfile!

jnywong commented 3 months ago

Thanks @yuvipanda for your insight here, I trust that you know better and happy to help with documenting workarounds 👍

yuvipanda commented 3 months ago

@batpad @sunu I think if https://github.com/sunu/ghg-workshop-python-image/pull/1 passes tests, then we can add documentation to https://github.com/jupyterhub/repo2docker-action?tab=readme-ov-file#testing-the-built-image to the effect of:

  1. If you're using a Dockerfile, you need to copy image-tests into the docker image yourself
  2. You have to make sure the ownership of that is 'correct', and suggest using COPY --chown for that