Modified yml slightly. Tried it on an Ubuntu 18.04 laptop and k6 file does get recognized and executed without issues. In the pipeline the image is Debian 9.8, and it does not recognize the file.
I got the 32 bit version k6, and put both files in the repo k6bin folder. Both the files show in ls . However, file command does not work on the CI machine with Debian 9.8 on either 32 bit or 64 bit k6 executable.
Not a file extract or move problem
Not a 32 bit vs 64 bit problem
Possible Debian issue(?)
Possible file issue from k6 file
loadtest:
stage: performance-test
only:
- k6
before_script:
- mkdir -p k6bin
- pwd
- apk add --update curl && rm -rf /var/cache/apk/*
- |
if [[ ! -f k6bin/k6 ]]; then
curl -O -L https://s3-eu-west-1.amazonaws.com/gitlab-test-pipeline-file-store/k6-v0.24.0-linux64.tar.gz;
tar -xvzf k6-v0.24.0-linux64.tar.gz;
mv k6-v0.24.0-linux64/k6 k6bin/k6;
fi
- pwd
script:
- pwd
- chmod -R a+rwx k6bin
- cd k6bin
- pwd
- ls -lia
- file k632
- cd ..
- k6bin/k632 run k6-performance/getSites.js
- k6bin/k6 run k6-performance/getSites.js
tags:
- DOCKER
- NOPROXY
- CLOUD
After this test, tried version 23 of k6, to reduce the guesstimate that this is a k6 file issue. The result is the same. This is most likely a Debian 9.8 CI machine issue.
Does anyone know how to add missing libraries to a Debian 9.8 CI machine so that the k6 executable gets recognized? Or, is there a way to make the k6 executable more compliant with CI machines?
In that last screenshot, the error file: not found happens not because k632 isn’t found, but because the file binary (i.e., /usr/bin/file) isn’t present. Try to remove that line and see what happens.
it definitely won’t work because at this point you are in k6bin so it should be just k6.
Can you also try it with ./k6
or ./k6bin/k6
instead of just the plain path(k6bin/k6) as I remember that debian’s shell was something funky long time ago.
Also trying 32bit version on 64bit machine makes no sense
I’m very confused I noticed that you mention Debian, yet the test script you’ve pasted uses apk, i.e. it’s on Alpine Linux. If you’re using Alpine, then the k6 binary may not work because of this issue: Statically linked releases? · Issue #930 · grafana/k6 · GitHub