Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 214
Add tests for shell execution on artifacts build#2884
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
e985d53491fa71a4a6257cb1ecc38f42e5ccd8b5c8a69b1466cfd93630dc3effc25366a09060411708fbc08f5323b23f3fedf9420cc9990ad47de30ce1fe94ca7936be24ef11File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| bundle: | ||
| name: shell-bash | ||
| artifacts: | ||
| my_artifact: | ||
| executable: bash | ||
| # echo in bash does not treat \n as a newline. | ||
| build: | | ||
| echo "\n\n\n should not see new lines" > out.shell.txt | ||
| echo "multiline scripts should work" >> out.shell.txt | ||
| pwd >> out.shell.txt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| \n\n\n should not see new lines | ||
| multiline scripts should work | ||
| [TEST_TMP_DIR] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| >>> [CLI] bundle deploy | ||
| Building my_artifact... | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/shell-bash/default/files... | ||
| Deploying resources... | ||
| Deployment complete! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| trace $CLI bundle deploy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Line feed (\n) characters are rendered differently by bash vs sh on Unix based systems. | ||
| # However that does not hold true for Windows WSL. Since the goal of this test is to assert | ||
| # the chosen shell is being used, we skip this test on Windows. | ||
| [GOOS] | ||
| windows = false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| bundle: | ||
| name: shell-basic | ||
| artifacts: | ||
| my_artifact: | ||
| build: | | ||
| echo "Hello, World!" > out.shell.txt | ||
| echo "Bye, World!" >> out.shell.txt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Hello, World! | ||
| Bye, World! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| >>> [CLI] bundle deploy | ||
| Building my_artifact... | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/shell-basic/default/files... | ||
| Deploying resources... | ||
| Deployment complete! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| trace $CLI bundle deploy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| bundle: | ||
| name: shell-cmd | ||
| artifacts: | ||
| my_artifact: | ||
| executable: cmd | ||
| build: | | ||
| if defined CMDCMDLINE ( | ||
| echo shell is cmd.exe> out.shell.txt | ||
| ) | ||
| echo multiline scripts should work>> out.shell.txt | ||
| echo %CD%>> out.shell.txt | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| shell is cmd.exe | ||
| multiline scripts should work | ||
| [TEST_TMP_DIR] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| >>> [CLI] bundle deploy | ||
| Building my_artifact... | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/shell-cmd/default/files... | ||
| Deploying resources... | ||
| Deployment complete! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| trace $CLI bundle deploy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # cmd.exe is only available on Windows. | ||
| [GOOS] | ||
| darwin = false | ||
| linux = false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| bundle: | ||
| name: shell-bash | ||
| artifacts: | ||
| my_artifact: | ||
| # Default shell is bash. echo in bash does not treat \n as a newline. | ||
| build: | | ||
| echo "\n\n\n should not see new lines" > out.shell.txt | ||
| echo "multiline scripts should work" >> out.shell.txt | ||
| pwd >> out.shell.txt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| \n\n\n should not see new lines | ||
| multiline scripts should work | ||
| [TEST_TMP_DIR] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| >>> [CLI] bundle deploy | ||
| Building my_artifact... | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/shell-bash/default/files... | ||
| Deploying resources... | ||
| Deployment complete! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| trace $CLI bundle deploy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Line feed (\n) characters are rendered differently by bash vs sh on Unix based systems. | ||
| # However that does not hold true for Windows WSL. Since the goal of this test is to assert | ||
| # the chosen shell is being used, we skip this test on Windows. | ||
| [GOOS] | ||
| windows = false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| bundle: | ||
| name: shell-invalid | ||
| artifacts: | ||
| my_artifact: | ||
| executable: invalid | ||
| build: foobar |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| >>> [CLI] bundle deploy | ||
| Building my_artifact... | ||
| Error: invalid is not supported as an artifact executable, options are: bash, sh or cmd | ||
| Exit code: 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| trace $CLI bundle deploy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| bundle: | ||
| name: shell-sh | ||
| artifacts: | ||
| my_artifact: | ||
| executable: sh | ||
| # echo in sh treats \n as a newline. | ||
| build: | | ||
| echo "\n\n\nshould see new lines" > out.shell.txt | ||
| echo "multiline scripts should work" >> out.shell.txt | ||
| pwd >> out.shell.txt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| should see new lines | ||
| multiline scripts should work | ||
| [TEST_TMP_DIR] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| >>> [CLI] bundle deploy | ||
| Building my_artifact... | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/shell-sh/default/files... | ||
| Deploying resources... | ||
| Deployment complete! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| trace $CLI bundle deploy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Line feed (\n) characters are rendered differently by bash vs sh on Unix based systems. | ||
| # However that does not hold true for Windows WSL. Since the goal of this test is to assert | ||
| # the chosen shell is being used, we skip this test on Windows. | ||
| [GOOS] | ||
| windows = false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Local = true | ||
| Cloud = false | ||
| RecordRequests = false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -8,7 +8,7 @@ Ignore = ['ignore*'] | ||
| #windows = false | ||
| # Disable on Mac | ||
| #mac = false | ||
| #darwin = false | ||
| ||
| # Disable on Linux | ||
| #linux = false | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -23,7 +23,7 @@ func shellExecvOpts(content, dir string, env []string) (ExecvOptions, error) { | ||
| // Variant of [Execv] that runs the given script through a shell | ||
| func ShellExecv(content, dir string, env []string) error { | ||
| newOpts, err := shellExecvOpts(content, dir, env) | ||
| opts, err := shellExecvOpts(content, dir, env) | ||
| ||
| if err != nil { | ||
| return err | ||
| } | ||
| @@ -38,5 +38,5 @@ func ShellExecv(content, dir string, env []string) error { | ||
| // | ||
| // For windows the temp files are not automatically cleaned up. Automatic cleanup | ||
| // is a opt-in behavior. | ||
| return Execv(newOpts) | ||
| return Execv(opts) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.