is used to ensure that your scaffold files are updated every time drupal/core is
updated. If you customize any of the "scaffolding" files (commonly `.htaccess`),
you may need to merge conflicts if any of your modified files are updated in a
new release of Drupal core.
Follow the steps below to update your core files.
1. Run `composer update "drupal/core-*" --with-dependencies` to update Drupal Core and its dependencies.
2. Run `git diff` to determine if any of the scaffolding files have changed.
Review the files for any changes and restore any customizations to
`.htaccess` or `robots.txt`.
1. Commit everything all together in a single commit, so `web` will remain in
sync with the `core` when checking out branches or running `git bisect`.
1. In the event that there are non-trivial conflicts in step 2, you may wish
to perform these steps on a branch, and use `git merge` to combine the
updated core files with your customized files. This facilitates the use
of a [three-way merge tool such as kdiff3](http://www.gitshah.com/2010/12/how-to-setup-kdiff-as-diff-tool-for-git.html). This setup is not necessary if your changes are simple;
keeping all of your modifications at the beginning or end of the file is a
good strategy to keep merges easy.
## FAQ
### Should I commit the contrib modules I download?
Composer recommends **no**. They provide [argumentation against but also
workrounds if a project decides to do it anyway](https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md).
### Should I commit the scaffolding files?
The [Drupal Composer Scaffold](https://github.com/drupal/core-composer-scaffold)
plugin can download the scaffold files (like index.php, update.php, …) to the
web/ directory of your project. If you have not customized those files you could
choose to not check them into your version control system (e.g. git). If that is
the case for your project it might be convenient to automatically run the
drupal-scaffold plugin after every install or update of your project. You can
achieve that by registering `@composer drupal:scaffold` as post-install and
post-update command in your composer.json:
```json
"scripts":{
"post-install-cmd":[
"@composer drupal:scaffold",
"..."
],
"post-update-cmd":[
"@composer drupal:scaffold",
"..."
]
},
```
## <h2 id="release"></h2> Versioning and Release
### How can I apply patches to downloaded modules?
The precise contents of the images currently running a Drupal site can be linked to this repo.
Each branch in this repo starting with the letter `v*` is a stable version branch.
The branch's name corresponds to the `spec.version.name` field in the DrupalSite.
If you need to apply patches (depending on the project being modified, a pull
request is often a better solution), you can do so with the
For a standard user, this is all that is needed to instantiate the Drupal site: the latest release (commit)
of the specified branch will be deployed automatically.
The resolved/currently running release (version + releaseSpec) can be found in `DrupalSite.status.releaseID.current`.
To add a patch to drupal module foobar insert the patches section in the extra
section of composer.json:
The following section gives a detailed description of the GitOps workflow of this repo.
```json
"extra":{
"patches":{
"drupal/foobar":{
"Patch description":"URL or local path to patch"
}
}
}
```
### GitOps (details)
### How do I specify a PHP version ?
The tip of the repo's history is the `master` branch.
At each point in time we also have some supported version branches (v8.9-1, v8.9-2 in this example):
This project supports PHP 7.3 as minimum version (see [Environment requirements of Drupal 9](https://www.drupal.org/docs/understanding-drupal/how-drupal-9-was-made-and-what-is-included/environment-requirements-of)), however it's possible that a `composer update` will upgrade some package that will then require PHP 7.3+.
```
master v8.9-2 v8.9-1
|
| | dev8.9-1-secfix3
|<----- |
|
|
| | | ----->|
| ------>|
| | (backported security fix)
|
|
| ------------->|
|
| dev-myfeature
|<--- |
| |
| --->|
|
```
To prevent this you can add this code to specify the PHP version you want to use in the `config` section of `composer.json`:
For each commit in a version branch the corresponding image tag is: `<branch>-RELEASE.<date>`
```json
"config":{
"sort-packages":true,
"platform":{
"php":"7.3.19"
}
},
```
### How do I edit a profile?
#### Development
The profiles are imported during image creation, to edit one please see the
following repository:
https://gitlab.cern.ch/drupal/profiles
Development happens on the master branch using feature branches (`dev-myfeature` in the example above).
Backporting happens in feature branches (`dev8.9-1-secfix3`) that branch out from the version branches.
Each non-version branch produces image tags with each commit of the format `<branch>-<commit-sha>`.
### How to update [JS libs](web/libraries)?
#### Testing
Run this after composer update.
Eventually, CI should run a test suite for every commit against the drupal-stg cluster.
CI should be a normal user that creates a DrupalSite with this version/release and runs tests against it.
Note: find the latest versions for the libs with a `VERSION` variable.
is used to ensure that your scaffold files are updated every time drupal/core is
updated. If you customize any of the "scaffolding" files (commonly `.htaccess`),
you may need to merge conflicts if any of your modified files are updated in a
new release of Drupal core.
Follow the steps below to update your core files.
1. Run `composer update "drupal/core-*" --with-dependencies` to update Drupal Core and its dependencies.
2. Run `git diff` to determine if any of the scaffolding files have changed.
Review the files for any changes and restore any customizations to
`.htaccess` or `robots.txt`.
1. Commit everything all together in a single commit, so `web` will remain in
sync with the `core` when checking out branches or running `git bisect`.
1. In the event that there are non-trivial conflicts in step 2, you may wish
to perform these steps on a branch, and use `git merge` to combine the
updated core files with your customized files. This facilitates the use
of a [three-way merge tool such as kdiff3](http://www.gitshah.com/2010/12/how-to-setup-kdiff-as-diff-tool-for-git.html). This setup is not necessary if your changes are simple;
keeping all of your modifications at the beginning or end of the file is a
good strategy to keep merges easy.
## FAQ
### Should I commit the contrib modules I download?
Composer recommends **no**. They provide [argumentation against but also
workrounds if a project decides to do it anyway](https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md).
### Should I commit the scaffolding files?
The [Drupal Composer Scaffold](https://github.com/drupal/core-composer-scaffold)
plugin can download the scaffold files (like index.php, update.php, …) to the
web/ directory of your project. If you have not customized those files you could
choose to not check them into your version control system (e.g. git). If that is
the case for your project it might be convenient to automatically run the
drupal-scaffold plugin after every install or update of your project. You can
achieve that by registering `@composer drupal:scaffold` as post-install and
post-update command in your composer.json:
```json
"scripts":{
"post-install-cmd":[
"@composer drupal:scaffold",
"..."
],
"post-update-cmd":[
"@composer drupal:scaffold",
"..."
]
},
```
### How can I apply patches to downloaded modules?
If you need to apply patches (depending on the project being modified, a pull
request is often a better solution), you can do so with the
To add a patch to drupal module foobar insert the patches section in the extra
section of composer.json:
```json
"extra":{
"patches":{
"drupal/foobar":{
"Patch description":"URL or local path to patch"
}
}
}
```
### How do I specify a PHP version ?
This project supports PHP 7.3 as minimum version (see [Environment requirements of Drupal 9](https://www.drupal.org/docs/understanding-drupal/how-drupal-9-was-made-and-what-is-included/environment-requirements-of)), however it's possible that a `composer update` will upgrade some package that will then require PHP 7.3+.
To prevent this you can add this code to specify the PHP version you want to use in the `config` section of `composer.json`:
```json
"config":{
"sort-packages":true,
"platform":{
"php":"7.3.19"
}
},
```
### How do I edit a profile?
The profiles are imported during image creation, to edit one please see the
following repository:
https://gitlab.cern.ch/drupal/profiles
### How to update [JS libs](web/libraries)?
Run this after composer update.
Note: find the latest versions for the libs with a `VERSION` variable.