build all images

This commit is contained in:
Michael Jerger 2023-07-14 13:11:49 +02:00
parent cb48674864
commit 3c9a86f67c
7 changed files with 75 additions and 39 deletions

View file

@ -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: stages:
- lint&test - lint&test
- upload - upload
- image - 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: lint:
<<: *dev
stage: lint&test stage: lint&test
script: script:
- pip install -r dev_requirements.txt - pip install -r dev_requirements.txt
- pyb lint - pyb lint
pytest: pytest:
<<: *dev
stage: lint&test stage: lint&test
script: script:
- pip install -r dev_requirements.txt - pip install -r dev_requirements.txt
- pyb test - pyb test
pypi-stable: pypi-stable:
<<: *dev
<<: *tag_only
stage: upload stage: upload
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
script: script:
- pyb -P version=$CI_COMMIT_TAG publish upload - pyb -P version=$CI_COMMIT_TAG publish upload
clojure-image-test-publish: clojure-image-publish:
<<: *img
<<: *tag_only
stage: image stage: image
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
script: 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 stage: image
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
script: 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

View file

@ -1,14 +1,18 @@
from os import environ from os import environ
from datetime import datetime
from pybuilder.core import task, init from pybuilder.core import task, init
from ddadevops import * from ddadevops import *
name = "ddadevops" name = "ddadevops"
MODULE = "clojure" MODULE = "clojure"
PROJECT_ROOT_PATH = "../.." PROJECT_ROOT_PATH = "../.."
version = "4.0.0-dev73" version = "4.1.0-dev"
@init @init
def initialize(project): def initialize(project):
image_tag = version
if "dev" in image_tag:
image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
input = { input = {
"name": name, "name": name,
@ -17,6 +21,8 @@ def initialize(project):
"project_root_path": PROJECT_ROOT_PATH, "project_root_path": PROJECT_ROOT_PATH,
"build_types": ["IMAGE"], "build_types": ["IMAGE"],
"mixin_types": [], "mixin_types": [],
"image_naming": "NAME_AND_MODULE",
"image_tag": f"{image_tag}",
} }
project.build_depends_on("ddadevops>=4.0.0") project.build_depends_on("ddadevops>=4.0.0")

View file

@ -1,15 +1,19 @@
from os import environ from os import environ
from datetime import datetime
from pybuilder.core import task, init from pybuilder.core import task, init
from ddadevops import * from ddadevops import *
name = "ddadevops" name = "ddadevops"
MODULE = "" MODULE = "ddadevops"
PROJECT_ROOT_PATH = "../.." PROJECT_ROOT_PATH = "../.."
version = "4.0.0-dev73" version = "4.1.0-dev"
@init @init
def initialize(project): def initialize(project):
image_tag = version
if "dev" in image_tag:
image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
input = { input = {
"name": name, "name": name,
@ -18,10 +22,12 @@ def initialize(project):
"project_root_path": PROJECT_ROOT_PATH, "project_root_path": PROJECT_ROOT_PATH,
"build_types": ["IMAGE"], "build_types": ["IMAGE"],
"mixin_types": [], "mixin_types": [],
"image_naming": "NAME_ONLY",
"image_tag": f"{image_tag}",
} }
project.build_depends_on("ddadevops>=4.0.0") project.build_depends_on("ddadevops>=4.0.0")
build = DevopsImageBuild(project, input) build = DevopsImageBuild(project, input)
build.initialize_build_dir() build.initialize_build_dir()

View file

View file

@ -1,15 +1,19 @@
from os import environ from os import environ
from datetime import datetime
from pybuilder.core import task, init from pybuilder.core import task, init
from ddadevops import * from ddadevops import *
name = "ddadevops" name = "ddadevops"
MODULE = "dind" MODULE = "dind"
PROJECT_ROOT_PATH = "../.." PROJECT_ROOT_PATH = "../.."
version = "4.0.0-dev73" version = "4.1.0-dev"
@init @init
def initialize(project): def initialize(project):
image_tag = version
if "dev" in image_tag:
image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
input = { input = {
"name": name, "name": name,
@ -18,10 +22,12 @@ def initialize(project):
"project_root_path": PROJECT_ROOT_PATH, "project_root_path": PROJECT_ROOT_PATH,
"build_types": ["IMAGE"], "build_types": ["IMAGE"],
"mixin_types": [], "mixin_types": [],
"image_naming": "NAME_AND_MODULE",
"image_tag": f"{image_tag}",
} }
project.build_depends_on("ddadevops>=4.0.0") project.build_depends_on("ddadevops>=4.0.0")
build = DevopsImageBuild(project, input) build = DevopsImageBuild(project, input)
build.initialize_build_dir() build.initialize_build_dir()

View file

View file

@ -6,11 +6,11 @@ from ddadevops import *
name = "ddadevops" name = "ddadevops"
MODULE = "python" MODULE = "python"
PROJECT_ROOT_PATH = "../.." PROJECT_ROOT_PATH = "../.."
version = "4.0.15-dev" version = "4.1.0-dev"
@init @init
def initialize(project): def initialize(project):
image_tag = version image_tag = version
if "dev" in image_tag: if "dev" in image_tag:
image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
@ -22,12 +22,12 @@ def initialize(project):
"project_root_path": PROJECT_ROOT_PATH, "project_root_path": PROJECT_ROOT_PATH,
"build_types": ["IMAGE"], "build_types": ["IMAGE"],
"mixin_types": [], "mixin_types": [],
'image_naming': "NAME_AND_MODULE", "image_naming": "NAME_AND_MODULE",
"image_tag": f"{image_tag}", "image_tag": f"{image_tag}",
} }
project.build_depends_on("ddadevops>=4.0.0") project.build_depends_on("ddadevops>=4.0.0")
build = DevopsImageBuild(project, input) build = DevopsImageBuild(project, input)
build.initialize_build_dir() build.initialize_build_dir()