Skip to content

Commit

Permalink
Merge pull request #198 from ds-wizard/release/4.6.0
Browse files Browse the repository at this point in the history
Release 4.6.0
  • Loading branch information
MarekSuchanek authored May 7, 2024
2 parents 42c7d6b + 9c517e3 commit d757fc2
Show file tree
Hide file tree
Showing 50 changed files with 477 additions and 173 deletions.
124 changes: 123 additions & 1 deletion .github/workflows/lambda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
package:
name: Lambda Package
name: Lambda ZIP Package
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -46,3 +46,125 @@ jobs:
with:
name: ${{ matrix.package }}-lambda.zip
path: packages/dsw-${{ matrix.package }}/${{ matrix.package }}-lambda.zip

docker:
name: Lambda Docker Image
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
package:
- dsw-document-worker

env:
PUBLIC_IMAGE_PREFIX: 'datastewardshipwizard'
DOCKER_META_CONTEXT: '.'
DOCKER_META_FILE: './packages/${{ matrix.package }}/lambda.Dockerfile'
DOCKER_META_PLATFORMS: 'linux/amd64'
DOCKER_META_SUFFIX_LAMBDA: '-lambda'

steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Get Docker image name
id: docker-image-name
run: |
cd packages/${{ matrix.package }}
NAME=$(make docker-image-name)
echo "NAME=$NAME" >> $GITHUB_OUTPUT
- name: Create build info
run: |
bash scripts/build-info.sh
# TEST DOCKER IMAGE BUILD
- name: Docker meta [test]
id: meta-test
uses: docker/metadata-action@v5
with:
images: |
${{ env.PUBLIC_IMAGE_PREFIX }}/${{ steps.docker-image-name.outputs.NAME }}
tags: |
type=sha
flavor: |
suffix=${{ env.DOCKER_META_SUFFIX_LAMBDA }}
- name: Docker build [test]
uses: docker/build-push-action@v5
with:
context: ${{ env.DOCKER_META_CONTEXT }}
file: ${{ env.DOCKER_META_FILE }}
platforms: ${{ env.DOCKER_META_PLATFORMS }}
push: false
tags: ${{ steps.meta-test.outputs.tags }}
labels: ${{ steps.meta-test.outputs.labels }}

# PREPARE
- name: Docker login [docker.io]
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}

# DEVELOPMENT IMAGES
- name: Docker meta [dev]
id: meta-dev
if: github.event_name != 'pull_request'
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_USERNAME }}/${{ steps.docker-image-name.outputs.NAME }}
tags: |
type=ref,event=branch
flavor: |
suffix=${{ env.DOCKER_META_SUFFIX_LAMBDA }}
- name: Docker build+push [dev]
uses: docker/build-push-action@v5
if: github.event_name != 'pull_request' && steps.meta-dev.outputs.tags != ''
with:
context: ${{ env.DOCKER_META_CONTEXT }}
file: ${{ env.DOCKER_META_FILE }}
platforms: ${{ env.DOCKER_META_PLATFORMS }}
push: true
tags: ${{ steps.meta-dev.outputs.tags }}
labels: ${{ steps.meta-dev.outputs.labels }}

# PUBLIC IMAGES
- name: Docker meta [public]
id: meta-public
if: github.event_name != 'pull_request'
uses: docker/metadata-action@v5
with:
images: |
${{ env.PUBLIC_IMAGE_PREFIX }}/${{ steps.docker-image-name.outputs.NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
flavor: |
suffix=${{ env.DOCKER_META_SUFFIX_LAMBDA }}
- name: Docker build+push [public]
uses: docker/build-push-action@v5
if: github.event_name != 'pull_request' && steps.meta-public.outputs.tags != ''
with:
context: ${{ env.DOCKER_META_CONTEXT }}
file: ${{ env.DOCKER_META_FILE }}
platforms: ${{ env.DOCKER_META_PLATFORMS }}
push: true
tags: ${{ steps.meta-public.outputs.tags }}
labels: ${{ steps.meta-public.outputs.labels }}
7 changes: 7 additions & 0 deletions packages/dsw-command-queue/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]


## [4.6.0]

### Fixed

- Fixed the issue with timezone while retrieving commands

## [4.5.0]

Released for version consistency with other DSW tools.
Expand Down Expand Up @@ -199,3 +205,4 @@ Released for version consistency with other DSW tools.
[4.4.0]: /../../tree/v4.4.0
[4.4.1]: /../../tree/v4.4.1
[4.5.0]: /../../tree/v4.5.0
[4.6.0]: /../../tree/v4.6.0
6 changes: 3 additions & 3 deletions packages/dsw-command-queue/dsw/command_queue/command_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def fetch_and_process(self) -> bool:
cursor = self.db.conn_query.new_cursor(use_dict=True)
cursor.execute(
query=self.queries.query_get_command(),
params={'now': datetime.datetime.utcnow()},
params={'now': datetime.datetime.now(tz=datetime.UTC)},
)
result = cursor.fetchall()
if len(result) != 1:
Expand All @@ -148,7 +148,7 @@ def fetch_and_process(self) -> bool:
self.db.execute_query(
query=self.queries.query_command_done(),
attempts=command.attempts + 1,
updated_at=datetime.datetime.utcnow(),
updated_at=datetime.datetime.now(tz=datetime.UTC),
uuid=command.uuid,
)
except Exception as e:
Expand All @@ -159,7 +159,7 @@ def fetch_and_process(self) -> bool:
query=self.queries.query_command_error(),
attempts=command.attempts + 1,
error_message=msg,
updated_at=datetime.datetime.utcnow(),
updated_at=datetime.datetime.now(tz=datetime.UTC),
uuid=command.uuid,
)

