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

Unable to mount docker to $(pwd) [exec] #490

Open
TiagoGouvea opened this issue Jun 3, 2020 · 1 comment
Open

Unable to mount docker to $(pwd) [exec] #490

TiagoGouvea opened this issue Jun 3, 2020 · 1 comment
Labels
bug Something isn't working exec

Comments

@TiagoGouvea
Copy link

Describe the bug
When mounting docker to $(pwd) with exec, the action failed and I got:

/usr/bin/docker: Error response from daemon: create $(pwd): "$(pwd)" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.

Command called:

const cmd= "docker run -v $(pwd):/tmp tiagogouvea/dpl:v1.10.15 --provider='heroku' ";
await exec.exec(cmd);

ℹ️ Running the same command using child_process.execSync works. Example:

const cmd= "docker run -v $(pwd):/tmp tiagogouvea/dpl:v1.10.15 --provider='heroku' ";
execSync(cmd);

To Reproduce
Steps to reproduce the behavior:

  1. Create a action with JavaScript
  2. Call await exec.exec("docker run -v $(pwd):/tmp tiagogouvea/dpl:v1.10.15");

Expected behavior

  • Want to mount the current path to as docker volume.
  • Wanted to @actions/exec work like child_process/execSync.

Desktop (please complete the following information):

  • OS: runs-on: ubuntu-latest
@TiagoGouvea TiagoGouvea added the bug Something isn't working label Jun 3, 2020
@TiagoGouvea TiagoGouvea changed the title Unable to mount docker to $(pwd) Unable to mount docker to $(pwd) [exec] Jun 3, 2020
@thboop thboop added the exec label Jun 19, 2020
@cmbuckley
Copy link

It took me a while to find this issue, but it seems that exec simply does not support subshells:

let cmd = 'pwd';
await exec.exec(cmd); // outputs e.g. “/home/runner/work/repo”

cmd = 'echo $(pwd)';
await exec.exec(cmd); // outputs “$(pwd)”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working exec
Projects
None yet
Development

No branches or pull requests

3 participants