grafana / xk6

Build k6 with extensions
Apache License 2.0
215 stars 20 forks source link

"no such host" at xk6 build #89

Closed nikitades closed 4 months ago

nikitades commented 8 months ago

I want to build a custom binary with the following extension included: github.com/gpiechnik2/xk6-proxy@latest

So, what I do is:

  1. mkdir xk6
  2. cd xk6
  3. xk6 build --with github.com/gpiechnik2/xk6-proxy@latest

And the output is always:

<...>
go: k6 imports
    go.k6.io/k6/cmd imports
    github.com/grafana/xk6-output-prometheus-remote/pkg/remotewrite imports
    go.buf.build/grpc/go/prometheus/prometheus: unrecognized import path "go.buf.build/grpc/go/prometheus/prometheus": https fetch: Get "https://go.buf.build/grpc/go/prometheus/prometheus?go-get=1": dial tcp: lookup go.buf.build: no such host
2024/03/05 15:55:36 [INFO] Cleaning up temporary folder: /Users/nikitades/xk6/buildenv_2024-03-05-1555.2159493344
2024/03/05 15:55:36 [FATAL] exit status 1

I tested it from various machines and even geographical locations and it always ends the same way. Can I skip prometheus dependency somehow?

Also, I tried to replace the broken package in the following fashion:

xk6 build \
    --with github.com/gpiechnik2/xk6-proxy@latest \
    --replace go.buf.build/grpc/go/prometheus/prometheus=buf.build/gen/go/prometheus/prometheus/grpc/go@latest

This looks like the new DNS record of the same package. But still it results in package name mismatch:

go.buf.build/grpc/go/prometheus/prometheus: module go.buf.build/grpc/go/prometheus/prometheus@latest found (v1.4.9, replaced by buf.build/gen/go/prometheus/prometheus/grpc/go@v1.3.0-20240125203449-c3402bbea49b.2), but does not contain package go.buf.build/grpc/go/prometheus/prometheus

Is there a stable workaround?

pablochacin commented 4 months ago

@nikitades the problem is that the xk6-proxy extension is using an old version of k6 (v0.42.1). The following command worked for me.

xk6 build --replace go.k6.io/k6=go.k6.io/k6@v0.52 --with github.com/gpiechnik2/xk6-proxy@latest