diff --git a/docs/docker/ansible/index.md b/docs/docker/ansible/index.md index b839230916887182c792f61af21016582a9bcb94..f19f07ff18c52d7e01efe9538a175cd4810ab17b 100644 --- a/docs/docker/ansible/index.md +++ b/docs/docker/ansible/index.md @@ -129,7 +129,7 @@ inventories at once. ### Running Ansible commands -To get a list of all prepard Ansible scripts, call +To get a list of all prepared Ansible scripts, call ``` dans INVENTORYNAME @@ -181,7 +181,7 @@ dans name1 direct setup "filter=ansible_*_mb" ### Other commands -For each inventory you downlaoded a separate Docker image, and a named Docker +For each inventory you downloaded a separate Docker image, and a named Docker container for each of them is running in the background. There are a few extra commands for those containers: diff --git a/docs/gitlab/ansible/index.md b/docs/gitlab/ansible/index.md new file mode 100644 index 0000000000000000000000000000000000000000..878caefaf43f5497588daad172e00fd64deaec7a --- /dev/null +++ b/docs/gitlab/ansible/index.md @@ -0,0 +1,80 @@ +--- +title: Ansible Docker Framework +repo: https://gitlab.lakedrops.com/gitlab/ansible +issues: https://gitlab.lakedrops.com/gitlab/ansible/-/issues +tags: +- ansible +- docker +- GitLab +--- +# 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 images 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. diff --git a/docs/gitlab/drupal/index.md b/docs/gitlab/drupal/index.md index 12ee7cb78de2d0dd58cef2feb0b3d0b5fde2a645..94969c60417f14b71586b815f46bc9b5687a6cbb 100644 --- a/docs/gitlab/drupal/index.md +++ b/docs/gitlab/drupal/index.md @@ -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:  + +## 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/" + }, +``` diff --git a/mkdocs.yml b/mkdocs.yml index 9a7df46fa2cc99d8abad55df7e5757ace7d9b5e4..75aab87f74f2c6f24d49d6e9458ddb1ae5f9f9b7 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -266,6 +266,7 @@ nav: - GitLab: - gitlab/index.md - Drupal: gitlab/drupal/index.md + - Ansible: gitlab/ansible/index.md - DevOps: - ALM: - devops/alm/alm.md