{"id":13342916,"url":"https://github.com/szkiba/xk6bundler","last_synced_at":"2025-03-25T12:33:15.338Z","repository":{"id":57596306,"uuid":"367899631","full_name":"szkiba/xk6bundler","owner":"szkiba","description":"Bundle k6 with extensions as fast and easily as possible","archived":false,"fork":false,"pushed_at":"2024-10-14T09:03:39.000Z","size":32,"stargazers_count":14,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T08:44:58.914Z","etag":null,"topics":["xk6"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/szkiba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-16T14:13:21.000Z","updated_at":"2024-11-15T07:12:08.000Z","dependencies_parsed_at":"2024-06-20T16:36:09.576Z","dependency_job_id":"d880623b-018e-49a2-89a0-ece399962b0f","html_url":"https://github.com/szkiba/xk6bundler","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"8ba4511d35165de44558ab18d2527aac18a62891"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szkiba%2Fxk6bundler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szkiba%2Fxk6bundler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szkiba%2Fxk6bundler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szkiba%2Fxk6bundler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/szkiba","download_url":"https://codeload.github.com/szkiba/xk6bundler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245463046,"owners_count":20619601,"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":["xk6"],"created_at":"2024-07-29T19:30:06.957Z","updated_at":"2025-03-25T12:33:14.951Z","avatar_url":"https://github.com/szkiba.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xk6bundler\n\nxk6bundler is a CLI tool and [GitHub Action](https://docs.github.com/en/actions) makes bundle k6 with extensions as fast and easily as possible.\n\n**Features**\n\n- Build for multiple target platforms\n- Create per platform `.tar.gz` archives for releases\n- Generate `Dockerfile` for Docker build/push\n- Guess reasonable default values\n- Almost drop-in [xk6](https://github.com/grafana/xk6) replacement\n- Only one GitHub workflow file required to build and publish custom k6 bundle\n\nFor a real life example check [k6-crocus](https://github.com/szkiba/k6-crocus) and it's [.github/workflows/xk6bundler.yml](https://github.com/szkiba/k6-crocus/blob/master/.github/workflows/xk6bundler.yml) file\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**\n\n- [Parameters](#parameters)\n  - [name](#name)\n  - [version](#version)\n  - [with](#with)\n  - [markdown](#markdown)\n  - [platform](#platform)\n  - [output](#output)\n  - [archive](#archive)\n  - [k6_repo](#k6_repo)\n  - [k6_version](#k6_version)\n- [GitHub Action](#github-action)\n  - [Outputs](#outputs)\n  - [GitHub release](#github-release)\n  - [Docker Hub push](#docker-hub-push)\n- [CLI](#cli)\n  - [Install the pre-compiled binary](#install-the-pre-compiled-binary)\n  - [Install with Go](#install-with-go)\n  - [Running with Docker](#running-with-docker)\n  - [Verifying your installation](#verifying-your-installation)\n  - [Usage](#usage)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Parameters\n\nThe CLI tool and GitHub Action has same parameters. The main difference is how to pass the parameters. Another difference is that using CLI tool you may specify `with` and `platform` parameters multiple times, while using GitHub action you should specify these parameters only once, but you may use a whitespace separated list of values.\n\nThe following table show parameter names, CLI option flags and environment variable names for the default value of a given parameter:\n\nParameter                   | CLI                     | Environment\n----------------------------|-------------------------|----------------------\n[`name`](#name)             | `-n, --name=name`       | `XK6BUNDLER_NAME`\n[`version`](#version)       | `-v, --version=version` | `XK6BUNDLER_VERSION`\n[`with`](#with)             | `-w, --with=extension`  | `XK6BUNDLER_WITH`\n[`markdown`](#markdown)     | `-m, --markdown=path`   | `XK6BUNDLER_MARKDOWN`\n[`platform`](#platform)     | `-p, --platform=target` | `XK6BUNDLER_PLATFORM`\n[`output`](#output)         | `-o, --output=path`     | `XK6BUNDLER_OUTPUT`\n[`archive`](#archive)       | `-a, --archive=path`    | `XK6BUNDLER_ARCHIVE`\n[`k6_repo`](#k6_repo)       | `--k6-repo=repo`        | `XK6BUNDLER_K6_REPO`\n[`k6_version`](#k6_version) | `--k6-version=version`  | `XK6BUNDLER_K6_VERSION`\n\n### name\n\nShort name of the bundle. Optional, if missing then xk6bunder will try to guess from git remote or from current directory name.\n\n### version\n\nBundle version. Optional, if missing then xk6bundler will try to guess from `GITHUB_REF` or default to `SNAPSHOT`.\n\n### with\n\nxk6 extension to add in `module[@version][=replacement]` format. When using CLI, it can be used multiple times to add extensions by specifying the Go module name and optionally its version, similar to go get. Module name is required, but specific version and/or local replacement are optional. Replacement path must be absolute. When using GitHub Action, it can contains whilespace separated list of modules. Optional, if missing then no xk6 extension will be bundled.\n\n### markdown\n\nExtract xk6 extension list from markdown code blocks marked with language `xk6`. Multiple `xk6` code blocks will merge to single extension list. Each line in code block contains extension in `module[@version][=replacement]` format (see [with](#with)).\n\n### platform\n\nTarget platform in `os/arch` format. When using CLI, it can be used multiple times to add target platform. When using GitHub Action, it can contains whilespace separated list of target platforms. Optinal, default value is `linux/amd64 windows/amd64 darwin/amd64`\n\n### output\n\n[Go template](https://golang.org/pkg/text/template/) of output file path. Optional, default value is `dist/{{.Name}}_{{.Os}}_{{.Arch}}/k6{{.Ext}}`\n\nThe following template variables available in template:\n\nVariable  | Descripion\n----------|-----------\n`Os`      | OS name (values defined by `GOOS`)\n`Arch`    | hardware architecture (values defined by `GOARCH`)\n`Ext`     | `.exe` on windows empty otherwise\n`Name`    | bundle name\n`Version` | bundle version\n\nYou can use [slim-sprig](https://go-task.github.io/slim-sprig/) template function library as well.\n\n### archive\n\n[Go template](https://golang.org/pkg/text/template/) of archive (.tar.gz) file path. Optional, default value is `dist/{{.Name}}_{{.Version}}_{{.Os}}_{{.Arch}}.tar.gz`\n\nThe following template variables available in template:\n\nVariable  | Descripion\n----------|-----------\n`Os`      | OS name (values defined by `GOOS`)\n`Arch`    | hardware architecture (values defined by `GOARCH`)\n`Ext`     | `.exe` on windows empty otherwise\n`Name`    | bundle name\n`Version` | bundle version\n\nYou can use [slim-sprig](https://go-task.github.io/slim-sprig/) template function library as well.\n\n### k6_repo\n\nBuild using a k6 fork repository. The repo can be a remote repository or local directory path.\n\n### k6_version\n\nThe core k6 version to build. Optional, if missing then `latest` will be used.\n\n## GitHub Action\n\nFor using xk6bundler as [GitHub Action](https://docs.github.com/en/actions), you should include a workflow step with `uses: szkiba/xk6bundler@v0`\n\n```yaml\n- name: Build\n  id: build\n  uses: szkiba/xk6bundler@v0\n  with:\n    platform: linux/amd64 windows/amd64\n    with: |\n      github.com/szkiba/xk6-prometheus@v0.1.2\n      github.com/szkiba/xk6-jose@v0.1.1\n      github.com/szkiba/xk6-ansible-vault@v0.1.1\n```\n\n### Outputs\n\nThe xk6bundler GitHub Action outputs the following variables:\n\n#### name\n\nShort name of the bundle.\n\n#### version\n\nBundle version.\n\n#### dockerfile\n\nGenerated Dockerfile path.\n\n#### dockerdir\n\nDocker context directory path. Can be use as `context` parameter for Docker build action (assuming `build` is the id of the xk6bundler step):\n\n```yaml\n- name: Docker build and push\n  uses: docker/build-push-action@v2\n  with:\n    context: ./${{ steps.build.outputs.dockerdir }}\n```\n\n\u003e The `./` prefix required, it will tell to Docker action that this is a local path (not an URL).\n\nSee [samples/sample-dockerhub-workflow.yml](samples/sample-dockerhub-workflow.yml) for complete example.\n\n### GitHub release\n\nThe xk6bundler GitHub Action generates result by default in `dist` directory of the current workspace. You can publish generated archive (.tar.gz) files using any thirdpary release GitHub Action.\n\nSample workflow file for publishing xk6 bundle on GitHub releases page: [samples/sample-workflow.yml](samples/sample-workflow.yml). Put this file in to `.github/workflows` directory.\n\n### Docker Hub push\n\nIf target platforms include `linux/amd64` then xk6bundler will generate `Dockerfile` next to `linux/amd64` platform's output file. You can use it to build Docker image and push it for example to Docker Hub registry (or to any other).\n\nSample workflow file for publishing xk6 bundle on GitHub releases page and on Docker Hub registry: [samples/sample-dockerhub-workflow.yml](samples/sample-dockerhub-workflow.yml). Put this file in to `.github/workflows` directory.\n\n\n## CLI\n\nYou can install the pre-compiled binary or use Docker.\n\n### Install the pre-compiled binary\n\nDownload the pre-compiled binaries from the [releases page](https://github.com/szkiba/xk6bundler/releases) and copy to the desired location.\n\n### Install with Go\n\nIf you have Go environment set up, you can build xk6bundler from source by running:\n\n```sh\ngo get github.com/szkiba/xk6bundler/cmd/xk6bundler\n```\n\nBinary would be installed to $GOPATH/bin/xk6bundler.\n\n### Running with Docker\n\nYou can also use it within a Docker container. To do that, you'll need to\nexecute the following:\n\n```bash\ndocker run szkiba/xk6bundler\n```\n\n### Verifying your installation\n\nTo verify your installation, use the `xk6bundler -V` command:\n\n```bash\n$ xk6bundler -V\n\nxk6bundler/0.1.0 linux/amd64\n```\n\nYou should see `xk6bundler/VERSION` in the output.\n\n### Usage\n\nTo print usage information, use the `xk6bundler --help` command.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszkiba%2Fxk6bundler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fszkiba%2Fxk6bundler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszkiba%2Fxk6bundler/lists"}