diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fc18d57..b6b18ee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,56 +1,74 @@ -image: "domaindrivenarchitecture/devops-build:4.0.8" - -services: - - docker:dind - -before_script: - - python --version - - python -m pip install --upgrade pip - - pip install -r requirements.txt - - export IMAGE_TAG=$CI_COMMIT_TAG - - export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER - - export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD - stages: - lint&test - upload - image +.py: &py + image: "domaindrivenarchitecture/ddadevops-python:latest" + before_script: + - python --version + - pip install -r requirements.txt + +.img: &img + image: "domaindrivenarchitecture/ddadevops-dind:latest" + services: + - docker:dind + before_script: + - export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER + - export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD + - export IMAGE_TAG=$CI_COMMIT_TAG + +.tag_only: &tag_only + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: never + - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' + lint: + <<: *dev stage: lint&test script: - pip install -r dev_requirements.txt - pyb lint pytest: + <<: *dev stage: lint&test script: - pip install -r dev_requirements.txt - pyb test pypi-stable: + <<: *dev + <<: *tag_only stage: upload - rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: never - - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' script: - pyb -P version=$CI_COMMIT_TAG publish upload -clojure-image-test-publish: +clojure-image-publish: + <<: *img + <<: *tag_only stage: image - rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: never - - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' script: - - cd infrastructure/clojure && pyb image test publish + - cd infrastructure/clojure && pyb image publish -devops-build-image-test-publish: +python-image-publish: + <<: *img + <<: *tag_only stage: image - rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: never - - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' script: - - cd infrastructure/devops-build && pyb image test publish + - cd infrastructure/python && pyb image publish + +dind-image-publish: + <<: *img + <<: *tag_only + stage: image + script: + - cd infrastructure/dind && pyb image publish + +ddadevops-image-publish: + <<: *img + <<: *tag_only + stage: image + script: + - cd infrastructure/ddadevops && pyb image publish diff --git a/infrastructure/clojure/build.py b/infrastructure/clojure/build.py index 832e4e5..9966020 100644 --- a/infrastructure/clojure/build.py +++ b/infrastructure/clojure/build.py @@ -1,14 +1,18 @@ from os import environ +from datetime import datetime from pybuilder.core import task, init from ddadevops import * name = "ddadevops" MODULE = "clojure" PROJECT_ROOT_PATH = "../.." -version = "4.0.0-dev73" +version = "4.1.0-dev" @init def initialize(project): + image_tag = version + if "dev" in image_tag: + image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") input = { "name": name, @@ -17,6 +21,8 @@ def initialize(project): "project_root_path": PROJECT_ROOT_PATH, "build_types": ["IMAGE"], "mixin_types": [], + "image_naming": "NAME_AND_MODULE", + "image_tag": f"{image_tag}", } project.build_depends_on("ddadevops>=4.0.0") diff --git a/infrastructure/ddadevops/build.py b/infrastructure/ddadevops/build.py index 40ebb7c..bbf6f10 100644 --- a/infrastructure/ddadevops/build.py +++ b/infrastructure/ddadevops/build.py @@ -1,15 +1,19 @@ from os import environ +from datetime import datetime from pybuilder.core import task, init from ddadevops import * name = "ddadevops" -MODULE = "" +MODULE = "ddadevops" PROJECT_ROOT_PATH = "../.." -version = "4.0.0-dev73" +version = "4.1.0-dev" @init def initialize(project): + image_tag = version + if "dev" in image_tag: + image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") input = { "name": name, @@ -18,10 +22,12 @@ def initialize(project): "project_root_path": PROJECT_ROOT_PATH, "build_types": ["IMAGE"], "mixin_types": [], + "image_naming": "NAME_ONLY", + "image_tag": f"{image_tag}", } project.build_depends_on("ddadevops>=4.0.0") - + build = DevopsImageBuild(project, input) build.initialize_build_dir() diff --git a/infrastructure/ddadevops/test/dummy b/infrastructure/ddadevops/test/dummy new file mode 100644 index 0000000..e69de29 diff --git a/infrastructure/dind/build.py b/infrastructure/dind/build.py index 6173240..38093a1 100644 --- a/infrastructure/dind/build.py +++ b/infrastructure/dind/build.py @@ -1,15 +1,19 @@ from os import environ +from datetime import datetime from pybuilder.core import task, init from ddadevops import * name = "ddadevops" MODULE = "dind" PROJECT_ROOT_PATH = "../.." -version = "4.0.0-dev73" +version = "4.1.0-dev" @init def initialize(project): + image_tag = version + if "dev" in image_tag: + image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") input = { "name": name, @@ -18,10 +22,12 @@ def initialize(project): "project_root_path": PROJECT_ROOT_PATH, "build_types": ["IMAGE"], "mixin_types": [], + "image_naming": "NAME_AND_MODULE", + "image_tag": f"{image_tag}", } project.build_depends_on("ddadevops>=4.0.0") - + build = DevopsImageBuild(project, input) build.initialize_build_dir() diff --git a/infrastructure/dind/test/dummy b/infrastructure/dind/test/dummy new file mode 100644 index 0000000..e69de29 diff --git a/infrastructure/python/build.py b/infrastructure/python/build.py index 23e3b03..89c7ee3 100644 --- a/infrastructure/python/build.py +++ b/infrastructure/python/build.py @@ -6,11 +6,11 @@ from ddadevops import * name = "ddadevops" MODULE = "python" PROJECT_ROOT_PATH = "../.." -version = "4.0.15-dev" +version = "4.1.0-dev" + @init def initialize(project): - image_tag = version if "dev" in image_tag: image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") @@ -22,12 +22,12 @@ def initialize(project): "project_root_path": PROJECT_ROOT_PATH, "build_types": ["IMAGE"], "mixin_types": [], - 'image_naming': "NAME_AND_MODULE", + "image_naming": "NAME_AND_MODULE", "image_tag": f"{image_tag}", } project.build_depends_on("ddadevops>=4.0.0") - + build = DevopsImageBuild(project, input) build.initialize_build_dir()