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

gitpod integration using Docker images from portability testing workflow #33103

Closed
mkoeppe opened this issue Jan 1, 2022 · 199 comments
Closed

gitpod integration using Docker images from portability testing workflow #33103

mkoeppe opened this issue Jan 1, 2022 · 199 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Jan 1, 2022

Gitpod allows one to setup a complete dev environment in the cloud. It is free to use for up to 50 hours per month. In this ticket the config necessary for making this work with sagemath is added.

You can try this out by going to https://gitpod.io/#https://github.com/mkoeppe/sage/tree/mkoeppe-9.5.beta9%2Bupdates.

It works by building docker images on github, push them to GH packages (https://github.com/mkoeppe?tab=packages&q=gitpod) and then use these ones as the base for the gitpod workspace.

After this ticket is merged, we should activate the automatic prebuild by installing the github app (https://www.gitpod.io/docs/prebuilds#on-github). With this enabled, every push would trigger a prebuild of the complete environment (including the build of all dependencies and cythonizion) so that one has a up-to-date code env very quickly without the need to build anything.

Follow-up: #33113 gitpod usability improvements

Alternative: #32749, which only builds the docker image on gitpod (which is currently not really feasible as they have a time limit of 1h)

Depends on #30933
Depends on #29285

CC: @tobiasdiez @dimpase @saraedum

Component: docker

Author: Tobias Diez, Matthias Koeppe

Branch/Commit: 078f247

Reviewer: Matthias Koeppe, Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/33103

@mkoeppe mkoeppe added this to the sage-9.5 milestone Jan 1, 2022
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 1, 2022

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 1, 2022

Last 10 new commits:

e99a09esed -i.bak 's/ubunty/ubuntu/g' .github/workflows/*.yml
edb4364.github/workflows/tox.yml: Replace homebrew-macos-python3_xcode-standard by homebrew-macos-usrlocal-python3_xcode-standard
e27e161Merge #32703
96a45d1tox.ini, .github/workflows: Remove ubuntu-groovy
59ec3d0Merge #33068
cbf03d1.github/workflows/tox.yml: Add docker-gitpod
4a9edfcbuild/bin/write-dockerfile.sh: Handle __SUDO
d697d94build/bin/write-dockerfile.sh: Use relative workdir 'sage'
c7cc5cd.gitpod.yml, docker/.gitpod.Dockerfile: Reverse SAGE_LOCAL symlink
bde9f74build/bin/write-dockerfile.sh: Handle $__CHOWN

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 1, 2022

Commit: bde9f74

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 1, 2022

Author: Tobias Diez, Matthias Koeppe

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 1, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

21afe51.github/workflows/tox*.yml, tox.ini: Pass ddocker.pkg.github.com credentials via DOCKER_CONFIG_FILE
76b5e76Merge #30933

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 1, 2022

Changed commit from bde9f74 to 76b5e76

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 1, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

7ef6a6edocker/.gitpod.Dockerfile: Remove, use custom image from GH Packages instead

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 1, 2022

Changed commit from 76b5e76 to 7ef6a6e

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 1, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

6b41c4a.github/workflows/tox.yml: Also push ...-with-targets-pre

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 1, 2022

Changed commit from 7ef6a6e to 6b41c4a

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 1, 2022

comment:9

Running into pyenv issues (#29285) here too:

[pytest] installing. Log file: /home/gitpod/sage/logs/pkgs/pytest.log
  [pytest] error installing, exit status 1. End of log file:
  [pytest]   /home/gitpod/sage-local/var/lib/sage/venv-python3.8/bin/python3: No module named pip
  [pytest] Full log file: /home/gitpod/sage/logs/pkgs/pytest.log
make[4]: *** [Makefile:2756: pytest-no-deps] Error 1

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 2, 2022

Changed dependencies from #33068, #30933 to #33068, #30933, #29285

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 2, 2022

Changed commit from 6b41c4a to 5f0c36c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 2, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

376932fbuild/bin/sage-bootstrap-python: Reject pyenv shims
5f0c36cMerge #29285

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 2, 2022

Changed dependencies from #33068, #30933, #29285 to #33068, #30933, #29285, #32868

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 2, 2022

Changed dependencies from #33068, #30933, #29285, #32868 to #33068, #30933, #29285, #32868, #33067

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 2, 2022

Changed commit from 5f0c36c to af7c8d3

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 2, 2022

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

aeca1a0Makefile (pypi-sdists): Add sage_setup
cd3dce9pkgs/sage-conf_pypi/setup.py: Update directory of configured sage_conf.py
c695921pkgs/sage-conf/sage_conf.py.in (SAGE_SPKG_WHEELS): Update so it works if SAGE_VENV != SAGE_LOCAL
cebcda3Merge tag '9.5.beta4' into t/29039/pip_installable_package_sage_bootstrap
0026892Merge tag '9.5.beta5' into t/29039/pip_installable_package_sage_bootstrap
2a4a323Merge tag '9.5.beta7' into t/29039/pip_installable_package_sage_bootstrap
02234ceMerge #29039
b1413d4build/bin/write-dockerfile.sh: Move 'ADD pkgs' earlier
859be3ebuild/bin/write-dockerfile.sh: ADD src/*.m4 files for bootstrapping
af7c8d3Merge #33067

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 2, 2022

Changed commit from af7c8d3 to fad8942

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 2, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

fad8942build/bin/write-dockerfile.sh: Use relative workdir 'sage' (again)

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 2, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

601a3b5.gitpod.yml: Remove pyenv workarounds
1258c70.gitpod.yml: configure --enable-download-from-upstream-url

@sagetrac-git sagetrac-git mannequin added the s: needs review label Jan 12, 2022
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 12, 2022

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

078f247.github/workflows/tox*.yml: Transform GITHUB_REF_NAME to a valid docker tag

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 12, 2022

Changed commit from 08048c3 to 078f247

@dimpase
Copy link
Member

dimpase commented Jan 13, 2022

comment:138

Is it easy to configure launching this (with prebuids) on branches in https://github.com/sagemath/sagetrac-mirror ?

@tobiasdiez
Copy link
Contributor

comment:139

Yes, it's only a few clicks see: https://www.gitpod.io/docs/prebuilds#projects-and-prebuilds
However, it needs to be done by someone with rights to install apps in the sagemath org.

@dimpase
Copy link
Member

dimpase commented Jan 13, 2022

comment:140

Replying to @tobiasdiez:

Yes, it's only a few clicks see: https://www.gitpod.io/docs/prebuilds#projects-and-prebuilds
However, it needs to be done by someone with rights to install apps in the sagemath org.

I've sent you an invite. I guess I installed their "app", but I don't see how to proceed.
(I think it should be enabled on the branch of this ticket only, before it's merged.)

Did you see my email message about trac access?

@tobiasdiez
Copy link
Contributor

comment:141

Thanks! I've now created a "team" sagemath and added the sage and sagetrac-mirror as projects. If you have a gitpod account and want to be invited to this team (in order to access the config), just post your email address and I send an invite.

Currently, the creation of the image fails however due to a permission error:

 > [internal] load metadata for ghcr.io/sagemath/sage/sage-docker-gitpod-standard-with-targets:dev:
------
.gitpod.Dockerfile:3
--------------------
   1 |     ARG BASE_GITHUB_REPOSITORY=sagemath/sage
   2 |     ARG BASE_TAG=dev
   3 | >>> FROM ghcr.io/${BASE_GITHUB_REPOSITORY}/sage-docker-gitpod-standard-with-targets:${BASE_TAG} as with-targets
   4 |     RUN sudo rm -rf /var/cache/debconf/* /var/lib/apt/lists/* /tmp/* /var/tmp/*
   5 |     # Fast doc rebuilds do not work because
--------------------
error: failed to solve: failed to fetch anonymous token: unexpected status: 403 Forbidden

Matthias, can you have a look please?

https://gitpod.io/#prebuild/https://github.com/sagemath/sagetrac-mirror/tree/u/mkoeppe/gitpod_integration_using_docker_images_from_portability_testing_workflow

@dimpase
Copy link
Member

dimpase commented Jan 14, 2022

comment:142

Replying to @tobiasdiez:

Thanks! I've now created a "team" sagemath and added the sage and sagetrac-mirror as projects. If you have a gitpod account and want to be invited to this team (in order to access the config), just post your email address and I send an invite.

my email is shown on my GitHub account https://github.com/dimpase

Thanks!

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 14, 2022

comment:143

Replying to @tobiasdiez:

Currently, the creation of the image fails however due to a permission error:

 > [internal] load metadata for ghcr.io/sagemath/sage/sage-docker-gitpod-standard-with-targets:dev:
------
.gitpod.Dockerfile:3
--------------------
   1 |     ARG BASE_GITHUB_REPOSITORY=sagemath/sage
   2 |     ARG BASE_TAG=dev
   3 | >>> FROM ghcr.io/${BASE_GITHUB_REPOSITORY}/sage-docker-gitpod-standard-with-targets:${BASE_TAG} as with-targets
   4 |     RUN sudo rm -rf /var/cache/debconf/* /var/lib/apt/lists/* /tmp/* /var/tmp/*
   5 |     # Fast doc rebuilds do not work because
--------------------
error: failed to solve: failed to fetch anonymous token: unexpected status: 403 Forbidden

I think you need to deposit a secret providing read access similar to what is explained in
https://www.gitpod.io/docs/self-hosted/latest/configuration/docker-registry

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 14, 2022

comment:144

... alternatively I suppose we could push the required Docker images to DockerHub -- but I don't have write access there; @saraedum, could you deposit an access token for that as a secret here? https://github.com/organizations/sagemath/settings/secrets/actions

@tobiasdiez
Copy link
Contributor

comment:146

Replying to @mkoeppe:

Replying to @tobiasdiez:

Currently, the creation of the image fails however due to a permission error:

 > [internal] load metadata for ghcr.io/sagemath/sage/sage-docker-gitpod-standard-with-targets:dev:
------
.gitpod.Dockerfile:3
--------------------
   1 |     ARG BASE_GITHUB_REPOSITORY=sagemath/sage
   2 |     ARG BASE_TAG=dev
   3 | >>> FROM ghcr.io/${BASE_GITHUB_REPOSITORY}/sage-docker-gitpod-standard-with-targets:${BASE_TAG} as with-targets
   4 |     RUN sudo rm -rf /var/cache/debconf/* /var/lib/apt/lists/* /tmp/* /var/tmp/*
   5 |     # Fast doc rebuilds do not work because
--------------------
error: failed to solve: failed to fetch anonymous token: unexpected status: 403 Forbidden

I think you need to deposit a secret providing read access similar to what is explained in
https://www.gitpod.io/docs/self-hosted/latest/configuration/docker-registry

That link is for a self-hosted gitpod and thus does not apply to our situation (we don't have a gitpod config other than what is committed in this branch).

I think the issue is that the image sage-docker-gitpod-standard-with-targets is not yet published under sagemath/sage. But how is this then working with your account Matthias?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 14, 2022

comment:147

Replying to @tobiasdiez:

the image sage-docker-gitpod-standard-with-targets is not yet published under sagemath/sage. But how is this then working with your account Matthias?

Because on my testing branch used for the prebuild, I am setting the correct repo:
https://github.com/mkoeppe/sage/blob/mkoeppe-9.5.beta9%2Bupdates/docker/.gitpod.Dockerfile

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 14, 2022

comment:148

(And because every GH workflow automatically has the credentials to access its own GH packages (gchr.io)!)

@tobiasdiez
Copy link
Contributor

comment:149

Ahh okay, I thought this is an environment variable that is picked up somewhere.

So in this case we just have to wait until this ticket is merged, which would then build and publish the docker image to sagemath/sage, right?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 14, 2022

comment:150

Replying to @tobiasdiez:

wait until this ticket is merged, which would then build and publish the docker image to sagemath/sage, right?

Yes, on the next release that includes this branch, the Docker image will be pushed (by separate instances of the workflow) both to gchr.io/sagemath/sage and to gchr.io/sagemath/sagetrac-mirror.

We will then see whether the 403 Forbidden will go away. I think it will not, for workflows run on github.com/sagemath/sagetrac-mirror, because it may not have the read:packages credential for gchr.io/sagemath/sage.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 16, 2022

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 16, 2022

comment:152

Well, no, all packages are already set to "public": For example https://github.com/orgs/sagemath/packages/container/sage%2Fsage-docker-ubuntu-focal-standard-configured/settings

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 16, 2022

comment:154

No, this makes no sense.

@vbraun
Copy link
Member

vbraun commented Feb 12, 2022

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

No branches or pull requests

5 participants