ModuleSync is used to keep configuration files of all of our different projects up to date and in sync.
It works by compiling the .erb
templates in the moduleroot
folder using variables from config_defaults.yml
and project-specific ones from .sync.yml
(in the respective project repository).
A pull request is then be opened for each project in managed_modules.yml
affected by these changes.
To check which changes will be affecting our projects, you can dry run a comparison locally.
To check out the code of the projects, you will need to set up a GitHub access token.
Go to GitHub user settings and create a personal access token with the following settings:
- Token name:
RegioHelden ModuleSync
- Resource owner:
RegioHelden
- Expiration: as desired, ideally not without expiration
- Repository access:
Public repositories
GITHUB_TOKEN=<YOUR_TOKEN_FROM_ABOVE>
To see the updates on the target projects that would result from your changes
docker compose up
Each project can have a .sync.yml
file, which will overwrite settings from the global config (see config_defaults.yml
)
An example .sync.yml
file will look like this one
---
:global:
python_min_version: "3.11"
module_rootname: "django_library"
module_description: "This lib does awesome things to your Django app"
module_keywords: ["django", "awesome"]
.devcontainer/devcontainer.json:
run_services: ["app", "db"]
It's also possible to mark files as unmanaged in .sync.yml
compose.yaml:
unmanaged: true
Make sure branches are deleted after merge so that modulesync always starts clean
- As a repository admin
- Go to the repository settings
- Scroll down to the
Pull requests
section - Check
Automatically delete head branches
Set proper values for GIT_AUTHOR_NAME
, GIT_COMMITTER_NAME
, GIT_AUTHOR_EMAIL
and GIT_COMMITTER_EMAIL
in .github/workflows/update.yaml
- Use the username of the user that should open the modulesync MRs as
GIT_AUTHOR_NAME
andGIT_COMMITTER_NAME
- Use the anonymous committer email address of that user as
GIT_AUTHOR_EMAIL
andGIT_COMMITTER_EMAIL
- As the user running modulesync
- Click on your profile picture in the top right corner
- Go to
Settings
- Under
Access
selectEmails
- Under
Primary email address
, your anonymous committer email is listed in the explanation text
Set up SSH key
- Create an SSH key
- Run
ssh-keygen -t ed25519
- Don't set a passphrase
- Run
- Make the private part available as secret
MODULESYNC_SSH_PRIVATE_KEY
on this repository- As a repository admin
- Go to repository settings
- Under
Security
, openSecrets and variables
and selectActions
- Click
New repository secret
- Use
MODULESYNC_SSH_PRIVATE_KEY
asName
- Set the private part of the SSH key as
Secret
- Add the public part as authentication key
- As the user running modulesync
- Click on your profile picture in the top right corner
- Go to
Settings
- Go to
Developer Settings
- Under
Access
, selectSSH and GPG keys
- Click
New SSH key
- Use
ModuleSync commit key
asTitle
- Use
Authentication Key
asKey type
- Set the public part of the SSH key as
Key
- Add the public part as signing key
- As the user running modulesync
- Click on your profile picture in the top right corner
- Go to
Settings
- Go to
Developer Settings
- Under
Access
, selectSSH and GPG keys
- Click
New SSH key
- Use
ModuleSync signing key
asTitle
- Use
Signing Key
asKey type
- Set the public part of the SSH key as
Key
Create a personal access token and make it available as secret MODULESYNC_PERSONAL_ACCESS_TOKEN
on this repository
- Create the token
- As the user running modulesync
- Click on your profile picture in the top right corner
- Go to
Settings
- Go to
Developer Settings
- Open
Personal acccess tokens
and selectFine grained tokens
- Click
Generate new token
- Select the organization owning the managed repos as
Resource owner
- Select that the token never expires
- Select
All repositories
forRepository access
- Select the following
Repository permissions
Metadata
read onlyPull requests
read and write
- Copy that token!
- Make the token available
- As a repository admin
- Go to repository settings
- Under
Security
, openSecrets and variables
and selectActions
- Click
New repository secret
- Use
MODULESYNC_PERSONAL_ACCESS_TOKEN
asName
- Set the just copied PAT as
Secret
Commit the changes to a pull request on this repo. The build pipeline will first do a dry run for the reviewer to be able to check the changes.
When this PR is merged into the main branch, another pipeline job will create the PRs on the target projects.
See https://github.com/voxpupuli/modulesync for more details.