Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,995
Community Members
 
Community Events
165
Community Groups

Patching files via composer using bitbucket pipelines

I have a very simple pipelines, I am just trying to get the app to build before I look to adding anything else to it. But, even in its simple state, I can't get composer to successfully patch a file. The entire composer install works flawlessly until this point:

  - Applying patches for drupal/core
    https://www.drupal.org/files/issues/2021-03-05/3007386-language-negotiator-weight-12.patch (Language negotiation weight)
   Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2021-03-05/3007386-language-negotiator-weight-12.patch
                                                                                                                                                
  [Exception]                                                                                                                                   
  Cannot apply patch Language negotiation weight (https://www.drupal.org/files/issues/2021-03-05/3007386-language-negotiator-weight-12.patch)!  

After it started failing, I added some debug to the config including trying to cat the file that was to be patched, but it is not there.

+ cat docroot/core/modules/language/src/LanguageNegotiator.php
cat: can't open 'docroot/core/modules/language/src/LanguageNegotiator.php': No such file or directory

This is the composer patch chunk:

  "extra": {
    "patches": {
      "drupal/core": {
        "Language negotiation weight": "https://www.drupal.org/files/issues/2018-10-17/3007386-language-negotiator-weight-2.patch"
      }
    },

This is the pipeline yml:

# Template PHP Build

# This template allows you to validate your PHP application.
# The workflow allows running tests and code linting on the default branch.

image: php:7.3-alpine

pipelines:
  default:
    - parallel:
        - step:
            name: Prepare environment
            script:
              - /sbin/apk update
              - /sbin/apk add git
              - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
              - docker-php-ext-install mysqli pdo pdo_mysql
              - /sbin/apk add libpng-dev
              - docker-php-ext-install mbstring
              - docker-php-ext-install gd
              - pwd
              - ls -la
              - cat docroot/core/modules/language/src/LanguageNegotiator.php
              - /usr/local/bin/composer install
            caches:
              - composer

Do I need to change directories or do something similar?

1 answer

0 votes
Mark C Atlassian Team Oct 17, 2021

Hi @Christian Biggins

Thank you for reaching out to the community.

Based on the error message, it appears the patch is not being skipped.

To debug it further, would it be possible for you to test your Pipelines build locally in a Docker container?
Ideally, if it works locally, it should also work on Pipelines.

Let me know how it goes.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,248 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you