-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Per default, comin searches for the main branch, defined via services.comin.remotes.*.branches.main.name (default main) and for a specific feature branch called testing-${config.services.comin.hostname}, defined via services.comin.remotes.*.branches.testing.name.
When developing with merge requests, usually we do not want to use the same feature branch twice. If at this point, we want to use a differently named feature branches, we first have to commit the feature branch name to this host's main. Only then can we start developing on that branch.
Only then can we start developing on the feature branch and use the testing branch feature.
To ease this process, I would like to introduce another option called services.comin.remotes.*.branches.testing.nameRegex or services.comin.remotes.*.branches.testing.nameGlob (or both).
With that, we can define a pattern for all future feature branches.
In that case, a user could define their flake e.g. as:
{
inputs = {
nixpkgs.url = "github:nixOS/nixpkgs";
comin = {
url = "github:nlewo/comin";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, comin }: {
nixosConfigurations = {
myMachine = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
comin.nixosModules.comin
({config, ...}: {
services.comin = {
enable = true;
remotes = [{
name = "origin";
url = "https://gitlab.com/your/infra.git";
branches.main.name = "main";
branches.testing.nameRegex = "(feat|fix|testing|foo)/${config.services.comin.hostname}/.*"
}];
};
})
];
};
};
};
}With that, the user could then create feature branches like testing/myMachine/new-feature-a fix/myMachine/bug-in-service-xy.
With that, a new question arises though: A branch selection algorithm.
As long as only a single feature branch exists at a time, there should not be any issues. That is because comin only accepts feature branches that are based on the current main HEAD.
If two branches follow that pattern, we could:
a) throw an error and exit
b) use the branch that matches first alphabetically
c) use the branch that has the most recent changes
Before I start testing and developing such a feature, I would like to ask, if this idea is acceptable. Thank you very much.