Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
May 23, 2024

Conversation

jnywong
Copy link
Contributor

@jnywong jnywong commented Mar 18, 2024

Fixes #110

Copy link

welcome bot commented Mar 18, 2024

Thanks for submitting your first pull request! You are awesome! 🤗

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! 👋

Welcome to the Jupyter community! 🎉

@jnywong
Copy link
Contributor Author

jnywong commented Mar 18, 2024

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

@sgibson91
Copy link
Member

The error is:

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

😕

@yuvipanda
Copy link
Collaborator

@jnywong #118 should fix the failing tests once merged.

@jnywong
Copy link
Contributor Author

jnywong commented Mar 26, 2024

Hoorah the tests have passed 🎉

@batpad
Copy link

batpad commented May 17, 2024

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

cc @sunu

@sgibson91 sgibson91 merged commit d5cbe4f into jupyterhub:master May 23, 2024
17 checks passed
Copy link

welcome bot commented May 23, 2024

Congrats on your first merged pull request in this project! 🎉
congrats
Thank you for contributing, we are very proud of you! ❤️

@jnywong jnywong deleted the jnywong-patch-1 branch May 23, 2024 15:59
@yuvipanda
Copy link
Collaborator

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
Copy link

batpad commented May 23, 2024

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
Copy link
Contributor Author

jnywong commented May 23, 2024

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

yuvipanda added a commit to yuvipanda/ghg-workshop-python-image that referenced this pull request May 23, 2024
@yuvipanda
Copy link
Collaborator

@batpad @sunu I think if sunu/ghg-workshop-python-image#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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running tests defined in image-tests fail when REPO_DIR is not chowned by user
4 participants