dda-devops-build/infrastructure/clojure/build.py
2023-05-19 12:17:48 +02:00

67 lines
1.5 KiB
Python

from os import environ
from pybuilder.core import task, init
from ddadevops import *
name = "clojure"
MODULE = "docker"
PROJECT_ROOT_PATH = "../.."
@init
def initialize(project):
tag = environ.get("CI_COMMIT_TAG")
if not tag:
tag = get_tag_from_latest_commit()
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"
},
],
}
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()
@task
def drun(project):
build = get_devops_build(project)
build.drun()
@task
def test(project):
build = get_devops_build(project)
build.test()
@task
def publish(project):
build = get_devops_build(project)
build.dockerhub_login()
build.dockerhub_publish()