Modify file structure after merging

Goodday everyone,

I am trying to automate the release of a web-project using CI/CD in gitlab (hosted by gitlab.com) . The setup I have currently is a framework/backend-git and a content-git (as a submodule). (see complete git setup below)

Branches:

  • master
    | - submodule (latest)
  • development
    | - submodule (might not be up-to-date)

The idea is to push/merge from the development branch to the master branch once a backend update is ready. And use CI/CD to do the following:

  • push/merge all from the development-branch
  • update submodule to the latest version (overwriting the development-branches version)
  • remove files containing debug scripts etc.
  • changing content of config files (either a binary modification, text modification, or simply a complete file replacement from a subdirectory/other repo/cloud)
  • add license files (from a subdirectory/other repo/cloud)
  • push to live server-root through ssh protocol/ftp

My question is not a ready-to-use script (that would take the fun out of discovering the possibities). I have only 2 questions:

  1. When messing around with git during a merge_request pipeline trigger, I notice it is initializing/rebuilding a git. Does this mean it creates a virtual workspace for the CI/CD to do its thing? (and is it a virtual git-repo before or after merge? ) When it’s a virtual git-repo after merging, it would imply that any changes to the file structure using the commandline will be discarded after the pipeline finnishes.

  2. I notice that gitlab.com uses the ruby docker image by default. Am I still able to use ‘shell like’ commands to modify/remove/add/move files (as described in the list I want to achieve)? If there is some documentation about that I would love to know. Alternatively, is there a better solution to achieve this? (I noticed that the ‘shell’ image is not supported on gitlab.com, which makes sence since the gitlab-runner is not installed localy).

Thanks in advance,
N247S