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

Fix docs that fail after the fix in v0.45.1 #1284

Merged
merged 4 commits into from
Aug 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,73 @@ Using the [xk6 Docker image](https://hub.docker.com/r/grafana/xk6/) can simplify

## Building your first extension

For example, to build a k6 v0.43.1 binary with the [`xk6-kafka`](https://github.com/mostafa/xk6-kafka) and [`xk6-output-influxdb`](https://github.com/grafana/xk6-output-influxdb) extensions, run one of the commands below, depending on your operating system:
For example, to build a custom k6 binary with the latest versions of k6 and the [`xk6-kafka`](https://github.com/mostafa/xk6-kafka) and [`xk6-output-influxdb`](https://github.com/grafana/xk6-output-influxdb) extensions, run one of the commands below, depending on your operating system:

<CodeGroup labels={["Linux", "Mac", "Windows PowerShell", "Windows"]}>

```bash
docker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build v0.43.1 \
--with github.com/mostafa/xk6-kafka@v0.17.0 \
--with github.com/grafana/xk6-output-influxdb@v0.3.0
docker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build \
--with github.com/mostafa/xk6-kafka \
--with github.com/grafana/xk6-output-influxdb
```

```bash
docker run --rm -e GOOS=darwin -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" \
grafana/xk6 build v0.43.1 \
--with github.com/mostafa/xk6-kafka@v0.17.0 \
--with github.com/grafana/xk6-output-influxdb@v0.3.0
grafana/xk6 build \
--with github.com/mostafa/xk6-kafka \
--with github.com/grafana/xk6-output-influxdb
```

```powershell
docker run --rm -e GOOS=windows -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" `
grafana/xk6 build v0.43.1 --output k6.exe `
--with github.com/mostafa/xk6-kafka@v0.17.0 `
--with github.com/grafana/xk6-output-influxdb@v0.3.0
grafana/xk6 build --output k6.exe `
--with github.com/mostafa/xk6-kafka `
--with github.com/grafana/xk6-output-influxdb
```

```batch
docker run --rm -e GOOS=windows -v "%cd%:/xk6" ^
grafana/xk6 build v0.43.1 --output k6.exe ^
--with github.com/mostafa/xk6-kafka@v0.17.0 ^
--with github.com/grafana/xk6-output-influxdb@v0.3.0
grafana/xk6 build --output k6.exe ^
--with github.com/mostafa/xk6-kafka ^
--with github.com/grafana/xk6-output-influxdb
```

</CodeGroup>

This creates a `k6` (or `k6.exe`) binary in the current working directory.
This creates a `k6` (or `k6.exe`) binary in the current working directory.

To build the binary with concrete versions, see the example below (k6 `v0.45.1`, xk6-kafka `v0.19.1`, and xk6-output-influxdb `v0.4.1`):

<CodeGroup labels={["Linux", "Mac", "Windows PowerShell", "Windows"]}>

```bash
docker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build v0.45.1 \
--with github.com/mostafa/[email protected] \
--with github.com/grafana/[email protected]
```

```bash
docker run --rm -e GOOS=darwin -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" \
grafana/xk6 build v0.45.1 \
--with github.com/mostafa/[email protected] \
--with github.com/grafana/[email protected]
```

```powershell
docker run --rm -e GOOS=windows -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" `
grafana/xk6 build v0.45.1 --output k6.exe `
--with github.com/mostafa/[email protected] `
--with github.com/grafana/[email protected]
```

```batch
docker run --rm -e GOOS=windows -v "%cd%:/xk6" ^
grafana/xk6 build v0.45.1 --output k6.exe ^
--with github.com/mostafa/[email protected] ^
--with github.com/grafana/[email protected]
```

</CodeGroup>

## Breaking down the command

Expand Down