作曲家缓存不适用于bitbucket管道构建

时间:2019-12-30 18:42:50

标签: php docker composer-php bitbucket bitbucket-pipelines

我在我的Bitbucket管道中得到了这个

pipelines:
  branches:
    develop:
    - step:
        caches:
          - composer
        name: unit tests - Delivery 
        image: totersapp/laravel-docker:phpredis
        script:
        - echo "memory_limit=512M" > /usr/local/etc/php/conf.d/memory-limit-php.ini
        - ln -f -s .env.pipelines .env
        - composer install 
        services:
        - postgres
        - redis

每次运行时,它都会下载相同的文件(即使在第二次运行时)。为什么有什么主意?

这是作曲家安装的日志:

+ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 199 installs, 0 updates, 0 removals
  - Installing kylekatarnls/update-helper (1.2.0): Downloading (connecting...)Downloading (0%)           Downloading (100%)
  - Installing ocramius/package-versions (1.4.2): Downloading (connecting...)Downloading (0%)           Downloading (30%)Downloading (35%)Downloading (65%)Downloading (95%)Downloading (100%)
  - Installing symfony/polyfill-ctype (v1.13.1): Downloading (connecting...)Downloading (0%)           Downloading (100%)

2 个答案:

答案 0 :(得分:2)

要完成这项工作,我基本上遵循了Nico Haase的answer,但我还必须执行以下操作:

  • 从我的composer.json中删除Sub test() Dim wb As Workbook For Each wb In Workbooks If wb.Name Like "*_ACES Pipeline Mgmnt Tracking Report.xlsb" Then wb.Activate Exit for End If Next End Sub
  • 确保保存的缓存文件与composer.json中发生的任何事情保持同步状态。您不能要求composer.json从内容不相关的缓存文件中加载依赖项。为此,我只是删除了所有缓存文件,然后再次启动,这次就可以了!

enter image description here

答案 1 :(得分:0)

根据a question on the Bitbucket forums,如果您使用的Docker映像将下载的文件放置在异常位置,则可能发生这种情况。根据{{​​3}},缓存的通常目录是~/.composer/cache,而the documentation about caches使用/composer

请尝试使用以下配置:

pipelines:
  branches:
    develop:
    - step:
        caches:
          - composer: /composer/cache