Gitlab shell runner 无法上传大于 63KB 的工件:“501 Not Implemented”
Gitlab shell runner cannot upload artifacts larger than 63KB : "501 Not Implemented"
我在 Gitlab 中使用工作工件时遇到问题 CI。
我正在开发 docker 化的网络应用程序。我 运行 应用 docker-compose 和 运行 一些测试。
当测试失败时,测试框架会截取一些屏幕截图。然后我将屏幕截图复制到构建目录,并尝试将它们作为工件上传,但我得到以下信息:
Uploading artifacts...
Runtime platform arch=amd64 os=linux pid=6560 revision=d0b76032 version=12.0.2
src/tests/_output/: found 5 matching files
WARNING: Uploading artifacts to coordinator... failed id=11975 responseStatus=501 Not Implemented status=501 Not Implemented token=EyreCNs7
WARNING: Retrying... error=invalid argument
WARNING: Uploading artifacts to coordinator... failed id=11975 responseStatus=501 Not Implemented status=501 Not Implemented token=EyreCNs7
WARNING: Retrying... error=invalid argument
WARNING: Uploading artifacts to coordinator... failed id=11975 responseStatus=501 Not Implemented status=501 Not Implemented token=EyreCNs7
FATAL: invalid argument
ERROR: Job failed: exit status 1
舞台配置如下:
upload_screenshots:
stage: upload_screenshots
script:
- docker cp myapp_php_test:/var/www/html/myapp/tests/_output/. src/tests/_output/
when: on_failure
artifacts:
paths:
- src/tests/_output/
expire_in: 1 week
我做了一个测试项目,它只是创建一个文本文件并将其作为工件上传,它按预期工作:
test:
script:
- echo "test" > test.txt
- ls -la
artifacts:
paths:
- test.txt
expire_in: 1 week
$ echo "test" > test.txt
Uploading artifacts...
Runtime platform arch=amd64 os=linux pid=101330 revision=d0b76032 version=12.0.2
test.txt: found 1 matching files
Uploading artifacts to coordinator... ok id=11946 responseStatus=201 Created token=xmkvqina
Job succeeded
我运行正在使用 Gitlab CE 11.3.5 (c74e8d9) 和 Gitlab Runner 12.0.2 (d0b76032)。各自的服务器不在同一子网中。我认为它可能是我们的代理,但我不知道如何确定。此外,我的测试项目有效。
我该如何调试它?
有没有办法从 gitlab-ci 配置中使用 artifact-uploader 详细模式?
更新
这似乎是文件大小的问题。由于某些原因,我无法上传大于 63KB 的文件。
stages:
- passes
- fails
passes:
stage: passes
when: always
script:
- dd if=/dev/urandom of=test.dat bs=63K count=1
artifacts:
paths:
- "*.dat"
fails:
stage: fails
when: always
script:
- dd if=/dev/urandom of=test.dat bs=64K count=1
artifacts:
paths:
- "*.dat"
它是该死的代理
将 CI 设置中的 no_proxy
环境变量设置为我们的内部子域后,工件上传工作正常。
也可以在 /etc/systemd/system/gitlab-runner.service.d/http-proxy.conf
中设置变量,如 the docs 中所述:
[Service]
Environment="HTTP_PROXY=http://proxy.my.domain.org:8080/"
Environment="NO_PROXY=my.domain.org"
我在 Gitlab 中使用工作工件时遇到问题 CI。
我正在开发 docker 化的网络应用程序。我 运行 应用 docker-compose 和 运行 一些测试。 当测试失败时,测试框架会截取一些屏幕截图。然后我将屏幕截图复制到构建目录,并尝试将它们作为工件上传,但我得到以下信息:
Uploading artifacts...
Runtime platform arch=amd64 os=linux pid=6560 revision=d0b76032 version=12.0.2
src/tests/_output/: found 5 matching files
WARNING: Uploading artifacts to coordinator... failed id=11975 responseStatus=501 Not Implemented status=501 Not Implemented token=EyreCNs7
WARNING: Retrying... error=invalid argument
WARNING: Uploading artifacts to coordinator... failed id=11975 responseStatus=501 Not Implemented status=501 Not Implemented token=EyreCNs7
WARNING: Retrying... error=invalid argument
WARNING: Uploading artifacts to coordinator... failed id=11975 responseStatus=501 Not Implemented status=501 Not Implemented token=EyreCNs7
FATAL: invalid argument
ERROR: Job failed: exit status 1
舞台配置如下:
upload_screenshots:
stage: upload_screenshots
script:
- docker cp myapp_php_test:/var/www/html/myapp/tests/_output/. src/tests/_output/
when: on_failure
artifacts:
paths:
- src/tests/_output/
expire_in: 1 week
我做了一个测试项目,它只是创建一个文本文件并将其作为工件上传,它按预期工作:
test:
script:
- echo "test" > test.txt
- ls -la
artifacts:
paths:
- test.txt
expire_in: 1 week
$ echo "test" > test.txt
Uploading artifacts...
Runtime platform arch=amd64 os=linux pid=101330 revision=d0b76032 version=12.0.2
test.txt: found 1 matching files
Uploading artifacts to coordinator... ok id=11946 responseStatus=201 Created token=xmkvqina
Job succeeded
我运行正在使用 Gitlab CE 11.3.5 (c74e8d9) 和 Gitlab Runner 12.0.2 (d0b76032)。各自的服务器不在同一子网中。我认为它可能是我们的代理,但我不知道如何确定。此外,我的测试项目有效。
我该如何调试它?
有没有办法从 gitlab-ci 配置中使用 artifact-uploader 详细模式?
更新
这似乎是文件大小的问题。由于某些原因,我无法上传大于 63KB 的文件。
stages:
- passes
- fails
passes:
stage: passes
when: always
script:
- dd if=/dev/urandom of=test.dat bs=63K count=1
artifacts:
paths:
- "*.dat"
fails:
stage: fails
when: always
script:
- dd if=/dev/urandom of=test.dat bs=64K count=1
artifacts:
paths:
- "*.dat"
它是该死的代理
将 CI 设置中的 no_proxy
环境变量设置为我们的内部子域后,工件上传工作正常。
也可以在 /etc/systemd/system/gitlab-runner.service.d/http-proxy.conf
中设置变量,如 the docs 中所述:
[Service]
Environment="HTTP_PROXY=http://proxy.my.domain.org:8080/"
Environment="NO_PROXY=my.domain.org"