dda-devops-build/infrastructure/clojure/build.py

68 lines
1.5 KiB
Python
Raw Normal View History

from os import environ
from pybuilder.core import task, init
from ddadevops import *
2023-03-17 15:05:39 +00:00
name = "clojure"
MODULE = "docker"
PROJECT_ROOT_PATH = "../.."
@init
def initialize(project):
2023-03-17 15:05:39 +00:00
tag = environ.get("CI_COMMIT_TAG")
2022-05-20 08:01:53 +00:00
if not tag:
tag = get_tag_from_latest_commit()
2023-05-19 10:17:48 +00:00
input = {
"name": name,
"module": MODULE,
"stage": "notused",
"project_root_path": PROJECT_ROOT_PATH,
"build_types": ["IMAGE"],
"mixin_types": [],
"image_dockerhub_user": "dockerhub_user",
"image_dockerhub_password": "dockerhub_password",
"image_tag": tag,
"credentials_mappings": [
{
"gopass_path": "meissa/web/docker.com",
"gopass_field": "login",
"name": "image_dockerhub_user"
},
{
"gopass_path": "meissa/web/docker.com",
"name": "image_dockerhub_password"
},
],
}
2023-03-17 15:05:39 +00:00
2023-05-19 10:17:48 +00:00
project.build_depends_on("ddadevops>=4.0.0-dev")
build = DevopsImageBuild(project, input)
build.initialize_build_dir()
@task
def image(project):
build = get_devops_build(project)
build.image()
2023-03-17 15:05:39 +00:00
@task
def drun(project):
build = get_devops_build(project)
build.drun()
2023-03-17 15:05:39 +00:00
@task
def test(project):
build = get_devops_build(project)
build.test()
2023-03-17 15:05:39 +00:00
@task
def publish(project):
build = get_devops_build(project)
build.dockerhub_login()
build.dockerhub_publish()