grafana / k6build

K6 build service
GNU Affero General Public License v3.0
0 stars 0 forks source link

CGO_ENABLED handling problem #5

Open szkiba opened 2 months ago

szkiba commented 2 months ago

1.CGO_ENABLED=1 on client, CopyGoEnv true on API call, but server does not set CGO_ENABLED=1. Reproducible with the xk6-sql extension and SQLite database.

  1. The build service cache is insensitive to CGO_ENABLED changes. It can be reproduced if we set CGO_ENABLED to 0 and then build, then set it to 1 and build again. Returns the previously built binary from the cache.
pablochacin commented 1 month ago

@szkiba I think these are two different issues. The first is likely an incorrect handling of the CGO_ENABLED settings. The second is more a change in how the hash of a build is set. I suggest splitting it into two issues for better traceability.

pablochacin commented 1 month ago

Regarding the first one, could you please provide a way to reproduce the issue? I just build a custom binary with the xk6-sql extension and didn't see any problem:

Client side:

go run ./cmd/k6build client -s http://localhost:8000  -k v0.51.0 -d k6/x/sql -p linux/amd64 -o build/k6
{
  "id": "47e4ffa822a489223e8f859956c3bd63dfbcea0a",
  "url": "http://localhost:8000/cache/47e4ffa822a489223e8f859956c3bd63dfbcea0a/download",
  "dependencies": {
    "k6": "v0.51.0",
    "k6/x/sql": "v0.4.0"
  },
  "platform": "linux/amd64",
  "checksum": "5e763490779ae6feb68c8b81b7835c15f9fcb6e623f70e9815e54ea649f66dfb"
}

$ build/k6 version
k6 v0.51.0 (go1.22.2, linux/amd64)
Extensions:
  github.com/grafana/xk6-sql v0.4.0, k6/x/sql [js]

Sever side:

building artifact: entry not found in registry : k6/x/slq 
ERRO[0014] object not found: 47e4ffa822a489223e8f859956c3bd63dfbcea0a 
go: creating new go.mod: module k6
go: downloading github.com/grafana/xk6-sql v0.4.0
go: downloading github.com/microsoft/go-mssqldb v1.6.0
go: downloading github.com/ClickHouse/clickhouse-go/v2 v2.22.0
go: downloading github.com/mattn/go-sqlite3 v1.14.18
go: downloading github.com/lib/pq v1.10.9
go: downloading github.com/go-sql-driver/mysql v1.7.1
go: downloading github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1
go: downloading github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0
go: downloading github.com/golang-sql/sqlexp v0.1.0
go: downloading github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9
go: downloading github.com/ClickHouse/ch-go v0.61.5
go: downloading github.com/shopspring/decimal v1.3.1
go: downloading github.com/paulmach/orb v0.11.1
go: downloading github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0
go: downloading github.com/AzureAD/microsoft-authentication-library-for-go v1.1.0
go: downloading github.com/go-faster/errors v0.7.1
go: downloading github.com/pierrec/lz4/v4 v4.1.21
go: downloading github.com/go-faster/city v1.0.1
go: downloading github.com/kylelemons/godebug v1.1.0
go: downloading github.com/golang-jwt/jwt/v5 v5.0.0
go: downloading golang.org/x/sys v0.19.0
go: downloading github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.0
go: downloading github.com/google/pprof v0.0.0-20231127191134-f3a68a39ae15
go: downloading golang.org/x/crypto v0.22.0
go: downloading golang.org/x/net v0.24.0
go: downloading github.com/golang-jwt/jwt/v4 v4.5.0
go: downloading golang.org/x/term v0.19.0
go: downloading github.com/dnaeon/go-vcr v1.2.0
go: downloading github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v0.8.0