To move code between your source and build repositories, you can use one of the following methods:
Copy the necessary files locally
Use a continuous integration service, such as Code Studio or Pipelines
Use a tool automating the process, such as Acquia CLI
You can use a Composer-based workflow with a single repository. Acquia recommends you to not use a Composer-based workflow with a single repository because it impacts the development workflow by making it difficult to maintain code consistency. For example, with a single repository, you must keep the versions of dependencies in composer.json and the versions of dependencies you commit to the repository in sync, which introduces a high risk of human error.
If you cannot use Code Studio or Pipelines, you can use Composer based on the following methods:
push:artifact commands.gitignore file ignores the vendor directory as you use Composer and Acquia CLI to push your code to Cloud Platform.To encrypt Composer variables in Cloud Platform Pipelines, see Encrypting keys and variables.
When encrypting the COMPOSER_AUTH variable using the Encrypt Credentials field in the Cloud Platform interface, ensure you use single quotes at the beginning and end of the json, and use double quotes inside the curly brackets, as in the following example:
'{"http-basic": {"mysite.com": {"username": "myuser", "password": "mypassword"}}}'Failing to follow the preceding code format can generate the following UnexpectedValueException error:
COMPOSER_AUTH environment variable is malformed, should be a valid JSON objectDrupal core uses Composer to manage dependencies, which can include Drupal modules. For more information, see the following Drupal.org resources:
To enable patching through Composer:
Install the composer-patches project with Composer:
composer require cweagans/composer-patchesAdd the following to the extra section of the composer.json file located above the docroot directory:
"enable-patching": true,
"patches": {
"drupal/[module_name]": {
"Note regarding the nature of the patch being applied":
"https://www.drupal.org/files/issues/[patch_name].patch"
}
}Update the [module_name] and [patch_name] according to your patch file from Drupal.org or add your patches in the patches directory above the docroot directory and record the full path in your patches.make file. However, Acquia recommends that you patch from remote, such as Drupal.org or Github. Local patches are difficult to maintain as the underlying dependencies require to be updated over time. Acquia recommends that you use patching to fix bugs or address outstanding issues in Drupal core and contrib modules and packages. Patches should not be used to develop or add functionality.
Alternately, take out the patches from the root composer.json file and include in a separate file. This is a cleaner way of tracking them when you are dealing with various patches.
The following code block would be added to your composer.json:
{
// [...]
"extra": {
// [...]
"patches-file": "composer.patches.json"
}
}Patches are added to a composer.patches.json text file as follows:
{
"patches": {
"vendor/project": {
"Message describing the patch": "https://www.drupal.org/url/to/patch/file.patch"
}
}
}To ensure that the updates take effect, run the following command:
composer update patched/package --with-all-dependenciesIf this content did not answer your questions, try searching or contacting our support team for further assistance.
Copy the necessary files locally
Use a continuous integration service, such as Code Studio or Pipelines
Use a tool automating the process, such as Acquia CLI
You can use a Composer-based workflow with a single repository. Acquia recommends you to not use a Composer-based workflow with a single repository because it impacts the development workflow by making it difficult to maintain code consistency. For example, with a single repository, you must keep the versions of dependencies in composer.json and the versions of dependencies you commit to the repository in sync, which introduces a high risk of human error.
If you cannot use Code Studio or Pipelines, you can use Composer based on the following methods:
push:artifact commands.gitignore file ignores the vendor directory as you use Composer and Acquia CLI to push your code to Cloud Platform.To encrypt Composer variables in Cloud Platform Pipelines, see Encrypting keys and variables.
When encrypting the COMPOSER_AUTH variable using the Encrypt Credentials field in the Cloud Platform interface, ensure you use single quotes at the beginning and end of the json, and use double quotes inside the curly brackets, as in the following example:
'{"http-basic": {"mysite.com": {"username": "myuser", "password": "mypassword"}}}'Failing to follow the preceding code format can generate the following UnexpectedValueException error:
COMPOSER_AUTH environment variable is malformed, should be a valid JSON objectDrupal core uses Composer to manage dependencies, which can include Drupal modules. For more information, see the following Drupal.org resources:
To enable patching through Composer:
Install the composer-patches project with Composer:
composer require cweagans/composer-patchesAdd the following to the extra section of the composer.json file located above the docroot directory:
"enable-patching": true,
"patches": {
"drupal/[module_name]": {
"Note regarding the nature of the patch being applied":
"https://www.drupal.org/files/issues/[patch_name].patch"
}
}Update the [module_name] and [patch_name] according to your patch file from Drupal.org or add your patches in the patches directory above the docroot directory and record the full path in your patches.make file. However, Acquia recommends that you patch from remote, such as Drupal.org or Github. Local patches are difficult to maintain as the underlying dependencies require to be updated over time. Acquia recommends that you use patching to fix bugs or address outstanding issues in Drupal core and contrib modules and packages. Patches should not be used to develop or add functionality.
Alternately, take out the patches from the root composer.json file and include in a separate file. This is a cleaner way of tracking them when you are dealing with various patches.
The following code block would be added to your composer.json:
{
// [...]
"extra": {
// [...]
"patches-file": "composer.patches.json"
}
}Patches are added to a composer.patches.json text file as follows:
{
"patches": {
"vendor/project": {
"Message describing the patch": "https://www.drupal.org/url/to/patch/file.patch"
}
}
}To ensure that the updates take effect, run the following command:
composer update patched/package --with-all-dependenciesIf this content did not answer your questions, try searching or contacting our support team for further assistance.