Important
Code Assembly is currently in the Beta phase. If you are interested in participating in its Beta program, contact your Account Manager.
Code Assembly is a feature of Cloud Platform that installs your code dependencies, such as Composer packages, when you push your code to a Git repository hosted on Cloud Next. This enables you to follow best practices and avoid committing dependencies directly to your repository.
Key features
- Automated installation of Composer dependencies specified in the
composer.json
andcomposer.lock
files - Ability to build artifacts that can be deployed to an environment
Requirements
- Cloud Next environment
Composer-managed Drupal application that is installed on the Cloud Next environment
Note
You must adopt Composer as a dependency manager, and use a Composer scaffold, such as Acquia Drupal recommended project.
For more information, see Using Composer with local sites.
- Your project’s Composer-managed dependencies, such as the
vendor
directory, must not be committed to your branch. - Your
.gitignore
file must contain rules to exclude Composer-managed files and directories, such asvendor
,docroot/core
, ordocroot/contrib
.
- PHP version 8 or later
- Account Management approval for participating in the Beta program
Important
You cannot use Code Assembly if you already use a CI/CD pipeline to build and deploy hosting artifacts. Examples include, but are not limited to, Code Studio, Pipelines, and Github Actions. These products perform the steps to install dependencies and build hosting artifacts along with other significant development and DevOps tasks, such as automated testing, security scanning, or code quality checks execution. Code Assembly is intended for customers who currently do not utilize a CI/CD tool for their Cloud Platform application.
Key terminology
- Artifact: A hosting artifact includes all installed and sanitized dependencies that are necessary to host and use a Drupal application.
- Environment: A Cloud Next environment where you deploy code. For example, dev, stage, or prod.
Building artifacts with Code Assembly
To use Code Assembly, you must be an approved participant of the Beta program.
To build an artifact using Code Assembly:
Configure your local machine or Cloud IDE to communicate with Cloud Platform using SSH and Git, and then clone your Acquia Cloud Git repository to your local machine or Cloud IDE.
For more information, see Checking out a local copy of your code.
Run the following command to add the desired PHP version to the
composer.json
file:composer config extra.acquia.code-assembly.php_version 8.1
Important
The version of PHP that Code Assembly uses must match the version that you use locally, or in Cloud IDE for development and plan to deploy to your Cloud Platform.
- Switch to the branch where you want to push your changes.
- Commit and push the
composer.json
andcomposer.lock
files to Cloud Platform.
Code Assembly detects the changes in your branch, and executes the build steps to generate a hosting artifact.
This process might take several minutes to build the code and push the artifacts. The system creates a build branch within the repository. For example, CODE-ASSEMBLY-BUILD-<BRANCH_NAME>
.
If you have one or more environments that are configured to follow the CODE-ASSEMBLY-BUILD-<BRANCH-NAME>
branch, Cloud Platform deploys the resulting hosting artifact to the environment(s).
Important
Acquia recommends you to not track branches in production environments. After deploying a branch to a non-production environment, you can use the Cloud Platform UI to drag and drop the code to the production environment. This creates a tag from the most recent commit. For more information, see Moving code from one environment to another.
Workflow for Code Assembly
Code Assembly begins execution when you push a commit to your branch, resulting in a new code push into CODE-ASSEMBLY-BUILD-<BRANCH_NAME>
. A typical workflow for Code Assembly consists of the following steps:
When a new version of Drupal core is released, the user updates Drupal core locally, or in a Cloud IDE by running:
composer update drupal/core --with-all-dependencies
- The user commits the resulting changes to the
composer.json
andcomposer.lock
files. - The user pushes these changes to Cloud Platform.
- Code Assembly begins execution and pushes the new Drupal version into the
CODE-ASSEMBLY-BUILD-<BRANCH_NAME>
branch.