Skip to content

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

@tobybellwood

Description

@tobybellwood

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")  

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions