Skip to content

Commit cf00aa2

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 cf00aa2

File tree

8 files changed

+918
-0
lines changed

8 files changed

+918
-0
lines changed

roles/gitlab/README.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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 runbooks which are stages designed to complete complex task such as upgrading all hypervisors in safe and reliable manner.
43+
44+
| **Name** | **Description** |
45+
|:---:|:---:|
46+
| **runbook 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+
| **runbook in place hypervisor host upgrade** | Perform an in place host upgrade of hypervisors; disable compute services, drain hypervisor, 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_kayobe_environments`: list of environments the workflows should target.
58+
59+
`gitlab_image_name`: name of the kayobe image defaults to `kayobe`.
60+
61+
`gitlab_image_tag`: tag used to select kayobe image defaults to `latest`
62+
63+
`gitlab_registry`: a string that either points to a registry or is `$CI_REGISTRY_URL` in the case of multiple environments that do not share the same registry.
64+
65+
`gitlab_kayobe_base_image`: select the base image used when building the kayobe docker image. Default is `quay.io/rockylinux/rockylinux:9`.
66+
67+
`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`.
68+
69+
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`
70+
71+
`gitlab_stages:` is a dictionary of dictionary that contains string blocks defining the job within a given stage. Any job maybe overwritten by editing the `gitlab_JOB_NAME` or a stage can be extended adding to the `gitlab_STAGE_NAME_extra` dictionary. If you require adding additional stages that add the stage to `gitlab_extra_stages`.
72+
73+
```
74+
gitlab_infra_vm_host_configure: |
75+
rules:
76+
- !reference [.active_stage_web_rule, rules]
77+
stage: infra-vm
78+
resource_group: infra-vm
79+
script:
80+
- !reference [.get_secrets, script]
81+
- .automation/pipeline/infra-vm-host-configure.sh
82+
allow_failure: true
83+
```
84+
85+
```
86+
gitlab_infra_vm_something_new: |
87+
rules:
88+
- !reference [.active_stage_web_rule, rules]
89+
stage: infra-vm
90+
resource_group: infra-vm
91+
script:
92+
- !reference [.get_secrets, script]
93+
- .automation/pipeline/does_something_new.sh
94+
allow_failure: true
95+
96+
gitlab_stage_infra_vm_extra:
97+
infra_vm_something_new: "{{ gitlab_infra_vm_something_new }}"
98+
```
99+
100+
Example Playbook
101+
----------------
102+
103+
The following example playbook will generate a `reference` pipeline which can be found under `.gitlab` and `.gitlab/..`
104+
105+
```yaml
106+
- name: Write Kayobe Automation Pipeline for gitlab
107+
hosts: localhost
108+
roles:
109+
- stackhpc.kayobe_workflows.gitlab
110+
```
111+
112+
License
113+
-------
114+
115+
Apache License 2.0
116+
117+
Author Information
118+
------------------
119+
120+
[StackHPC](https://www.stackhpc.com/)

0 commit comments

Comments
 (0)