首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >架设gitlab phpstan管道

架设gitlab phpstan管道
EN

DevOps用户
提问于 2022-07-20 14:19:11
回答 1查看 559关注 0票数 0

本指南报道,我已经尝试开始在gitlab上使用phpstan管道。

问题是管道根本不工作(命令'sh‘没有定义),我不知道如何修复它。

这是我的..gitlab ci.yml文件:

代码语言:javascript
复制
stages:
  - check

phpstan:
  stage: check
  image: ghcr.io/phpstan/phpstan
  script:
    - analyse --no-progress --error-format gitlab > phpstan.json

这是管道输出:

代码语言:javascript
复制
Running with gitlab-runner 15.2.0~beta.17.g34ae4a68 (34ae4a68)
  on blue-5.shared.runners-manager.gitlab.com/default -AzERasQ
Preparing the "docker+machine" executor
Using Docker executor with image ghcr.io/phpstan/phpstan ...
Pulling docker image ghcr.io/phpstan/phpstan ...
Using docker image sha256:797d91431d4ecb9c7c570d793db215dec2ae01f942b85e4e6e7cf4e07d07c8f2 for     ghcr.io/phpstan/phpstan with digest     ghcr.io/phpstan/phpstan@sha256:ac693ee977b314976226205631cd9071364f6c84b3b113f0c9404f9d4747a0b5     ...
Preparing environment
00:01
Running on runner--azerasq-project-37231833-concurrent-0 via runner-azerasq-shared-1658326011-    484bb33b...
Getting source from Git repository
00:03
$ eval "$CI_PRE_CLONE_SCRIPT"
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/balikobot/BalikobotAdmin/.git/
Created fresh repository.
Checking out e4512b17 as feature/ci-pipeline...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:01
Using docker image sha256:797d91431d4ecb9c7c570d793db215dec2ae01f942b85e4e6e7cf4e07d07c8f2 for     ghcr.io/phpstan/phpstan with digest     ghcr.io/phpstan/phpstan@sha256:ac693ee977b314976226205631cd9071364f6c84b3b113f0c9404f9d4747a0b5     ...
                            
  Command "sh" is not defined.  
                            
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
EN

回答 1

DevOps用户

回答已采纳

发布于 2022-07-20 15:59:16

问题是,phpstan的官方Docker映像使用入口点,Gitlab运行程序使用"sh -c“命令调用该映像。您可以覆盖默认入口点(https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#overriding-the-entrypoint-of-an-image):

代码语言:javascript
复制
phpstan:
  stage: check
  image: 
    name: ghcr.io/phpstan/phpstan
    entrypoint: [""]
  script:
    - phpstan analyse

我建议对phpstan使用一个带有具体版本的Docker映像(不要使用最新的标签)。

票数 1
EN
页面原文内容由DevOps提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://devops.stackexchange.com/questions/16320

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档