Skip to content

chore(housekeeping): Create a helper for change detection functionality#2610

Merged
polarathene merged 10 commits intodocker-mailserver:masterfrom
polarathene:chore/extract-change-helper
Jun 4, 2022
Merged

chore(housekeeping): Create a helper for change detection functionality#2610
polarathene merged 10 commits intodocker-mailserver:masterfrom
polarathene:chore/extract-change-helper

Conversation

@polarathene
Copy link
Copy Markdown
Member

Description

No functionality changes. Housekeeping change to better organize the supporting change detection functionality by co-locating to a single helper script.


Reasoning and changes covered

The initial PR that split up the original helper-functions.sh into separate helper scripts moved CHKSUM_FILE global var into helpers/index.sh and _monitored_files_checksums() into helpers/ssl.sh. It seemed more appropriate to migrate these into their own helper script.

I assume @georglauterbach kept CHKSUM_FILE in helpers/index.sh so it would not matter what order the scripts are sourced in, which is a valid concern. As we're not using it anywhere else with the introduction of this new helper, I think that is no longer a concern?

I have additionally extracted out the related support from setup-stack.sh. start-mailserver.sh will still call setup-stack.sh:_setup which now calls the relevant helper method (with a revised comment). This seemed a better place to locate the call, but I'm open to reverting that.

Besides check-for-changes.sh, the helper makes functionality available to container startup scripts to initialize the CHKSUM_FILE content once container setup scripts complete, and co-locates everything the common.bash test helper method wait_for_changes_to_be_detected_in_container() needs for it's functionality.

Type of change

  • Improvement (non-breaking change that does improve existing functionality)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes

This doesn't really belong in `helpers/ssl.sh`. Moving to it's own helper script.
It seems relevant to migrate the related support during startup for the change detection feature into this helper.

I opted to move the call from `start-mailserver.sh` into the `_setup` call at the end for a more explicit/visible location.
It belongs there, not in `helpers/index.sh`.
@polarathene polarathene added priority/low area/scripts kind/improvement Improve an existing feature, configuration file or the documentation labels May 31, 2022
@polarathene polarathene added this to the v11.1.0 milestone May 31, 2022
@polarathene polarathene self-assigned this May 31, 2022
@georglauterbach georglauterbach self-requested a review May 31, 2022 07:11
Copy link
Copy Markdown
Member

@georglauterbach georglauterbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it 👍🏼 LGTM

Presently `test/test_helper.bats` is using it's own  `CHKSUM_FILE` instead of sourcing the var for the filepath.

`test_helper/common.bash` was calling a method to check for changes, but this helper may not correctly detect letsencrypt related changes as these are not ENV rely on, but global vars handled by `helpers/dns.sh`, so that should be run first like it is for `check-for-changes.sh`.
@polarathene polarathene requested a review from a team June 4, 2022 04:15
@polarathene polarathene merged commit c862e14 into docker-mailserver:master Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/scripts kind/improvement Improve an existing feature, configuration file or the documentation priority/low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants