Add options to enable/disable hooks (sending mail, commit /etc/.git, save to database…) #7

Merged
jlecour merged 61 commits from options into master 2019-03-26 15:14:12 +01:00
Owner

With a few options we can choose (from configuration or on-the-fly) :

  • HOOK_MAIL=<0|1> or --[no-]mail : send an email, or not
  • HOOK_DB=<0|1> or --[no-]db : save log in the database, or not
  • HOOK_COMMIT=<0|1> or --[no-]commit : commit repository changes, or not
  • DRY_RUN=<0|1> or -n|--dry-run : execute no hooks, but prit the options values
With a few options we can choose (from configuration or on-the-fly) : * `HOOK_MAIL=<0|1>` or `--[no-]mail` : send an email, or not * `HOOK_DB=<0|1>` or `--[no-]db` : save log in the database, or not * `HOOK_COMMIT=<0|1>` or `--[no-]commit` : commit repository changes, or not * `DRY_RUN=<0|1>` or `-n|--dry-run` : execute no hooks, but prit the options values
Author
Owner

I also want to change the prompt of the interactive mode to ask if hooks must be skipped or not, but I don't have any idea how yet.

I also want to change the prompt of the interactive mode to ask if hooks must be skipped or not, but I don't have any idea how yet.
Author
Owner

I've figured it out 🎉

First we need to find out if the script is run in interactive mode or not.

If not, we just apply the options for the hooks.
If yes, each hook asks a question to run it or not. The default value is implied by the option.

I've also added a verbose mode to show the content of the mail, the DB query and the repositories diffs.
The "dry run" mode becomes silent. It "just" removes the hook execution.
The two of them applied together is useful to verify the general behaviour of the script without changing anything on the host.

I'm very satisfied with how it turned out.
Now I need to do a lot of testing on many Debian ans OpenBSD versions.

I've figured it out :tada: First we need to find out if the script is run in interactive mode or not. If not, we just apply the options for the hooks. If yes, each hook asks a question to run it or not. The default value is implied by the option. I've also added a verbose mode to show the content of the mail, the DB query and the repositories diffs. The "dry run" mode becomes silent. It "just" removes the hook execution. The two of them applied together is useful to verify the general behaviour of the script without changing anything on the host. I'm very satisfied with how it turned out. Now I need to do a lot of testing on many Debian ans OpenBSD versions.
Author
Owner

Now we can also customize the mail recipient on the fly!

Now we can also customize the mail recipient on the fly!
Author
Owner

I've added --version and --help options.
The help message gives a lot of informations, almost like a man page.

I've also improved the POSIX compatibility.

I've added `--version` and `--help` options. The help message gives a lot of informations, almost like a man page. I've also improved the POSIX compatibility.
Author
Owner

As discussed AFK, we'll explore a few changes :

  • display git statuses before typing the message
  • add the timezone of the server in the metadata
  • execute evocheck (if present) and display results
  • add the maintenance message to /etc/motd (keep the last few only)
  • execute the DB hook after the mail hook
  • add an "auto" mode to have only one keystroke in most cases
As discussed AFK, we'll explore a few changes : * [x] display git statuses before typing the message * [ ] add the timezone of the server in the metadata * [x] execute evocheck (if present) and display results * [ ] add the maintenance message to `/etc/motd` (keep the last few only) * [x] execute the DB hook after the mail hook * [x] add an "auto" mode to have only one keystroke in most cases
First-time contributor

We also talked about removing the copyright notice from --help and keeping it in --version instead. As well as removing the version number from --help.

I will create an issue for the man(1) page.

We also talked about removing the copyright notice from --help and keeping it in --version instead. As well as removing the version number from --help. I will create an issue for the man(1) page.
Author
Owner

new things to do :

  • verify that it works in auto mode from cron
  • display more Git information
  • add options values + actual email address to the log file
  • switch the project to public visibility
new things to do : * [x] verify that it works in auto mode from cron * [x] display more Git information * [x] add options values + actual email address to the log file * [x] switch the project to public visibility
jlecour changed title from WIP: Add options to enable/disable hooks (sending mail, commit /etc/.git, save to database…) to Add options to enable/disable hooks (sending mail, commit /etc/.git, save to database…) 2019-03-26 15:12:37 +01:00
jlecour closed this pull request 2019-03-26 15:14:12 +01:00
jlecour deleted branch options 2019-03-26 15:29:30 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: evolix/evomaintenance#7
No description provided.