Github repo with extended documentation.
multigitter
works by running a script (in eventually any scripting language) that interacts with the repositories of a git forge instance (GitLab, GitHub…) creating a MR with the new changes.
To use it we must:
a) Create (or choose & adapt) the script that generates the changes that we want to massively introduce in the repositories
b) Run this script with multi-gitter
In this example we’ll change the version of a variable in several Ansible inventories.
curl -s https://raw.githubusercontent.com/lindell/multi-gitter/master/install.sh | sh
Obtain a Personal Access Token from Gitlab (api
, read_repo
and write_repo
scopes).
Generate the config dir and file
mkdir ~/.multi-gitter
touch ~/.multi-gitter/config
# The platform that is used. Available values: github, gitlab, gitea, bitbucket_server.
platform: gitlab
# The GitHub/GitLab personal access token. Can also be set using the GITHUB_TOKEN/GITLAB_TOKEN/GITEA_TOKEN/BITBUCKET_SERVER_TOKEN environment variable.
token: <token>
# Base URL of the GitHub API, needs to be changed if GitHub enterprise is used. Or the url to a self-hosted GitLab instance.
base-url: https://git.coopdevs.org
# The name of a GitLab organization. All repositories in that group will be used.
group:
- Coopdevs/odoo/inventories
# The name of the branch where changes are committed.
branch: odoo_role_v0_8
# The commit message. Will default to title + body if none is set.
commit-message: Bump odoo_role version to v0.8
# The body of the commit message. Will default to everything but the first line of the commit message if none is set.
pr-body:
# The title of the PR. Will default to the first line of the commit message if none is set.
pr-title:
# Run without pushing changes or creating pull requests.
dry-run: false
# Take manual decision before committing any change. Requires git to be installed.
interactive: false
# The maximum number of concurrent runs.
concurrent: 1
# What should happen if the branch already exist.
# Available values:
# skip: Skip making any changes to the existing branch and do not create a new pull request.
# replace: Replace the existing content of the branch by force pushing any new changes, then reuse any existing pull request, or create a new one if none exist.
conflict-strategy: skip
# Create pull request(s) as draft.
draft: false
# Limit fetching to the specified number of commits. Set to 0 for no limit.
fetch-depth: 1
# The type of git implementation to use.
# Available values:
# go: Uses go-git, a Go native implementation of git. This is compiled with the multi-gitter binary, and no extra dependencies are needed.
# cmd: Calls out to the git command. This requires git to be installed and available with by calling "git".
git-type: go
# Include GitLab subgroups when using the --group flag.
include-subgroups: true
# The file where all logs should be printed to. "-" means stdout.
log-file: "-"
# The formating of the logs. Available values: text, json, json-pretty.
log-format: text
# The level of logging that should be made. Available values: trace, debug, info, error.
log-level: info
# The file that the output of the script should be outputted to. "-" means stdout.
output: "-"
# Use SSH cloning URL instead of HTTPS + token. This requires that a setup with ssh keys that have access to all repos and that the server is already in known_hosts.
ssh-auth: false
nano replace.sh
#!/bin/bash
# Assuming you are using gnu sed, if you are running this on a mac, please see https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failin>
find ./ -type f -exec sed -i -e 's/v0.7.10/v0.8/g' {} \;
chmod +x replace.sh
--dry-run
and --interactive
flags:multi-gitter run ./replace.sh --dry-run --interactive
--interactive
flag is present, for each matching change, you will be asked if you want (V)iew changes. (A)ccept or ®eject. Changes were made to coopdevs/odoo/inventories/odoo-coopdevs-treball-inventory
(V)iew changes. (A)ccept or (R)eject
You can press V
in order to see the proposal changes and then A
to accept them.
Showing changes...
diff --git a/inventory/group_vars/all.yml b/inventory/group_vars/all.yml
index fa472cd..323e52b 100644
--- a/inventory/group_vars/all.yml
+++ b/inventory/group_vars/all.yml
@@ -13,7 +13,7 @@ odoo_role_odoo_release: "12.0_2022-02-01"
odoo_role_odoo_url: "https://gitlab.com/coopdevs/OCB/-/archive/{{ odoo_role_odoo_release }}/OCB-{{ odoo_role_odoo_release }}.tar.gz"
# Odoo provisioning
-odoo_provisioning_version: "v0.7.10"
+odoo_provisioning_version: "v0.8"
domains: "{{ [ inventory_hostname ] }}"
Accepted, proceeding...
No data was changed:
coopdevs/odoo/inventories/odoo-inventory-template
coopdevs/odoo/inventories/odoo-mitxelena-inventory
coopdevs/odoo/inventories/odoo-garau-inventory
coopdevs/odoo/inventories/odoo-vertical-habitatge-inventory
coopdevs/odoo/inventories/odoo-vertical-carsharing-inventory
coopdevs/odoo/inventories/odoo-test-14-inventory
coopdevs/odoo/inventories/odoo-onaro-inventory
coopdevs/odoo/inventories/odoo-supercoop-inventory
coopdevs/odoo/inventories/odoo-subbeticaecologica-inventory
coopdevs/odoo/inventories/odoo-astindu-inventory
coopdevs/odoo/inventories/odoo-test-15-inventory
coopdevs/odoo/inventories/odoo-tmf-inventory
coopdevs/odoo/inventories/odoo-capfoguer-inventory
coopdevs/odoo/inventories/odoo-ecos-inventory
coopdevs/odoo/inventories/odoo-laclosca-inventory
coopdevs/odoo/inventories/odoo-lakari-inventory
coopdevs/odoo/inventories/odoo-ov-inventory
coopdevs/odoo/inventories/odoo-somconnexio-inventory
coopdevs/odoo/inventories/odoo-somenergia-inventory
coopdevs/odoo/inventories/odoo-terranostra-inventory
coopdevs/odoo/inventories/odoo-test-12-inventory
coopdevs/odoo/inventories/odoo-ulldecona-inventory
coopdevs/odoo/inventories/odoo-opcions-inventory
Repositories with a successful run:
coopdevs/odoo/inventories/odoo-energiabonita-inventory #0
coopdevs/odoo/inventories/odoo-la-borda-inventory #0
coopdevs/odoo/inventories/odoo-bibaardoak-inventory #0
coopdevs/odoo/inventories/odoo-somalimentacio-inventory #0
coopdevs/odoo/inventories/odoo-lafeixa-inventory #0
coopdevs/odoo/inventories/odoo-agranel-inventory #0
coopdevs/odoo/inventories/odoo-coopdevs-treball-inventory #0
coopdevs/odoo/inventories/odoo-aresta-inventory #0
coopdevs/odoo/inventories/odoo-artiga-inventory #0
coopdevs/odoo/inventories/odoo-colectic-inventory #0
coopdevs/odoo/inventories/odoo-enllac-inventory #0
coopdevs/odoo/inventories/odoo-facto-inventory #0
coopdevs/odoo/inventories/odoo-femprocomuns-inventory #0
coopdevs/odoo/inventories/odoo-foodcoopbcn-inventory #0
coopdevs/odoo/inventories/odoo-olatukoop-inventory #0
multi-gitter run ./replace.sh