Code snippets to update a file in a gitlab group
We need a snippets to do a small update to a file in all the non-archived projects of a GitLab group.
Ideally, we want to change VERSION: $CI_COMMIT_SHA
to VERSION: commit-$CI_COMMIT_SHORT_SHA
in .gitlab-ci.yml
. We can simply replace the first occurence.
There is some code already in:
- https://gitlab.teklia.com/infra/devops/-/blob/ml-prod-cmds/devops/mlprod/update.py?ref_type=heads (to do the update)
- https://gitlab.teklia.com/infra/devops/-/blob/ml-prod-cmds/devops/mlprod/init.py?ref_type=heads#L46 (iteration over the projects)