Skip to content

Commit 9a3f895

Browse files
committed
[DOP-25355] Populate docker image meta
1 parent 3f0829d commit 9a3f895

File tree

6 files changed

+95
-31
lines changed

6 files changed

+95
-31
lines changed

.github/workflows/scheduler_docker_image.yml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
1313
cancel-in-progress: true
1414

15+
env:
16+
DEFAULT_PYTHON: '3.13'
17+
1518
jobs:
1619
release:
1720
name: Build & push scheduler image to Dockerhub
@@ -34,14 +37,31 @@ jobs:
3437
- name: Checkout code
3538
uses: actions/checkout@v4
3639

37-
- name: Set tag
38-
id: set_tag
40+
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: ${{ env.DEFAULT_PYTHON }}
44+
45+
- name: Install poetry
46+
uses: snok/install-poetry@v1
47+
48+
- name: Get version
49+
id: get_version
3950
run: |
40-
if [[ "${{ github.ref_type }}" == "branch" && "${{ github.ref_name }}" == "develop" ]]; then
41-
echo "TAG=mtsrus/syncmaster-scheduler:develop" >> $GITHUB_ENV
42-
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
43-
echo "TAG=mtsrus/syncmaster-scheduler:latest,mtsrus/syncmaster-scheduler:${{ github.ref_name }}" >> $GITHUB_ENV
44-
fi
51+
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
52+
53+
- name: Docker meta
54+
id: meta
55+
uses: docker/metadata-action@v5
56+
with:
57+
images: mtsrus/syncmaster-scheduler
58+
labels: |
59+
org.opencontainers.image.title=SyncMaster Scheduler
60+
org.opencontainers.image.vendor=MTS PJSC
61+
org.opencontainers.image.documentation=https://syncmaster.readthedocs.io
62+
org.opencontainers.image.url=https://hub.docker.com/r/mtsrus/syncmaster-worker
63+
org.opencontainers.image.authors=DataOps.ETL <[email protected]>
64+
org.opencontainers.image.version=${{ env.VERSION }}
4565
4666
- name: Set platforms
4767
id: set_platforms
@@ -56,10 +76,11 @@ jobs:
5676
- name: Build scheduler image
5777
uses: docker/build-push-action@v6
5878
with:
59-
tags: ${{ env.TAG }}
6079
context: .
6180
target: prod
6281
file: docker/Dockerfile.scheduler
82+
tags: ${{ steps.meta.outputs.tags }}
83+
labels: ${{ steps.meta.outputs.labels }}
6384
pull: true
6485
push: true
6586
cache-to: type=inline
@@ -85,5 +106,5 @@ jobs:
85106
# this requires token with read+write+delete permissions. read+write is not enough!
86107
password: ${{ secrets.DOCKERHUB_TOKEN }}
87108
repository: mtsrus/syncmaster-scheduler
88-
short-description: ${{ github.event.repository.description }}
109+
short-description: ${{ github.event.repository.description }} (Scheduler)
89110
enable-url-completion: true

.github/workflows/server_docker_image.yml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
1313
cancel-in-progress: true
1414

15+
env:
16+
DEFAULT_PYTHON: '3.13'
17+
1518
jobs:
1619
release:
1720
name: Build & push server image to Dockerhub
@@ -34,14 +37,31 @@ jobs:
3437
- name: Checkout code
3538
uses: actions/checkout@v4
3639

37-
- name: Set tag
38-
id: set_tag
40+
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: ${{ env.DEFAULT_PYTHON }}
44+
45+
- name: Install poetry
46+
uses: snok/install-poetry@v1
47+
48+
- name: Get version
49+
id: get_version
3950
run: |
40-
if [[ "${{ github.ref_type }}" == "branch" && "${{ github.ref_name }}" == "develop" ]]; then
41-
echo "TAG=mtsrus/syncmaster-server:develop" >> $GITHUB_ENV
42-
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
43-
echo "TAG=mtsrus/syncmaster-server:latest,mtsrus/syncmaster-server:${{ github.ref_name }}" >> $GITHUB_ENV
44-
fi
51+
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
52+
53+
- name: Docker meta
54+
id: meta
55+
uses: docker/metadata-action@v5
56+
with:
57+
images: mtsrus/syncmaster-server
58+
labels: |
59+
org.opencontainers.image.title=SyncMaster Server
60+
org.opencontainers.image.vendor=MTS PJSC
61+
org.opencontainers.image.documentation=https://syncmaster.readthedocs.io
62+
org.opencontainers.image.url=https://hub.docker.com/r/mtsrus/syncmaster-server
63+
org.opencontainers.image.authors=DataOps.ETL <[email protected]>
64+
org.opencontainers.image.version=${{ env.VERSION }}
4565
4666
- name: Set platforms
4767
id: set_platforms
@@ -56,10 +76,11 @@ jobs:
5676
- name: Build Server image
5777
uses: docker/build-push-action@v6
5878
with:
59-
tags: ${{ env.TAG }}
6079
context: .
6180
target: prod
6281
file: docker/Dockerfile.server
82+
tags: ${{ steps.meta.outputs.tags }}
83+
labels: ${{ steps.meta.outputs.labels }}
6384
pull: true
6485
push: true
6586
cache-to: type=inline
@@ -85,5 +106,5 @@ jobs:
85106
# this requires token with read+write+delete permissions. read+write is not enough!
86107
password: ${{ secrets.DOCKERHUB_TOKEN }}
87108
repository: mtsrus/syncmaster-server
88-
short-description: ${{ github.event.repository.description }}
109+
short-description: ${{ github.event.repository.description }} (Server)
89110
enable-url-completion: true

