mehrancodes / laravel-harbor

a cli tool to Quickly create on-demand preview environment for your app on Laravel Forge.
https://www.laravel-harbor.com
MIT License
75 stars 7 forks source link

Extending to include other services #100

Open neilgilmour opened 6 months ago

neilgilmour commented 6 months ago

I much prefer working in PHP than GitHub actions, so what I'm imagining here is being able to write some of the other steps of my preview workflow as classes that can be added to the pipeline. Maybe with hooks to add classes before and after the existing pipeline, or by overriding existing classes like in laravel-shift/blueprint.

For example instead of GitHub issues we use Linear. The Linear/GitHub integration is a great start, but I have a few other steps that I use;

  1. Check the PR relates to a Linear issue
  2. provision
  3. update linear issue status and comment with preview url

I don't have the skill to PR this, but if @mehrancodes would accept something like this I'd be happy to sponsor the work.

mehrancodes commented 6 months ago

Having the Linear integration looks fantastic! I think it would be nice to have some hooks during the provision/teardown process as there are still many custom setups we may need to have based on the project's requirements.

Also, extensions installable via composer could be the perfect fit. As everyone can add their steps and even share their use-case publicly!

I think this one is possible by introducing a new environment variable accepting an array of installed packages - and maybe the step where you would like to use this package. Any thoughts?

mehrancodes commented 5 months ago

@neilgilmour could you please tell me a little more about the steps where you want to add your functionality? (your extensions)

On the provision command we have 14 steps already that I think we could add before/after events for each one, to trigger an extension to run:

Global steps:

  1. FindServer
  2. FindSiteOrFail

Provision steps

  1. OrCreateNewSite
  2. NginxTemplateSearchReplace
  3. CreateDatabase
  4. InstallGitRepository
  5. ObtainLetsEncryptCertification
  6. EnableQuickDeploy
  7. UpdateEnvironmentVariables
  8. UpdateDeployScript
  9. DeploySite
  10. RunOptionalCommands
  11. EnsureJobScheduled
  12. PutCommentOnPullRequest
  13. AnnounceSiteOnSlack
  14. EnableInertiaSupport

Teardown steps:

  1. RemoveInertiaSupport
  2. RunOptionalCommands
  3. RemoveTaskScheduler
  4. RemoveDatabaseUser
  5. DestroySite