Fri Oct 04 2024 13:46:37 GMT+0000 (Coordinated Universal Time)
This page provides information about how Code Assembly manages the dependencies of applications.
After you enable Code Assembly, it monitors your hosting repository, detects new commits, and checks the commit for key markers to determine its next steps.
For Composer, Code Assembly checks for the following:
composer.json
filevendor
directoryDefinition of php_version
in the composer.json
file
To add php_version
in the composer.json
file, run the following command:
composer config extra.acquia.code-assembly.php_version 8.3
The command adds the following lines to the composer.json
file:
"extra": {
"acquia": {
"code-assembly.php_version": "8.3"
}
}
For NPM, Code Assembly checks for the following:
package.json
filenode_modules
directoryDefinition of node_version
in the package.json
file
To add node_version
in the package.json
file, add it in the extra
section as follows:
"extra": {
"acquia": {
"code-assembly.node_version": "18",
"code-assembly.install_command": "npm i",
"code-assembly.root_directory": "./"
}
}
The parameters in the extra
section vary depending on the method used for generating content for the Static Site Generation (SSG), Server Side Rendering (SSR), or Incremental Site Generation (ISG) application.
If Code Assembly detects the appropriate markers, it executes the necessary steps to install dependencies and build a hosting artifact. This process might take several minutes to build the code and push the artifacts. If Code Assembly does not detect an appropriate .json
file or it detects the presence of a directory managed by the dependency manager, the task fails and Code Assembly sends appropriate messages to the task log present in the Cloud Platform user interface. The messages help users to know the reason for failure, such as absence of the composer.json
file or the package.json
file, presence of the vendor
directory or the node_modules
directory, absence of the definition of php_version
or the node_version
, and so on.
During the execution, Code Assembly places the output of the composer install
command or the npm install
command into a build branch. The name of the build branch is based on the branch where the commit was made. For instance, if you have a branch named <BRANCH_NAME>
, then Code Assembly commits the resulting build artifact into CODE-ASSEMBLY-BUILD-<BRANCH_NAME>
.
After Code Assembly makes a commit into CODE-ASSEMBLY-BUILD-<BRANCH_NAME>
, Cloud Platform deploys the resulting code into any environments that follow the CODE-ASSEMBLY-BUILD-<BRANCH_NAME>
naming convention. If none of the branches follows the CODE-ASSEMBLY-BUILD-<BRANCH_NAME>
naming convention, Cloud Platform does not follow automatic deployments.
If a branch does not follow the CODE-ASSEMBLY-BUILD-<BRANCH_NAME>
naming convention, you can still deploy it to an environment. However, such a deployment does not install the necessary dependencies that allow the application to bootstrap and run. If you build the dependencies on your own and commit to this branch, Cloud Platform will not deploy automatic updates made to this branch, into the environments that follow it. The reason is that the branch is not considered to be deployable when you enable Code Assembly. Therefore, you must disable Code Assembly to manage dependencies on your own.
If you use Code Assembly, ensure that Cloud Platform deploys only the build branches and those branches follow the CODE-ASSEMBLY-BUILD-<BRANCH>
naming convention for deployable branches.
If you use another tool to install and manage dependencies, you must not use Code Assembly to deploy a branch that is not managed by Code Assembly.
CODE-ASSEMBLY-BUILD-develop
develop
A new security release of Drupal is released. Your team wants to update to this most recent security release.
A user opens their Cloud IDE and pulls the most recent commit from the develop
branch in the hosting repository using Git:
git checkout develop
The user updates Drupal core in their Cloud IDE by running:
composer update drupal/core --with-all-dependencies
composer.json
file and the composer.lock
file.The user pushes these changes to the develop
branch of the hosting Git repository.
As you enable Code Assembly, the workflow involves working with the following types of branches:
<BRANCHNAME>
prefixCODE-ASSEMBLY-BUILD-<BRANCHNAME>
prefixThe user makes commits on unbuild branches, and Code Assembly performs the build process.
Code Assembly commits the changes from its build into CODE-ASSEMBLY-BUILD-develop
.
The user works on a pair of branches that are dependent on each other:
<BRANCHNAME>
: The non-deployable branch where the user makes commits.
CODE-ASSEMBLY-BUILD-<BRANCHNAME>
: The deployable branch built from the commits to <BRANCHNAME>
. This branch can be deployed to any environment.
Any commits made to this branch are overridden with every new build.
CODE-ASSEMBLY-BUILD-develop
branch.If this content did not answer your questions, try searching or contacting our support team for further assistance.