Skip to content

Cannot trigger lando commands in a git hook #904

@drupov

Description

@drupov

It's not possible for me to trigger any lando command, when called from a git hook.

I have a very basic .lando file:

name: test
recipe: drupal7
config:
  webroot: www

and a single pre-commit hook like this

05:31:12 {master} ~/Desktop/test$ cat .git/hooks/pre-commit
#!/bin/bash

echo "Output of 'lando'"
lando -- -v

echo "Output of 'lando drush'"
lando drush -- -v

I run lando start then add any file change and execute

05:32:18 {master} ~/Desktop/test$ git add .
05:32:25 {master} ~/Desktop/test$ git commit

Output of 'lando'
info: Bootstraping...
info: Configuring app plugin
info: Configuring engine plugin
info: Configuring proxy plugin
info: Initializing proxy plugin
info: Configuring services plugin
info: Initializing app plugin
info: Initializing engine plugin
info: Initializing events
info: Initializing init framework
info: Initializing recipes plugin
info: Initializing services
info: Initializing tooling plugin
info: Initializing core plugin
info: Bootstrap completed.
info: Initializing cli
info: App test is ready!
Usage: lando <command> [args] [options] [-- global options]

Commands:
  composer                 Run composer commands
  config                   Display the lando configuration
  db-export [file]         Export a database. Resulting file: {DB_NAME}.TIMESTAMP.gz
  db-import [file]         Import into database.
  destroy [appname]        Destroy app in current directory or [appname]
  drush                    Run drush commands
  info [appname]           Prints info about app in current directory or [appname]
  init [method]            Initialize a lando app, optional methods: github, pantheon
  list                     List all lando apps
  logs [appname]           Get logs for app in current directory or [appname]
  mysql                    Drop into a MySQL shell
  php                      Run php commands
  poweroff                 Spin down all lando related containers
  rebuild [appname]        Rebuilds app in current directory or [appname]
  restart [appname]        Restarts app in current directory or [appname]
  share [appname]          Get a publicly available url
  ssh [appname] [service]  SSH into [service] in current app directory or [appname]
  start [appname]          Start app in current directory or [appname]
  stop [appname]           Stops app in current directory or [appname]
  version                  Display the lando version

Global Options:
  --help, -h  Show help
  --verbose, -v, -vv, -vvv, -vvvv  Change verbosity of output

Unknown argument: -v
Output of 'lando drush'
info: Bootstraping...
info: Configuring app plugin
info: Configuring engine plugin
info: Configuring proxy plugin
info: Initializing proxy plugin
info: Configuring services plugin
info: Initializing app plugin
info: Initializing engine plugin
info: Initializing events
info: Initializing init framework
info: Initializing recipes plugin
info: Initializing services
info: Initializing tooling plugin
info: Initializing core plugin
info: Bootstrap completed.
info: Initializing cli
info: App test is ready!

I've added a screenshot for better visibility.

selection_304

This is a very simplified example, the main point is that my projects' setup I cannot execute a script on pre-commit that is available only inside the container, so I need the lando prefix for it.

Thanks for any help!

Metadata

Metadata

Assignees

Labels

bugSomething aint working right!

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions