grafana / k6provider

Provider of k6 custom binaries using k6build
GNU Affero General Public License v3.0
0 stars 0 forks source link

Add support for using a proxy for downloads #2

Closed pablochacin closed 4 days ago

pablochacin commented 3 weeks ago

The build service returns the URL to download the custom binary. In some scenarios, it would be convenient for the client to use a caching proxy to download it. This could be setup in an environment variable such as K6BUILD_PROXY.

pablochacin commented 3 weeks ago

@szkiba Maybe this should be implemented in k6exec? It is there where the actual download of the happens. WDYT?

szkiba commented 3 weeks ago

As I know go http package uses HTTP proxies as directed by the environment variables HTTP_PROXY, HTTPS_PROXY and NO_PROXY (or the lowercase versions thereof).

Do we need a custom env var for this purpose?

pablochacin commented 2 weeks ago

yes, because we don't want to proxy all requests, only those for downloading the artifact. For instance, we may not want to proxy the requests to the build service itself. I think it is more convenient.

szkiba commented 2 weeks ago

I generally consider the transparent proxy solution to be better. Either before the service as an accelerator cache, or on the client's network. This greatly simplifies configuration management.

On the other hand, this feature is not related to execution, but rather to making k6 executable available. The good thing about the fact that the delivery of the build service does not end with an OpenAPI service but also includes a client library is that similar features can be implemented in the build service client library. The caching proxy to speed up the download speed can be a requirement for all build service clients, not only for k6exec, so it should be implemented in the build service client.

pablochacin commented 2 weeks ago

The caching proxy to speed up the download speed can be a requirement for all build service clients, not only for k6exec,

Currently, the download is not implemented in the k6build but in the k6exec and I think this should be the case, as the build service returns the URL for downloading the binary, but is oblivious about how it is downloaded.

szkiba commented 2 weeks ago

Currently, the download is not implemented in the k6build but in the k6exec

This is because the build service client does not implement it. It would be logical to implement the download, especially such a proxy setting, not in as many places as we use the build service client, but in the build service client library itself. The download URL by itself is not good for anything, only for downloading k6 from there, so it is logical that it is possible to make the use of the build service client more convenient if it can also download the built k6.

pablochacin commented 2 weeks ago

We agreed that this logic doesn't belong to k6exec. It will moved to another library (k6provider)