.github/workflows/worker_docker_image.yml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
1313
cancel-in-progress: true
1414

15+
env:
16+
DEFAULT_PYTHON: '3.13'
17+
1518
jobs:
1619
release:
1720
name: Build & push worker image to Dockerhub
@@ -34,14 +37,31 @@ jobs:
3437
- name: Checkout code
3538
uses: actions/checkout@v4
3639

37-
- name: Set tag
38-
id: set_tag
40+
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: ${{ env.DEFAULT_PYTHON }}
44+
45+
- name: Install poetry
46+
uses: snok/install-poetry@v1
47+
48+
- name: Get version
49+
id: get_version
3950
run: |
40-
if [[ "${{ github.ref_type }}" == "branch" && "${{ github.ref_name }}" == "develop" ]]; then
41-
echo "TAG=mtsrus/syncmaster-worker:develop" >> $GITHUB_ENV
42-
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
43-
echo "TAG=mtsrus/syncmaster-worker:latest,mtsrus/syncmaster-worker:${{ github.ref_name }}" >> $GITHUB_ENV
44-
fi
51+
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
52+
53+
- name: Docker meta
54+
id: meta
55+
uses: docker/metadata-action@v5
56+
with:
57+
images: mtsrus/syncmaster-worker
58+
labels: |
59+
org.opencontainers.image.title=SyncMaster Worker
60+
org.opencontainers.image.vendor=MTS PJSC
61+
org.opencontainers.image.documentation=https://syncmaster.readthedocs.io
62+
org.opencontainers.image.url=https://hub.docker.com/r/mtsrus/syncmaster-worker
63+
org.opencontainers.image.authors=DataOps.ETL <[email protected]>
64+
org.opencontainers.image.version=${{ env.VERSION }}
4565
4666
- name: Set platforms
4767
id: set_platforms
@@ -56,10 +76,11 @@ jobs:
5676
- name: Build worker image
5777
uses: docker/build-push-action@v6
5878
with:
59-
tags: ${{ env.TAG }}
6079
context: .
6180
target: prod
6281
file: docker/Dockerfile.worker
82+
tags: ${{ steps.meta.outputs.tags }}
83+
labels: ${{ steps.meta.outputs.labels }}
6384
pull: true
6485
push: true
6586
cache-to: type=inline
@@ -85,5 +106,5 @@ jobs:
85106
# this requires token with read+write+delete permissions. read+write is not enough!
86107
password: ${{ secrets.DOCKERHUB_TOKEN }}
87108
repository: mtsrus/syncmaster-worker
88-
short-description: ${{ github.event.repository.description }}
109+
short-description: ${{ github.event.repository.description }} (Worker)
89110
enable-url-completion: true

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
# The short X.Y version.
3737

3838
# this value is updated automatically by `poetry version ...` and poetry-bumpversion plugin
39-
ver = Version.parse("0.1.6")
39+
ver = Version.parse("0.2.0")
4040
version = ver.base_version
4141
# The full version, including alpha/beta/rc tags.
4242
release = ver.public

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "data-syncmaster"
7-
version = "0.1.6"
7+
version = "0.2.0"
88
license = "Apache-2.0"
99
description = "Syncmaster REST API + Worker"
1010
authors = ["DataOps.ETL <[email protected]>"]
@@ -451,7 +451,8 @@ ignore = [
451451
per-file-ignores = [
452452
# F401 imported but unused
453453
# WPS410 Found wrong metadata variable: __all__
454-
"__init__.py:F401,WPS410",
454+
# WPS412 Found `__init__.py` module with logic
455+
"__init__.py:F401,WPS410,WPS412",
455456
# WPS102 Found incorrect module name pattern
456457
# WPS432 Found magic number: 256
457458
"*migrations/*.py:WPS102,WPS432",

syncmaster/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-FileCopyrightText: 2023-2024 MTS PJSC
22
# SPDX-License-Identifier: Apache-2.0
33

4-
_raw_version = "0.1.6"
4+
_raw_version = "0.2.0"
55
# version always contain only release number like 0.0.1
66
__version__ = ".".join(_raw_version.split(".")[:3]) # noqa: WPS410

0 commit comments

Comments
 (0)