Skip to content

Commit 382801d

Browse files
committed
feat: add gitlab role to enable GitLab CI/CD
Add a new role `gitlab` to enable GitLab CI/CD for use in constructing a CI/CD pipeline that is compatible with `kayobe-automation`. Supports key features and workflows found within the `GitHub` role.
1 parent 726687d commit 382801d

File tree

20 files changed

+1363
-1
lines changed

20 files changed

+1363
-1
lines changed

roles/gitlab/README.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
Kayobe Automation Pipeline (GitLab)
2+
===================================
3+
4+
This Ansible role is capable of generating Gitlab pipeline files for performing CI/CD related activities with OpenStack via Kayobe.
5+
See the table below for a full list of all the currently supported kayobe automation tasks.
6+
7+
| **Name** | **Description** | **Stage** |
8+
|:---:|:---:|:---:|
9+
| **build kayobe docker image** | Build a new kayobe docker image whenever a new tag is pushed to the repository. The resulting image is then pushed to a docker registry such as [registry.gitlab.com/](registry.gitlab.com/). | build |
10+
| **overcloud container image build** | Build overcloud container images. | overcloud |
11+
| **overcloud container image pull** | Pull overcloud container images from a container registry. | overcloud |
12+
| **overcloud database backup** | Perform a backup of the database used by the overcloud. | overcloud |
13+
| **overcloud database recover** | Recover the database used by the overcloud. | overcloud |
14+
| **overcloud deployment image build** | Build the Ironic Python Agent (IPA) image. | overcloud |
15+
| **overcloud host command run** | Run a command against the overcloud hosts. | overcloud |
16+
| **overcloud host configure** | Perform an overcloud host configure. | overcloud |
17+
| **overcloud host image build** | Build the the image that would deployed to overcloud hosts during provisioning. | overcloud |
18+
| **overcloud host package update** | Perform an overcloud host package update. | overcloud |
19+
| **overcloud host upgrade** | Perform targeted upgrade of key services before an upgrade. | overcloud |
20+
| **overcloud inventory discover** | Get an inventory of nodes. | overcloud |
21+
| **overcloud provision** | Provision overcloud nodes. | overcloud |
22+
| **overcloud service configuration generate** | Generate the overcloud service configuration. | overcloud |
23+
| **overcloud service deploy** | Deploy overcloud services. | overcloud |
24+
| **overcloud service reconfigure** | Reconfigure overcloud services. | overcloud |
25+
| **overcloud service upgrade** | Perform an upgrade of overcloud services. | overcloud |
26+
| **seed container image build** | Build container images for seed. | overcloud |
27+
| **seed host configure** | Configure the seed host. | seed |
28+
| **seed host package update** | Update the system packages of the seed host. | seed |
29+
| **seed hypervisor host configure** | Configure the seed hypervisor host. | seed |
30+
| **seed hypervisor host package update** | Perform a package update of the seed hypervisor host. | seed |
31+
| **seed service deploy** | Deploy services on the seed. | seed |
32+
| **seed vm provision** | Provision the seed VM. | seed |
33+
| **infra vm host configure** | Perform a host configure of the infra VMs on demand. | infra vm |
34+
| **infra vm host package update** | Perform a package update of the infra VMs hosts on demand. | infra vm |
35+
| **infra vm provision** | Provision infra VMs on demand. | infra vm |
36+
| **infra vm service deploy** | Perform a service deploy against infra VMs on demand. | infra vm |
37+
| **network connectivity check** | Execute a network connectivity check to ensure all hosts are reachable and can reach `nc external ip ` & `nc external hostname`. | network |
38+
| **physical network configure** | Configure the physical network. | network |
39+
| **config diff** | When a pull request is opened generate diff showing the changes made to the configuration. | merge request |
40+
| **tempest** | Perform tests against the deployed openstack environment with tempest. | tempest |
41+
42+
Also available in Kayobe Automation for GitLab are pipelines which are stages designed to complete complex task such as upgrading all hypervisors in safe and reliable manner.
43+
44+
| **Name** | **Description** |
45+
|:---:|:---:|
46+
| **proc-overcloud-service-upgrade** | Perform an upgrade of overcloud services; pull containers, upgrade host, run tempest, backup database, upgrade services, run tempest and prune unused docker images. |
47+
| **proc-hypervisor-host-upgrade** | Perform a host upgrade of hypervisors; disable compute services, drain hypervisor, host configure, package update, reboot and renable compute services. |
48+
49+
50+
Role Variables
51+
--------------
52+
53+
The following variables can be used to make small adjustments to the composition of the workflows.
54+
55+
`gitlab_output_directory`: control the location where the workflows shall be written to.
56+
57+
`gitlab_environment_selector`: control the type of environment support the workflows should be generated with. Either `single` for fixed environment or `input` whereby the environment is controlled when the pipeline is created. No environment is the default by setting `gitlab_environment_selector` to no value or `Null`.
58+
59+
`gitlab_kayobe_environments`: list of environments the workflows should target. Only has effect when `gitlab_environment_selector` is `input` or `single`.
60+
61+
`gitlab_runs_on`: control which runner can accept this workflow. Default is `[kayobe, openstack]` See gitlab for more information on [tags](https://docs.gitlab.com/ee/ci/yaml/#tags).
62+
63+
`gitlab_image_name`: name of the kayobe image defaults to `kayobe`.
64+
65+
`gitlab_image_tag`: tag used to select kayobe image defaults to `latest`
66+
67+
`gitlab_registry`: dictionary containing keys that correspond to `url` and `share` for the registry to be used by the workflows. By default it uses repository variables and settings `REGISTRY_URL`. The key `share` is to indiciate if the registry is shared between all environments.
68+
69+
`gitlab_kayobe_base_image`: select the base image used when building the kayobe docker image. Default is `quay.io/rockylinux/rockylinux:9`.
70+
71+
`gitlab_kayobe_arguments`: a dictionary of arguments that can be used to override the default arguments found within `vars/main.yml`. For example if you wanted to change the value of `KAYOBE_AUTOMATION_PR_TITLE` from its default, you can do by simply adding `KAYOBE_AUTOMATION_PR_TITLE` to this dictionary and it will take precedence over the default.
72+
73+
`gitlab_tempest_test_suites`: provide a list of load lists to be made available within the drop-down list for running tempest. Defaults to `default` and `tempest-full`.
74+
75+
If you wish to make more impactful changes such as which jobs are built and what they contain then see the list of dictionaries called `jobs` in `defaults/main.yml`
76+
77+
`gitlab_jobs:` is a list of dictionaries that contains each of the job described above. A given list element is made up of the following:
78+
79+
- `name`: the name which the job shall refer to itself as within gitlab job user interface.
80+
81+
- `stage`: name of the stage the job belongs to and thus the file.
82+
83+
Example Playbook
84+
----------------
85+
86+
The following example playbook will generate a `reference` pipeline which can be found under `.gitlab` and `.gitlab/..`
87+
88+
```yaml
89+
- name: Write Kayobe Automation Pipeline for gitlab
90+
hosts: localhost
91+
roles:
92+
- stackhpc.kayobe_workflows.gitlab
93+
```
94+
95+
License
96+
-------
97+
98+
Apache License 2.0
99+
100+
Author Information
101+
------------------
102+
103+
[StackHPC](https://www.stackhpc.com/)

0 commit comments

Comments
 (0)