You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dda-devops-build/doc/DevopsBuild.md

68 lines
2.2 KiB
Markdown

12 months ago
# DevopsBuild
11 months ago
DevopsBuild provides the build foundations.
12 months ago
```mermaid
classDiagram
class DevopsBuild {
build_path() - the build dir in target
initialize_build_dir() - copy current directory & additional files to target
name() - the name of build
12 months ago
}
```
## 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
8 months ago
### build.py
12 months ago
```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": [],
}
11 months ago
build = DevopsBuild(project, config)
12 months ago
build.initialize_build_dir()
@task
def list_build_dir(project):
build = get_devops_build(project)
run(f"ls -la {build.build_path()}")
```
### call the build
```bash
pyb list_build_dir
```