Fix ci build docker
For the moment, the construction of docker images in the CI is as follows:
- In the
sync
stage, at each MR, if a docker image does not exist, then it is created from its respective image in maindocker-name:main
under the namedocker-name:branch-name
. - In the
prepare
stage, each time an RM branch (ormain
) is modified with changes in/docker
or in the.gitlab-ci-build-docker.yml
file, the docker images are played under the name:docker-name:branch-name
(resp.docker-name:main
).
Several problems then arise:
- All MRs, which add a new docker image, will fail in
sync
since their docker image can't be created frommain
since it doesn't exist. - All MRs, which are not modifying docker images, will be forced to use the version of docker images from
main
at the time of their creation. This implies that:- All MRs which target branches which have different docker images to
main
will fail. - Each time a docker image of
main
changes, all the MRs created before this change (and which do not themselves modify the docker images), will not have these changes after rebasing onmain
.
- All MRs which target branches which have different docker images to
To avoid this kind of error, one solution would be to set in the sync
stage, for each MR, for each docker image:
- If the docker image exists for the target branch then the image in its source branch
docker-name:source-branch-name
is created from its respective image in its target branchdocker-name:target-branch-name
. - Otherwise, if the
docker-name:source-branch-name
image already exists, nothing is done. - Otherwise, the
docker-name:source-branch-name
image is built.
Edited by Palmer Sébastien