Skip to content

Commit

Permalink
Fix docs that fail after the fix in v0.45.1 (#1284)
Browse files Browse the repository at this point in the history
* fix docs that fail after the fix in v0.45.1
* add two commands examples: latest vs. concrete versions
Co-authored-by: Paul Balogh <[email protected]>
  • Loading branch information
immavalls authored Aug 7, 2023
1 parent fc7303e commit f32b958
Showing 1 changed file with 47 additions and 14 deletions.
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

0 comments on commit f32b958

Please sign in to comment.