Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Documentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DevOps Tools
Documentation
Commits
b0542398
Commit
b0542398
authored
8 months ago
by
danielspeicher
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' into 'main'
Develop See merge request
!21
parents
eb13ab76
3f946124
No related branches found
No related tags found
1 merge request
!21
Develop
Pipeline
#1256132
passed
8 months ago
Stage: build
Stage: deploy
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
docs/docker/ansible/index.md
+2
-2
2 additions, 2 deletions
docs/docker/ansible/index.md
docs/gitlab/ansible/index.md
+80
-0
80 additions, 0 deletions
docs/gitlab/ansible/index.md
docs/gitlab/drupal/index.md
+29
-73
29 additions, 73 deletions
docs/gitlab/drupal/index.md
mkdocs.yml
+1
-0
1 addition, 0 deletions
mkdocs.yml
with
112 additions
and
75 deletions
docs/docker/ansible/index.md
+
2
−
2
View file @
b0542398
...
...
@@ -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 prepar
e
d Ansible scripts, call
```
dans INVENTORYNAME
...
...
@@ -181,7 +181,7 @@ dans name1 direct setup "filter=ansible_*_mb"
### Other commands
For each inventory you downl
a
oded a separate Docker image, and a named Docker
For each inventory you downlo
a
ded 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:
...
...
This diff is collapsed.
Click to expand it.
docs/gitlab/ansible/index.md
0 → 100644
+
80
−
0
View file @
b0542398
---
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.
This diff is collapsed.
Click to expand it.
docs/gitlab/drupal/index.md
+
29
−
73
View file @
b0542398
...
...
@@ -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/"
}
,
```
This diff is collapsed.
Click to expand it.
mkdocs.yml
+
1
−
0
View file @
b0542398
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment