Can't run remote bash script with exec

Hi!

I have the following waypoint config:

project = "execution-mode"

app "app" {
  build {
    use "pack" {
      builder = "gcr.io/buildpacks/builder:v1"
    }

    registry {
      use "aws-ecr" {
        region = "sa-east-1"
        repository = "business"
        tag = gitrefpretty()
      }
    }
  }

  deploy{
    use "exec" {
      command = [
        "bash",
        "./.gitops/deploy.sh",
        "-s",
        "develop",
        "-t",
        gitrefpretty()
      ]
    }
  }
}

And now I’m detaching my deploy.sh script to an URL (in order to use it in many repositories), giving me the following new config:

project = "execution-mode"

app "app" {
  build {
    use "pack" {
      builder = "gcr.io/buildpacks/builder:v1"
    }

    registry {
      use "aws-ecr" {
        region = "sa-east-1"
        repository = "business"
        tag = gitrefpretty()
      }
    }
  }

  deploy{
    use "exec" {
      command = [
        "bash",
        "<(curl -s https://raw.githubusercontent.com/budproj/gist/main/gitops/deploy.sh)",
        "-s",
        "develop",
        "-t",
        gitrefpretty()
      ]
    }
  }
}

But, for some reason, as soon as I run it in Waypoint I got the following error:

» Deploying...
✓ Rendering templates...
❌ Executing command: bash <(curl -s https://raw.githubusercontent.com/budproj/gist/main/gitops/deploy.sh) -s develop
-t fc61a0e4fb1164161b6e5ac4e07a8c211d2324f9
 │ /usr/bin/bash: <(curl -s https://raw.githubusercontent.com/budproj/gist/main/git
 │ ops/deploy.sh): No such file or directory
! exit status 127

But, it works if I run the same command directly in my terminal.

Can anyone explain me what am I doing wrong please?

The command like that doesn’t work because you need an outer shell to run the <() but, so you need to wrap the whole thing with bash itself:

command = [
   "bash", "-c", "bash <(curl -s https://raw.githubusercontent.com/budproj/gist/main/gitops/deploy.sh) -s develop -t"
]
1 Like

A bash to run a bash :thinking: clever!

Thanks for your help, I’m going to do that!

1 Like