Rebuilding from a change in a fork?

I ran into a small problem and whatever I do, I am unable to push the fix to my tutor installation.

I did use the following instructions in order to create an image with my fork:
tutor images build openedx
–build-arg EDX_PLATFORM_REPOSITORY=https://mygitrepo/edx-platform.git
–build-arg EDX_PLATFORM_VERSION=my-tag-or-branch

But then I needed to apply a fix to my fork and push it to Github. I made that change outside of Tutor obviously. Whatever I try afterwards, I am unable to build the images again because it keeps using the cache and therefore it doesn’t pickup my changes. That’s frustrating.

Is there a trick to rebuild the images based on my fork after I make a change to it?

I am running out of ideas.

1 Like

I figured it out. I guess I might have forgot to do a “tutor local stop” and a “tutor local start” after rebuilding the image.

I see the change now.

But that doesn’t always work. I ran into the same problem again where

tutor images build openedx
–build-arg EDX_PLATFORM_REPOSITORY=https://mygitrepo/edx-platform.git
–build-arg EDX_PLATFORM_VERSION=my-tag-or-branch

would still use the old image even if I had passed different arguments than what the Dockerfile is telling me

Step 17/99 : ARG EDX_PLATFORM_REPOSITORY=https://github.com/openedx/edx-platform.git
—> Using cache
—> fc32f8e07459
Step 18/99 : ARG EDX_PLATFORM_VERSION=open-release/maple.2
—> Using cache
—> 573d76854fc1

Is there a way to delete an image?

I am sorry if I am not a docker or tutor expert yet, but this is annoying and very frustrating.

Hi @sambapete ,

There was a simple way by using tutor images build openedx --no-cache

Notice, for repository and branch, I think you can fix it as hardcoded if you already forked tutor repository at your side.

If you still using your previous way, let using

tutor images build openedx
--build-arg EDX_PLATFORM_REPOSITORY=https://mygitrepo/edx-platform.git
--build-arg EDX_PLATFORM_VERSION=my-tag-or-branch
--no-cache
2 Likes

Thanks @thinnguyen
I will definitely try it the next time I face this problem.

The reason that @thinnguyen’s solution is working is that Docker is using its layer cache. The same EDX_PLATFORM_VERSION version number points to two different versions but Docker has no way to know about that.

After building the image, you do not have to run tutor local stop && tutor local start. Instead, you can simply run tutor local start -d and the new images will be picked up automatically.

2 Likes

i am getting this error after running the command

From https://github.com/open-craft/edx-platform
 * branch            03731f19459e558f188c06aac5cc9ca1bbc675c2 -> FETCH_HEAD
Auto-merging lms/djangoapps/discussion/tests/test_tasks.py
Auto-merging lms/djangoapps/discussion/tasks.py
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git cherry-pick --skip'
On branch harshgaur14-dev
Your branch is up to date with 'origin/harshgaur14-dev'.

You are currently cherry-picking commit 03731f1.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

nothing to commit, working tree clean
The command '/bin/sh -c git fetch --depth=2 https://github.com/open-craft/edx-platform/ 03731f19459e558f188c06aac5cc9ca1bbc675c2 && git cherry-pick 03731f19459e558f188c06aac5cc9ca1bbc675c2' returned a non-zero code: 1
Error: Command failed with status 1: docker build -t docker.io/overhangio/openedx:13.2.2 --no-cache --build-arg EDX_PLATFORM_REPOSITORY=https://github.com/Harshgaur14/edx-platform.git --build-arg EDX_PLATFORM_VERSION=harshgaur14-dev /root/.local/share/tutor/env/build/openedx

@regis @sambapete @thinnguyen please guide me