dda-devops-build/doc/DevopsBuild.md

68 lines
2.2 KiB
Markdown
Raw Normal View History

2023-06-01 07:28:43 +00:00
# DevopsBuild
2023-06-13 06:50:26 +00:00
DevopsBuild provides the build foundations.
2023-06-01 07:28:43 +00:00
```mermaid
classDiagram
class DevopsBuild {
build_path() - the build dir in target
initialize_build_dir() - copy current directory & additional files to target
2023-06-30 11:03:05 +00:00
name() - the name of build
2023-06-01 07:28:43 +00:00
}
```
## Input
| name | description | default |
| ----------------- | -------------------------------------------------------------------------------------------------- | ------- |
| name | dedicated name of the build | module |
| module | module name - may result in a hierarchy like name/module | |
| stage | sth. like test, int, acc or prod | |
| project_root_path | relative path to projects root. Is used to locate the target dir | |
| build_dir_name | name of dir, build is executed in | target |
| build_types | list of special builds used. Valid values are ["IMAGE", "C4K", "K3S", "TERRAFORM"] | [] |
| mixin_types | mixins are orthoganl to builds and represent additional capabilities. Valid Values are ["RELEASE"] | [] |
## Example Usage
2023-09-29 07:52:37 +00:00
2023-06-02 15:21:37 +00:00
### build.py
2023-06-01 07:28:43 +00:00
```python
from subprocess import run
from pybuilder.core import task, init
from ddadevops import *
name = 'my-project'
MODULE = 'my-module'
PROJECT_ROOT_PATH = '..'
@init
def initialize(project):
project.build_depends_on("ddadevops>=4.0.0")
config = {
"name": name,
"module": MODULE,
"stage": environ["STAGE"],
"project_root_path": PROJECT_ROOT_PATH,
"build_types": [],
"mixin_types": [],
}
2023-06-12 16:41:44 +00:00
build = DevopsBuild(project, config)
2023-06-01 07:28:43 +00:00
build.initialize_build_dir()
@task
def list_build_dir(project):
build = get_devops_build(project)
run(f"ls -la {build.build_path()}")
2023-06-02 15:21:37 +00:00
```
### call the build
```bash
pyb list_build_dir
```