I have a question about build artifacts since I ran into massive problems with them.
- One GitLab server
- One CI build server
- One CI deployment server
I’ve a repository wich contains a number uf Git submodules. Most of these modules are mirrors with read only access. In rare cases it’s necessary to apply patches to some of these submodules. So I write a patch file which is applied during the build process and add that file to the build artifacts.
After building the project the first time the deploy job is started on the deployment server. The first thing the deployment shell executor does is checking out the Git repository. Afterwards the build artifacts are downloaded. Since the GitLab CI shell executor does not update and init the Git submodules, I’ve to do this by my own. And here is the problem: the build artifacts which contains patches for some submdules are already present on the filesystem, and as a reason of that the submodules can not be initialized.
The other problem
After doing a manual git checkout and initialitazion of all submodules on the command line of the deployserver furhter builds will work. But: if I create a patch file in one branch (which is also processed via CI - e.g a test branch) and start a build/deployment ans afterwards build the master branch (which does not have this patch / artifact), the patched file is still available and will be deployed with the current (wrong) branch.
As far as I can see the most straight forward solution would be
.gitlab-ci option for commands executed before the build artifacts are loaded. With this option it would be possible to do a hard reset of all the Git submodules. Another not so elegant alternative could be not adding patch files to build artifacts and apply the patches on the deployment server again.
Am I missing something
Maybe my workflow simply wrong or I miss something. If so please tell how you handle such things