Skip to content
Snippets Groups Projects

Develop

Merged danielspeicher requested to merge develop into main
1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
+ 29
73
@@ -207,6 +207,8 @@ you have to write the scripts for those two tasks yourselves.
tests will be skipped.
- `DISABLE_CI_TEST_CODESTYLE`: if this variable is set to any value, the
PHP CS tests will be skipped.
- `DISABLE_CI_TEST_CYPRESSE2E:`: if this variable is set to any value, the
Cypress tests will be skipped.
- `DISABLE_CI_TEST_PHPUNIT`: if this variable is set to any value, the
PHP unit tests will be skipped.
- `CAE`: This variable is being used by the Drupal module
@@ -239,78 +241,6 @@ used to define dependencies:
- `deploy`
- `Deploy`
### Using Ansible
If you also use an [Ansible inventory](/ansible) for your hosts, you can of
course integrate them into the GitLab pipelines too. To make this work, you
need a separate GitLab runner tagged with `ansible` and a configuration
like this:
```
[[runners]]
name = "Name of ansible runner"
url = "https://gitlab.lakedrops.com/"
token = "TOKEN"
executor = "docker"
environment = ["DOCKER_AUTH_CONFIG={\"auths\":{\"registry.lakedrops.com\":{\"auth\":\"YOURAUTHTOKEN\"}}}"]
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.docker]
tls_verify = false
hostname = "Ansible-INVENTORYNAME"
image = "registry.lakedrops.com/ansible-inventories/INVENTORYNAME:latest"
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/home/gitlab-runner/.ssh/id_rsa:/root/.ssh/id_rsa", "/home/gitlab-runner/.a/variables.yml:/root/.ansible/secrets", "/home/gitlab-runner/.a/inventories/INVENTORYNAME:/root
/.ansible", "/etc/ansible.yml:/etc/ansible.yml", "/var/log/ansible:/var/log/ansible"]
pull_policy = "always"
shm_size = 0
```
The used placeholders in this example are:
- `TOKEN`: the token of the GitLab runner being generated during setup.
- `YOURAUTHTOKEN`: your auth token to the LakeDrops GitLab Docker registry.
- `INVENTORYNAME`: the name of the Ansible inventory to be used.
To learn more about the Ansible imeages for an inventory and how to set up some
configuration files, please have a look into
[Docker for Ansible](/docker/ansible).
Once you have the GitLab runner for Ansible setup for the Drupal project,
you can adjust your GitLab CI configuration:
#### Using Ansible to Dump DB
You can replace the task above with this simple instruction:
```yaml
Download DB:
extends: '.dumpdb'
```
#### Using Ansible for Deployment
You need a couple of additional variables and then you can replace the deploy
task above with this simple instruction:
```yaml
variables:
HOST_NAME: myhostname
SITE_NAME: mysiteid
Deploy:
extends: '.deploy'
```
The host name needs to be set to how the destination host is known in the
Ansible inventory, and the site name needs to be set to the ID of the Drupal
site in your inventory.
## Usage
This chapter is incomplete so far and needs more attention.
@@ -356,7 +286,7 @@ executed in the `prepare` stage instead.
## Example
We provide a [Demo Drupal 9 project](https://gitlab.lakedrops.com/gitlab-ci-cd/demos/drupal-9)
We provide a [Demo Drupal 10 project](https://gitlab.lakedrops.com/gitlab-ci-cd/demos/drupal-10)
which uses this GitLab CI framework. If you want to give it a try, login to
our GitLab, go to the project and click on "Request access". Once we've
accepted your request, you can clone the project, make some changes and push
@@ -376,3 +306,29 @@ Also, all the variables have been configured in the GitLab project settings,
because developers should not have access to them:
![Screenshot](/files/screenshots/Screenshot from 2021-01-23 17-20-07.png)
## GitLab CI for a single Drupal module
For building and testing a single `Drupal.org`, custom or contrib module, we make use of the official Drupal project
[GitLab Templates](https://www.drupal.org/project/gitlab_templates). To include the templates, we provide a
GitLab CI file [private-modules](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal/-/blob/main/private-modules.yml?ref_type=heads),
which can be included in your own `gitlab-ci.yml` file.
This includes the following stages:
* build
* validate
* test
To get a complete documentation for this powerful project, see [here](https://project.pages.drupalcode.org/gitlab_templates/).
This file `private-modules.yml` includes another CI template called
[composer-packages.yml](https://gitlab.lakedrops.com/gitlab-ci-cd/composer-packages/-/blob/main/composer-packages.yml?ref_type=heads).
Here you can store your module as a composer package in your own GitLab installation. The versioning is also included.
Now you can use it in a `composer.json` file. You have to define the repository like this:
```yaml
"<your-name>": {
"type": "composer",
"url": "https://<your-domain>/api/v4/group/<your-group>/-/packages/composer/"
},
```
Loading