我将以下脚本添加到我的 CI 作业中,似乎在添加 CODECLIMATE_PREFIX 后它开始以无效的参考格式中止。我无法弄清楚究竟是什么原因造成的。
script:
- CONTAINER_ID=$(docker ps -q -f "label=com.gitlab.gitlab-runner.job.id=${CI_JOB_ID}")
- VOLUME_PATH=$(docker inspect $CONTAINER_ID --format '{{ range .Mounts }}{{ if eq .Destination "/builds" }}{{ .Source }}{{ end }}{{ end }}')
- VOLUME_CODE_PATH="${VOLUME_PATH}/${CI_PROJECT_DIR#$CI_BUILDS_DIR}"
- docker run
--rm
--env CODECLIMATE_PREFIX="mycompany.tools"
--env SOURCE_CODE=$VOLUME_CODE_PATH
--env CODECLIMATE_IMAGE="139735126512.dkr.ecr.us-west-1.amazonaws.com/ci/codeclimate:latest"
--volume /var/run/docker.sock:/var/run/docker.sock
--volume $VOLUME_CODE_PATH:/code
registry.gitlab.com/gitlab-org/ci-cd/codequality:0.85.23 /code
日志看起来像这样
Status: Downloaded newer image for registry.gitlab.com/gitlab-org/ci-cd/codequality:0.85.23
75invalid reference format
76docker: invalid reference format.
77See 'docker run --help'.
78Could not install code climate engines for the repository at /code