I'd like to patch the /usr/bin/propellor
wrapper to check for two environment variables. I'm posting my proposal here to see whether Joey would be willing to merge such a patch before starting to write it.
Proposal
if the branch currently checked out in the
~/.propellor
repository does not matchPROPELLOR_SPIN_BRANCH
, Propellor would refuse to spinif the
PROPELLOR_DIRTY_NOSPIN
variable is set, Propellor would refuse to spin if the~/.propellor
repository contains uncommitted changes
Rationale
PROPELLOR_SPIN_BRANCH
is to prevent foot-shooting. When working on a feature branch one might forget to check out one's usual config branch before spinning. If the host that is spun is configured with Cron.runPropellor
, it will be set to pull from the feature branch. If the user doesn't realise that this has happened, they might make further commits to their usual config branch and expect them to have propagated to the host by means of its Cron.runPropellor
cronjob, but they won't reach the host until the next manual spin from the correct branch. Of course there are other possible foot-shootings available in this area that this environment variable would prevent.
PROPELLOR_DIRTY_NOSPIN
is to prevent configuration changes ending up in commits made with the undescriptive commit message "propellor spin". I understand that it doesn't bother Joey, but I want all configuration changes to be recorded with a descriptive commit message because it makes using git revert
and git cherry-pick
easier. So for users like me this environment variable is a useful check.
I'd use
PROPELLOR_SPIN_BRANCH
. No objections toPROPELLOR_DIRTY_NOSPIN
as long as it's not default.Note that Cron.runPropellor does not use /usr/bin/propellor, and there are other ways of running propellor that don't use that wrapper. So I don't think the wrapper is the place to implement this kind of thing.
Why use environment variables for configuration? That makes it hard to make sure propellor gets the same configuration every way it can be run. And, propellor has a config file.
Implementation could be something like, add a
configuredMain
that takes a monoidial configuration value for such global config settings. (sodefaultMain = configuredMain mempty
)Hmm, I suppose the issue with
PROPELLOR_SPIN_BRANCH
is that when a different branch is checked out, that branch's config.hs would not have that configured, or would perhaps set it to use that branch. So, that's why you were thinking environment variables?Maybe use git-config?
I was thinking environment variables because I saw both of these as just safety checks for the user, spinning hosts from their xterm on their laptop. I'll implement both as
git-config
variables; that's a good idea as it covers more cases.I don't think that this patch need touch the propellor executable run by
Cron.runPropellor
, because if the check has already ensured that the correct branch got pushed to the host during the most recent spin, thenpropellor_cronjob
is guaranteed to pull the correct branch.I've implemented these in the
safetychecks
branch ofhttps://git.spwhitton.name/propellor
.A nice side effect of my implementation is that the spin only errors out after there's been an attempt to compile Propellor. So you can run
propellor --spin
in order to have GHC typecheck your code on a feature branch.