【问题标题】:Pipeline in bitbucket failed by composer errorbitbucket 中的管道因作曲家错误而失败
【发布时间】:2018-12-19 10:30:34
【问题描述】:

我尝试使用 bitbucket 中的管道。这是我正在使用的默认配置:

# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:5.6.36
pipelines:
  default:
    - step:
      caches:
        - composer
      script:
        - apt-get update && apt-get install -y unzip
        - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
        - composer install
        - vendor/bin/phpunit

我收到了这个错误

+ composer install
  Do not run Composer as root/super user! See https://getcomposer.org/rootfor details
  Composer could not find a composer.json file in /opt/atlassian/pipelines/agent/build
  To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

即使我在 /opt/atlassian/pipelines/agent/build 中创建了 composer.json(也包括所有路径)。

顺便说一句,为什么工具在这样的路径中寻找作曲家?我已经在 /home/username/.composer 上安装了 composer

我做错了什么?

【问题讨论】:

  • 请改写帖子。为什么工具在做什么?你在 /home/username/.composer 中安装了什么?为什么不使用安装了 composer 的docker image?为什么不在运行 composer install 之前在该路径中创建 composer.json 并查看错误是否仍然存在?
  • 对不起,我的英语不好,我填了几句。
  • 我手动安装了作曲家,它可以工作。当我将作曲家写到终端时,它会完成所有必须做的事情。在路径 /home/username/.composer 中是 composer.json。我不知道为什么 bitbucket 不使用该作曲家并尝试在 /opt/atlassian/pipelines/agent/build 中查找 composer.json。没有作曲家,我手动创建了那个文件,但没有帮助。
  • 您的 PC 上安装了 composer 吗?你知道 bitbucked 管道是在 docker 环境中执行的吗?

标签: linux composer-php bitbucket bitbucket-pipelines


【解决方案1】:

使用另一个 docker 容器而不是 image: php:5.6.36 进行部署。 有官方作曲家容器:https://hub.docker.com/_/composer/ 它基于php:7-alpine3.7,我希望 PHP7 也能在您的应用程序中完成这项工作。

【讨论】:

    猜你喜欢
    • 2019-07-06
    • 2020-03-26
    • 2014-11-23
    • 2021-05-01
    • 1970-01-01
    • 2020-04-01
    • 2020-04-02
    • 1970-01-01
    • 2020-09-17
    相关资源
    最近更新 更多