modified
parent
b0d8b5d809
commit
4a90689e22
51
README.md
51
README.md
|
|
@ -5,7 +5,16 @@
|
|||
[**2. Info**](#info)<br />
|
||||
[**3. Repositories**](#repositories)<br />
|
||||
[**4. Requirements**](#requirements)<br />
|
||||
[4.1 Python](#python)<br />
|
||||
[4.2 Packages](#packages)<br />
|
||||
[**5. Documentation**](#documentation)<br />
|
||||
[5.1 Arguments](#arguments)<br />
|
||||
[*5.1.1 Examples*](#examples)<br />
|
||||
[5.2 Jenkins Pipeline](#jenkins-pipeline)<br />
|
||||
[5.3 Data Structure of YAML Files](#data-structure-of-yaml-files)<br />
|
||||
[*5.3.1 Supported Metrics*](#supported-metrics)<br />
|
||||
[5.4 Jinja Templates](#jinja-templates)<br />
|
||||
[5.5 Terraform Output Folder Structure](#terraform-output-folder-structure)<br />
|
||||
|
||||
<a name="description"></a>
|
||||
## **1. Description**
|
||||
|
|
@ -17,31 +26,34 @@ This repository contains a first draft script that can use a specific YAML file
|
|||
- YAML files should be stored according to the business line (DE-3, DE-4, DE-7, EC-DE) within the respective business line folder!
|
||||
- Some YAML files have already been created for testing purposes based on the shared_configuration and coco_terraform_config repositories and were therefore added in this repository.
|
||||
> ⚠️ Currently the input from YAML filenames starting with the prefix **`TP_`** are supported!
|
||||
|
||||
<a id="repositories"></a>
|
||||
|
||||
<a name="repositories"></a>
|
||||
## **3. Repositories**
|
||||
The following repositores have been used to create some YAML files.
|
||||
- [shared_configuration](https://atc.bmwgroup.net/bitbucket/projects/OPAPM/repos/shared_configuration)
|
||||
- [coco_terraform_config](https://atc.bmwgroup.net/bitbucket/projects/OPAPM/repos/coco_terraform_config)
|
||||
|
||||
<a id="requirements"></a>
|
||||
<a name="requirements"></a>
|
||||
## **4. Requirements**
|
||||
|
||||
### **Python**
|
||||
<a name="python"></a>
|
||||
### 4.1 Python
|
||||
The used python version for running the script is 3.11.2.
|
||||
|
||||
### **Libraries**
|
||||
<a name="packages"></a>
|
||||
### 4.2 Packages
|
||||
Some python packages need to be installed. Please use the requirements.txt file to install missing packages. The command for installing the missing packages is:
|
||||
```sh
|
||||
pip3 install --user -r requirements.txt
|
||||
```
|
||||
<a id="documentation"></a>
|
||||
|
||||
<a name="documentation"></a>
|
||||
## **5. Documentation**
|
||||
The following section is just a small exhibit tailored to the use of the script.
|
||||
|
||||
### **Arguments**
|
||||
<a name="arguments"></a>
|
||||
### 5.1 Arguments
|
||||
If the script needs to be used for local execution, then the following command should be used:
|
||||
|
||||
```
|
||||
.\generate.py <path to yaml file/folder> <path to output folder>
|
||||
```
|
||||
|
|
@ -49,7 +61,8 @@ Please note that two arguments are necessary:
|
|||
- <b>`<path to yaml folder>`</b> - Here it is necessary to provide the path to the folder where the yaml files are stored. Fore example, if the yaml files are stored within the DE-3 business line folder, then it is important to convey the correct path as an argument for the script, in this case <b>`.\DE-3\`</b>. It is also possible to provide multiple folders, but they have to be delimited by a comma when parsing, in this case <b>`.\DE-3\,.\DE-4\,.\DE-7\`</b>!
|
||||
- <b>`<optional:path to output folder>`</b> - If it is necessary to store the generated Terraform files to a specific location, then the correct path to that particular folder needs to be provided! Alternatively, the default path <b>`.\output\`</b> will be used which is within the current working directory of the script.
|
||||
|
||||
#### **Examples**
|
||||
<a name="examples"></a>
|
||||
#### *5.1.1 Examples*
|
||||
Here are some examples when executing the script:
|
||||
```sh
|
||||
# The YAML Files are stored within the business line folder DE-3, in the same working directory as the script, and by the following command it is possible to generate the Terraform files and store them into the default output folder.
|
||||
|
|
@ -77,7 +90,9 @@ Here are some examples when executing the script:
|
|||
# Note here: If all yaml files of the shared_configuration repository need to be provided as an input argument it would also suffice to use the following command:
|
||||
.\generate.py ..\shared_configuration\ ..\coco_terraform_config\
|
||||
```
|
||||
### **Jenkins Pipeline**
|
||||
|
||||
<a name="jenkins-pipeline"></a>
|
||||
### 5.2 Jenkins Pipeline
|
||||
This is the link to the pipeline:
|
||||
[Pipeline CoCo SLO YAML 2 TF](https://jaws.bmwgroup.net/opapm/job/CoCo%20SLO%20YAML%202%20TF/). There are basically five main stages:
|
||||
- Fetch Repositories:
|
||||
|
|
@ -89,11 +104,10 @@ This is the link to the pipeline:
|
|||
- Execute Script: The script is executed and the YAML files with the corresponding business lines
|
||||
- Push Changes: Once the script finished with its exection the changes will be pushed with a commit that just includes a timestamp. The changes will be pushed to the newly created branch as mentioned above!
|
||||
|
||||
### **Data Structure of the YAML Files**
|
||||
<a name="data-structure-of-yaml-files"></a>
|
||||
### 5.3 Data Structure of YAML Files
|
||||
The majority of the key and value pairs have been taken respectively from the [shared_configuration](https://atc.bmwgroup.net/bitbucket/projects/OPAPM/repos/shared_configuration/) repository.
|
||||
|
||||
> ⚠️ **Please make sure that the YAML File does not include any tabs otherwise the correct functionality cannot be assured!**
|
||||
|
||||
```yaml
|
||||
slo_id: # <type:string> - Order of the given SLO within the dashboard
|
||||
slo_name: # <type:string> - Touchpoint Mobile or Vehicle
|
||||
|
|
@ -137,7 +151,8 @@ slo_definition:
|
|||
- # <type:string>
|
||||
```
|
||||
|
||||
#### **Supported Metrics**
|
||||
<a name="supported-metrics"></a>
|
||||
#### *5.3.1 Supported Metrics*
|
||||
Currently the following metrics are supported:
|
||||
```yaml
|
||||
builtin:service.keyRequest.errors.fivexx.rate
|
||||
|
|
@ -146,7 +161,8 @@ builtin:service.keyRequest.errors.fivexx.count
|
|||
builtin:service.errors.server.successCount
|
||||
builtin:service.errors.fivexx.successCount
|
||||
```
|
||||
### **Jinja Templates**
|
||||
<a name="jinja-templates"></a>
|
||||
### 5.4 Jinja Templates
|
||||
Currently there are only five Jinja Templates setup to cover mainly five different types of metrics as mentioned before. They can be found within the jinja-templates folder.
|
||||
```sh
|
||||
├───jinja-templates
|
||||
|
|
@ -162,7 +178,8 @@ Currently there are only five Jinja Templates setup to cover mainly five differe
|
|||
- terraform-template-4.j2 is used for builtin:service.errors.server.successCount
|
||||
- terraform-template-5.j2 is used for builtin:service.errors.fivexx.successCount
|
||||
|
||||
### **Terraform Output Folder Structure**
|
||||
<a name="terraform-output-folder-structure"></a>
|
||||
### 5.5 Terraform Output Folder Structure
|
||||
The output folder structure will look like the following example:
|
||||
```sh
|
||||
C:.s
|
||||
|
|
@ -212,4 +229,4 @@ C:.s
|
|||
TP_Vehicle_eRoute.tf
|
||||
TP_Vehicle_FTS.tf
|
||||
TP_Vehicle_RTTI.tf
|
||||
```
|
||||
```
|
||||
Loading…
Reference in New Issue