Metadrop / drupal-boilerplate

Drupal projects up and running with Docker and many other tools in minutes
28 stars 23 forks source link

Make the update helper command easier to run #108

Open omarlopesino opened 1 year ago

omarlopesino commented 1 year ago

Problem description

Currently, the update helper command needs a list of parameters that are always repeated: the author and the environment list (drush aliases of the local sites). The main problem is that the environment list may become pretty large and missing one environment leads to the configuration of that site not being correctly consolidated. Also, the author's parameter syntax may become tricky and can lead to human errors.

Proposed solution

Create two make commands:

The author and the environment will be configurable in the Makefile. The environment list must be the list of drush aliases, each alias is a specific site of the project.

The author is the git commit author of the updates, it will be always the same. It must be decided by the team thinking that the author should be a git user that will never be removed from the project. So it should be a development account that is not related to any developer that may leave the project.

Pending tasks

How to set the author in composer create-project installations. if it is not set, the make update command won't work the first time.

Proposed solutions:

a) Ask for the git author in the composer create-project execution. b) Set the git author in the composer create-project execution with the current git author information of the local user.

omarlopesino commented 1 year ago

I would like opinion about what is commented in the Pending tasks section.

In my opinion I think a) is okay but I would like to know if it is okay for everyone.

About the b) solution, I think it will lead to adding the developer author to all the updates done and that leads to:

cc @jorgetutor @rsanzante @juanjol

jorgetutor commented 1 year ago

IMO the update command should use a default git user if the param is not set or empty, something generic like "script@drupal-update" (thinking in the new name of the repository). I think this is key, as the script can be run without the boilerplate

The make file will have this declared but empty, and the user can change it manually or as part of the composer install.

rsanzante commented 1 year ago

There are two situations where this command is run:

  1. A dev runs it on their local machine
  2. An automated agent runs it

On case 1) I think commits should have the dev's Git info because that dev is directly responsible of the commits. On case 2) I agree commits should be done by a Git user related to the agent that performs the update action.

We can do this:

I'm not sure were to save that info. The Makefile seems like a bad place because it a file with commands. It should read the conf from another place. The .env file is an option, but that's relates to and environment, not the whole project.

About getting the Git info to store, I guess it is ok to ask it on the create project run.

rsanzante commented 1 year ago

I agree on the default fallback when there's no git info available.

omarlopesino commented 1 year ago

AFter a talk we have decided to not add the author. The update helper script will add a default author if it is not set. Thanks for the proposals.