Expand Down
2 changes: 1 addition & 1 deletion packages/dsw-command-queue/dsw/command_queue/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def query_get_command(self, exp=2, interval='1 min') -> str:
AND attempts < max_attempts
AND state != '{CommandState.DONE}'
AND state != '{CommandState.IGNORE}'
AND updated_at < (%(now)s - ({exp} ^ attempts - 1) * INTERVAL '{interval}')
AND (updated_at AT TIME ZONE 'UTC') < (%(now)s - ({exp} ^ attempts - 1) * INTERVAL '{interval}')
ORDER BY attempts ASC, updated_at DESC
LIMIT 1 FOR UPDATE SKIP LOCKED;
"""
Expand Down
4 changes: 2 additions & 2 deletions packages/dsw-command-queue/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'

[project]
name = 'dsw-command-queue'
version = "4.5.0"
version = "4.6.0"
description = 'Library for working with command queue and persistent commands'
readme = 'README.md'
keywords = ['dsw', 'subscriber', 'publisher', 'database', 'queue', 'processing']
Expand All @@ -25,7 +25,7 @@ classifiers = [
requires-python = '>=3.10, <4'
dependencies = [
# DSW
"dsw-database==4.5.0",
"dsw-database==4.6.0",
]

[project.urls]
Expand Down
8 changes: 4 additions & 4 deletions packages/dsw-command-queue/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
psycopg==3.1.17
psycopg-binary==3.1.17
psycopg==3.1.18
psycopg-binary==3.1.18
PyYAML==6.0.1
tenacity==8.2.3
typing_extensions==4.9.0
tzdata==2023.4
typing_extensions==4.11.0
tzdata==2024.1
5 changes: 5 additions & 0 deletions packages/dsw-config/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]


## [4.6.0]

Released for version consistency with other DSW tools.

## [4.5.0]

Released for version consistency with other DSW tools.
Expand Down Expand Up @@ -207,3 +211,4 @@ Released for version consistency with other DSW tools.
[4.4.0]: /../../tree/v4.4.0
[4.4.1]: /../../tree/v4.4.1
[4.5.0]: /../../tree/v4.5.0
[4.6.0]: /../../tree/v4.6.0
2 changes: 1 addition & 1 deletion packages/dsw-config/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'

[project]
name = 'dsw-config'
version = "4.5.0"
version = "4.6.0"
description = 'Library for DSW config manipulation'
readme = 'README.md'
keywords = ['dsw', 'config', 'yaml', 'parser']
Expand Down
6 changes: 3 additions & 3 deletions packages/dsw-config/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
certifi==2023.11.17
certifi==2024.2.2
PyYAML==6.0.1
sentry-sdk==1.39.2
urllib3==2.1.0
sentry-sdk==1.45.0
urllib3==2.2.1
5 changes: 5 additions & 0 deletions packages/dsw-data-seeder/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]


## [4.6.0]

Released for version consistency with other DSW tools.

## [4.5.0]

Released for version consistency with other DSW tools.
Expand Down Expand Up @@ -257,3 +261,4 @@ Released for version consistency with other DSW tools.
[4.4.0]: /../../tree/v4.4.0
[4.4.1]: /../../tree/v4.4.1
[4.5.0]: /../../tree/v4.5.0
[4.6.0]: /../../tree/v4.6.0
4 changes: 2 additions & 2 deletions packages/dsw-data-seeder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM datastewardshipwizard/python-base:4.4.0-3.11-basic as builder
FROM datastewardshipwizard/python-base:4.6.0-3.11-basic as builder

WORKDIR /app

Expand All @@ -15,7 +15,7 @@ RUN python -m pip wheel --no-cache-dir --wheel-dir=/app/wheels -r /app/packages/
&& python -m pip wheel --no-cache-dir --no-deps --wheel-dir=/app/wheels /app/packages/dsw-data-seeder


FROM datastewardshipwizard/python-base:4.4.0-3.11-basic
FROM datastewardshipwizard/python-base:4.6.0-3.11-basic

ENV APPLICATION_CONFIG_PATH /app/config/application.yml
ENV WORKDIR_PATH /home/user/data
Expand Down
2 changes: 1 addition & 1 deletion packages/dsw-data-seeder/dsw/data_seeder/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
DEFAULT_PLACEHOLDER = '<<|TENANT-ID|>>'
NULL_UUID = '00000000-0000-0000-0000-000000000000'
PROG_NAME = 'dsw-data-seeder'
VERSION = '4.5.0'
VERSION = '4.6.0'

VAR_APP_CONFIG_PATH = 'APPLICATION_CONFIG_PATH'
VAR_WORKDIR_PATH = 'WORKDIR_PATH'
Expand Down
10 changes: 5 additions & 5 deletions packages/dsw-data-seeder/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'

[project]
name = 'dsw-data-seeder'
version = "4.5.0"
version = "4.6.0"
description = 'Worker for seeding DSW data'
readme = 'README.md'
keywords = ['data', 'database', 'seed', 'storage']
Expand All @@ -29,10 +29,10 @@ dependencies = [
'sentry-sdk',
'tenacity',
# DSW
"dsw-command-queue==4.5.0",
"dsw-config==4.5.0",
"dsw-database==4.5.0",
"dsw-storage==4.5.0",
"dsw-command-queue==4.6.0",
"dsw-config==4.6.0",
"dsw-database==4.6.0",
"dsw-storage==4.6.0",
]

[project.urls]
Expand Down
16 changes: 8 additions & 8 deletions packages/dsw-data-seeder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
certifi==2023.11.17
certifi==2024.2.2
click==8.1.7
minio==7.2.3
psycopg==3.1.17
psycopg-binary==3.1.17
python-dateutil==2.8.2
minio==7.2.7
psycopg==3.1.18
psycopg-binary==3.1.18
python-dateutil==2.9.0
PyYAML==6.0.1
sentry-sdk==1.39.2
sentry-sdk==1.45.0
six==1.16.0
tenacity==8.2.3
typing_extensions==4.9.0
urllib3==2.1.0
typing_extensions==4.11.0
urllib3==2.2.1
7 changes: 7 additions & 0 deletions packages/dsw-database/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]


## [4.6.0]

### Fixed

- Use UTC timezone consistently

## [4.5.0]

Released for version consistency with other DSW tools.
Expand Down Expand Up @@ -216,3 +222,4 @@ Released for version consistency with other DSW tools.
[4.4.0]: /../../tree/v4.4.0
[4.4.1]: /../../tree/v4.4.1
[4.5.0]: /../../tree/v4.5.0
[4.6.0]: /../../tree/v4.6.0
2 changes: 1 addition & 1 deletion packages/dsw-database/dsw/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def update_component_info(self, name: str, version: str, built_at: datetime.date
with self.conn_query.new_cursor(use_dict=True) as cursor:
if not self._check_table_exists(table_name='component'):
return None
ts_now = datetime.datetime.utcnow()
ts_now = datetime.datetime.now(tz=datetime.UTC)
try:
cursor.execute(
query=self.UPDATE_COMPONENT_INFO,
Expand Down
4 changes: 2 additions & 2 deletions packages/dsw-database/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'

[project]
name = 'dsw-database'
version = "4.5.0"
version = "4.6.0"
description = 'Library for managing DSW database'
readme = 'README.md'
keywords = ['dsw', 'database']
Expand All @@ -26,7 +26,7 @@ dependencies = [
'psycopg[binary]',
'tenacity',
# DSW
"dsw-config==4.5.0",
"dsw-config==4.6.0",
]

[project.urls]
Expand Down
8 changes: 4 additions & 4 deletions packages/dsw-database/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
psycopg==3.1.17
psycopg-binary==3.1.17
psycopg==3.1.18
psycopg-binary==3.1.18
PyYAML==6.0.1
tenacity==8.2.3
typing_extensions==4.9.0
tzdata==2023.4
typing_extensions==4.11.0
tzdata==2024.1
Loading

0 comments on commit d757fc2

Please sign in to comment.