terraformDummyRepo/build.py

48 lines
1.1 KiB
Python
Raw Normal View History

import sys
import os
from pathlib import Path
from ddadevops import *
# getting the name of the directory
# where the this file is present.
current = os.path.dirname(os.path.realpath(__file__))
# adding the current directory to
# the sys.path.
sys.path.append(current)
# now we can import the module in the current
# directory.
2023-02-08 09:33:39 +00:00
from pybuilder.core import task, init
from ddadevops import *
from release_mixin import ReleaseMixin, create_release_mixin_config
2023-02-08 09:57:40 +00:00
CONFIG_FILE = Path('config.json')
2023-02-22 13:10:19 +00:00
MAIN_BRANCH = 'main'
STAGE = 'test'
PROJECT_ROOT_PATH = '.'
MODULE = 'test'
BUILD_DIR_NAME = "build_dir"
2023-02-16 14:59:38 +00:00
class MyBuild(ReleaseMixin):
pass
2023-02-08 09:57:40 +00:00
2023-02-08 09:33:39 +00:00
@init
def initialize(project):
2023-02-08 09:57:40 +00:00
project.build_depends_on('ddadevops>=3.1.2')
2023-02-22 13:10:19 +00:00
config = create_release_mixin_config(CONFIG_FILE, MAIN_BRANCH)
config.update({'stage': STAGE,
'module': MODULE,
'project_root_path': PROJECT_ROOT_PATH,
'build_dir_name': BUILD_DIR_NAME})
2023-02-22 13:10:19 +00:00
build = MyBuild(project, config)
build.initialize_build_dir()
2023-02-08 09:33:39 +00:00
2023-02-22 13:10:19 +00:00
@task
def release(project):
build = get_devops_build(project)
2023-02-16 14:59:38 +00:00
build.prepare_release()
build.tag_and_push_release()