Automatic Building of openedx Image

Hello,

I searched through the forums and docs, so I appoligize if I missed it. Is there a configuration setting that I could pass so when I run tutor local quickstart -I it automatically runs tutor images build openedx in the correct spot?

Thanks!

1 Like

Hi Tom,

we’ve struggled with that as well, and have not come up with a good solution to fully automate this. Right now, we’re using a CI variable that holds the space-separated list of images to be rebuilt. We call it BUILD_IMAGES. During our CI run, we invoke tutor images build $BUILD_IMAGES, which builds the images we need (and is a no-op if the list is empty).

So, if there is a change to the configuration that requires the openedx image to be rebuilt, what we do is

  1. Bump the version number in the OPENEDX_DOCKER_IMAGE variable (to something like https://myregistry.some.thing/myopenedximage:13.2.0-1, assuming the prior image reference was https://myregistry.some.thing/myopenedximage:13.2.0-0).
  2. Set BUILD_IMAGES to "openedx".
  3. Commit and push.
  4. Let the CI build the image, push it to the registry, and redeploy containers with the new image.
  5. Unset BUILD_IMAGES.

If we need to update two images at a time, say because both Tutor and tutor-mfe got a new release, we would set BUILD_IMAGES to something like "openedx mfe".

If there’s a better way to do this, I’d love to hear about it. But please note that what you propose, namely just rebuilding the openedx image when needed, would be rather short-sighted: this is an issue that applies not only to Tutor proper, but also to all Tutor plugins that build custom images.

I think the issue here is that fundamentally, Tutor does not keep state. In other words, if you make a change to config.yml, then Tutor will simply generate its env from it, but it doesn’t generate a transition graph from env as it looked according to the previous config.yml. Thus it has no way of knowing that something changed, and therefore can’t internally react to such transitions. It’s the CI that would need to detect that change.

So your CI could run tutor config save from current git HEAD and compare it to the result of tutor config save from HEAD^, and then decide that it needs to rebuild images, but I don’t really see how Tutor could natively do what you’re asking for.

@regis, is that about accurate? Please stop me if I’m spouting nonsense. :slight_smile:

Cheers,
Florian

Hi Florian,

Thanks for this, it gives me something to think about. We are still trying how we could put Tutor into a CI environment for our use, but I haven’t come up with a way to do that, since we just have some simple plugins and theme at this time.

I was just basing my request/question off the fact that quickstart seems to always rebuild the tutor-mfe image.

Thanks!
Tom

You might be interested in the recently introduced COMPOSE_PROJECT_STARTED action. With this action, you can trigger a re-build of the images of your choice every time the start command is run (including during quickstart).