grafana / xk6-output-influxdb

k6 extension to output real-time test metrics to an InfluxDB 2.x database.
Apache License 2.0
62 stars 33 forks source link

Dockerfile error #33

Closed po45ke95 closed 1 week ago

po45ke95 commented 1 month ago

Used the sample Dockerfile will get those error:

=> ERROR [builder 6/6] RUN xk6 build --with github.com/grafana/xk6-output-influxdb=. --output /tmp/k6 0.5s


[builder 6/6] RUN xk6 build --with github.com/grafana/xk6-output-influxdb=. --output /tmp/k6: 0.285 2024/07/14 10:42:04 [INFO] Temporary folder: /tmp/buildenv_2024-07-14-1042.3784705506 0.285 2024/07/14 10:42:04 [INFO] Initializing Go module 0.285 2024/07/14 10:42:04 [INFO] exec (timeout=10s): /usr/local/go/bin/go mod init k6 0.294 go: creating new go.mod: module k6 0.296 2024/07/14 10:42:04 [INFO] Replace github.com/grafana/xk6-output-influxdb => /go/src/go.k6.io/k6 0.296 2024/07/14 10:42:04 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod edit -replace github.com/grafana/xk6-output-influxdb=/go/src/go.k6.io/k6 0.302 2024/07/14 10:42:04 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod tidy -compat=1.17 0.311 go: warning: "all" matched no packages 0.314 2024/07/14 10:42:04 [INFO] Pinning versions 0.315 2024/07/14 10:42:04 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod tidy -compat=1.17 0.331 go: finding module for package github.com/grafana/xk6-output-influxdb 0.426 k6 imports 0.426 github.com/grafana/xk6-output-influxdb: module github.com/grafana/xk6-output-influxdb@latest found (v0.4.3, replaced by /go/src/go.k6.io/k6), but does not contain package github.com/grafana/xk6-output-influxdb 0.428 2024/07/14 10:42:04 [INFO] Cleaning up temporary folder: /tmp/buildenv_2024-07-14-1042.3784705506 0.429 2024/07/14 10:42:04 [FATAL] exit status 1

1 warning found (use --debug to expand):

  • FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 1) Dockerfile:6

    4 | RUN apk --no-cache add git 5 | RUN go install go.k6.io/xk6/cmd/xk6@latest 6 | >>> RUN xk6 build --with github.com/grafana/xk6-output-influxdb=. --output /tmp/k6 7 |
    8 | FROM alpine:3.17

    ERROR: failed to solve: process "/bin/sh -c xk6 build --with github.com/grafana/xk6-output-influxdb=. --output /tmp/k6" did not complete successfully: exit code: 1

codebien commented 1 month ago

Hi @po45ke95, do you get this error during the docker build command? I tried it and I don't get the same issue.

Did you change the Dockerfile?

po45ke95 commented 1 month ago

Yes @codebien I tried docker build and get those error. This is the version of the Dockerfile that I modified and can use.

FROM golang:1.20-alpine3.17 as builder
WORKDIR $GOPATH/src/go.k6.io/k6
ADD . .
RUN apk --no-cache add git
RUN go install go.k6.io/xk6/cmd/xk6@latest
RUN go mod init k6
RUN xk6 build --with github.com/grafana/xk6-output-influxdb@latest --output /tmp/k6

FROM alpine:3.17
RUN apk add --no-cache ca-certificates && \
    adduser -D -u 12345 -g 12345 k6
COPY --from=builder /tmp/k6 /usr/bin/k6

USER 12345
WORKDIR /home/k6
ENTRYPOINT ["k6"]
codebien commented 1 month ago

This is no required, this sounds like a misconfiguration on your machine.

Please, provide a GitHub repository with a failing CI so we can debug the commands. Otherwise, this sounds like a question to open on a Docker community forum.

marnec commented 1 month ago

same problem here and @po45ke95 solution worked, I'm on arch-linux

po45ke95 commented 1 month ago

I can reproduce this error on Ubuntu 24.04. I don't think this is a CI/CD error.

codebien commented 1 week ago

I've updated the Dockerfile with the most recent k6, Alpine and Go version. A new v0.5.0 version of the extension is available. Please, retry and if you continue to get the error do a new report.