Регрессия shallow git fetch в discourse_docker

You’re right, at that time we don’t know the version, it seems the base image uses the current version + tests-passed branch, although the branch will have the commit at the time in which the image was build.

Wouldn’t the way it’s doing now have slower rebuilds, even when tests-passed branch is used?

Just consider the following instructions:

In the base image:

git clone --depth 1 https://github.com/discourse/discourse.git
cd discourse/
git remote set-branches --add origin tests-passed

In web.template.yml

git reset --hard
git clean -f
git remote set-branches --add origin master
git pull
...
When `git pull` is called, **the entire repository is pulled**, and can take several minutes, because only a shallow clone was done before. You can try running just the above instructions locally and see. Not saying that having the entire repository in the base image is better, but the code in `web.template.yml` will run on every rebuild, even if only a plugin was added or a setting was changed in `app.yml`. What I normally do in my (non-discourse) projects is to make a new image for every new version, but that may not be feasible to you (considering how you do it currently). Haven't you perceived some increase in the rebuild time? (or maybe that is not so big compared to the total rebuild time, in most cases)

Update

I tested the above steps again and they were fast. I guess I run another instruction on the 1st try that changed the git tree and ended up trying to pull everything when I run git pull.

2 лайка