Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lagoon post-rollout tasks with complex quotations are handled badly #34

Open
tobybellwood opened this issue Aug 26, 2024 · 0 comments
Open

Comments

@tobybellwood
Copy link
Member

When running a post rollout task
eg

  post-rollout:
    - run:
        name: drush updb
        # This will only run if the database exists.
        command: |
          if [[ $(drush status --field=Database) == "Connected" ]]; then drush -y updb; fi
        service: cli
        shell: bash

The runner attempts to quote everything it doesn't recognise, and this results in nasty shell errors

cli-drupal:/app$ if [[ $(drush status --field=Database) == "Connected" ]]; then drush -y updb; fi
cli-drupal:/app$ drush lagoon:post-rollout-tasks
> sh: syntax error: unexpected end of file (expecting "then")

In SiteProcess.php line 214:
                                                                                                         
  The command "if '[[' '$(drush' status '--field=Database)' == Connected ']];' then drush -y 'updb;' fi  
  " failed.                                                                                              
                                                                                                         
  Exit Code: 2(Misuse of shell builtins)                                                                 
                                                                                                         
  Working directory:                                                                                     
                                                                                                         
  Output:                                                                                                
  ================                                                                                       
                                                                                                         
                                                                                                         
  Error Output:                                                                                          
  ================                                                                                       
  sh: syntax error: unexpected end of file (expecting "then")  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@tobybellwood and others