xk6-output-influxdb icon indicating copy to clipboard operation
xk6-output-influxdb copied to clipboard

Dockerfile error

Open po45ke95 opened this issue 1 year ago • 5 comments

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

po45ke95 avatar Jul 14 '24 10:07 po45ke95

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?

codebien avatar Jul 15 '24 11:07 codebien

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"]

po45ke95 avatar Jul 16 '24 15:07 po45ke95

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.

codebien avatar Jul 16 '24 16:07 codebien

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

marnec avatar Aug 07 '24 13:08 marnec

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

po45ke95 avatar Aug 07 '24 13:08 po45ke95

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.

codebien avatar Aug 29 '24 09:08 codebien

This is still an issue with v0.5.0. @po45ke95 's solution/updated Dockerfile works for now.

vishalpatel1587 avatar Jan 17 '25 03:01 vishalpatel1587