{"id":13342834,"url":"https://github.com/grafana/xk6-exec","last_synced_at":"2025-10-19T10:31:26.485Z","repository":{"id":40484392,"uuid":"334131591","full_name":"grafana/xk6-exec","owner":"grafana","description":"A k6 extension for running external commands. ","archived":false,"fork":false,"pushed_at":"2024-09-04T15:43:40.000Z","size":61,"stargazers_count":20,"open_issues_count":6,"forks_count":21,"subscribers_count":140,"default_branch":"main","last_synced_at":"2024-09-28T15:02:30.801Z","etag":null,"topics":["exec","k6","xk6"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grafana.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-29T11:57:53.000Z","updated_at":"2024-07-29T22:16:56.000Z","dependencies_parsed_at":"2024-06-10T11:57:13.433Z","dependency_job_id":"f36208af-af66-49d9-8693-42e7fa77344a","html_url":"https://github.com/grafana/xk6-exec","commit_stats":null,"previous_names":["dgzlopes/xk6-exec","k6io/xk6-exec"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fxk6-exec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fxk6-exec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fxk6-exec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grafana%2Fxk6-exec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grafana","download_url":"https://codeload.github.com/grafana/xk6-exec/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219869249,"owners_count":16555572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["exec","k6","xk6"],"created_at":"2024-07-29T19:30:06.014Z","updated_at":"2025-10-19T10:31:26.480Z","avatar_url":"https://github.com/grafana.png","language":"Go","funding_links":[],"categories":["Extensions"],"sub_categories":["Official"],"readme":"# xk6-exec\n\nThis is a [k6](https://go.k6.io/k6) extension using the\n[xk6](https://github.com/grafana/xk6) system.\n\n## Build\n\nTo build a `k6` binary with this extension, first ensure you have the prerequisites:\n\n- [Go toolchain](https://go101.org/article/go-toolchain.html)\n- Git\n\nThen:\n\n1. Install `xk6`:\n  ```shell\n  go install go.k6.io/xk6/cmd/xk6@latest\n  ```\n\n2. Build the binary:\n  ```shell\n  xk6 build --with github.com/grafana/xk6-exec@latest\n  ```\n\n## Development\nTo make development a little smoother, use the `Makefile` in the root folder. The default target will format your code, run tests, and create a `k6` binary with your local code rather than from GitHub.\n\n```bash\nmake\n```\nOnce built, you can run your newly extended `k6` using:\n```shell\n ./k6 run examples/script.js \n ```\n## Configuration\n\nPossible options\n\n* dir                       specify working dir \n* continue_on_error         contintue script when return code is not zero\n* include_stdout_on_error   exposes stdout when return code is not zero\n* combine_output            combines stdout and error in output\n* env                       specify enviroment variables\n\nsee examples/script.js for details\n\n## Example\n\n```javascript\n// script.js\nimport exec from 'k6/x/exec';\n\nexport default function () {\n  console.log(exec.command(\"date\"));\n  console.log(exec.command(\"ls\",[\"-a\",\"-l\"]));\n}\n```\n\nResult output:\n\n```\n$ ./k6 run examples/script.js\n\n          /\\      |‾‾| /‾‾/   /‾‾/   \n     /\\  /  \\     |  |/  /   /  /    \n    /  \\/    \\    |     (   /   ‾‾\\  \n   /          \\   |  |\\  \\ |  (‾)  | \n  / __________ \\  |__| \\__\\ \\_____/ .io\n\n  execution: local\n     script: examples/script.js\n     output: -\n\n  scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):\n           * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)\n\nINFO[0000] vie 29 ene 2021 12:53:28 CET                  source=console\nINFO[0000] total 27040\ndrwxrwxr-x 6 dgzlopes dgzlopes     4096 ene 29 12:52 .\ndrwxrwxr-x 3 dgzlopes dgzlopes     4096 ene 29 12:46 ..\n-rw-rw-r-- 1 dgzlopes dgzlopes     8399 ene 29 12:45 builder.go\n-rw-rw-r-- 1 dgzlopes dgzlopes     1871 ene 29 12:45 builder_test.go\ndrwxrwxr-x 3 dgzlopes dgzlopes     4096 ene 29 12:45 cmd\n-rw-rw-r-- 1 dgzlopes dgzlopes     6842 ene 29 12:45 environment.go\ndrwxrwxr-x 8 dgzlopes dgzlopes     4096 ene 29 12:45 .git\ndrwxrwxr-x 3 dgzlopes dgzlopes     4096 ene 29 12:45 .github\n-rw-rw-r-- 1 dgzlopes dgzlopes      118 ene 29 12:45 .gitignore\n-rw-rw-r-- 1 dgzlopes dgzlopes      923 ene 29 12:45 .golangci.yml\n-rw-rw-r-- 1 dgzlopes dgzlopes       85 ene 29 12:45 go.mod\n-rw-rw-r-- 1 dgzlopes dgzlopes     1020 ene 29 12:45 .goreleaser.yml\n-rw-rw-r-- 1 dgzlopes dgzlopes      183 ene 29 12:45 go.sum\n-rwxrwxr-x 1 dgzlopes dgzlopes 27598848 ene 29 12:52 k6\n-rw-rw-r-- 1 dgzlopes dgzlopes    11357 ene 29 12:45 LICENSE\n-rw-rw-r-- 1 dgzlopes dgzlopes     1805 ene 29 12:45 platforms.go\n-rw-rw-r-- 1 dgzlopes dgzlopes     3370 ene 29 12:45 README.md\ndrwxrwxr-x 3 dgzlopes dgzlopes     4096 ene 29 12:45 vendor  source=console\n\nrunning (00m00.0s), 0/1 VUs, 1 complete and 0 interrupted iterations\ndefault ✓ [======================================] 1 VUs  00m00.0s/10m0s  1/1 iters, 1 per VU\n\n     data_received........: 0 B 0 B/s\n     data_sent............: 0 B 0 B/s\n     iteration_duration...: avg=2.3ms min=2.3ms med=2.3ms max=2.3ms p(90)=2.3ms p(95)=2.3ms\n     iterations...........: 1   55.736622/s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafana%2Fxk6-exec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrafana%2Fxk6-exec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrafana%2Fxk6-exec/lists"}