From db812353e25f6c9db33c18cac43a6a9dedaf9552 Mon Sep 17 00:00:00 2001 From: Smail KOURTA Date: Tue, 7 Jan 2025 19:57:12 +0400 Subject: [PATCH] [DPE-6265] - Fix build pipeline (#14) This PR adds a new plugin requirement and modifies the `tox.ini` configuration according to the breaking changes of poetry 2.0 and upgrades the DP workflows Dependency and plugin updates: * [`pyproject.toml`](diffhunk://#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711R24-R26): Added the `poetry-plugin-export` plugin to the required plugins section. Configuration updates: * [`tox.ini`](diffhunk://#diff-ef2cef9f88b4fe09ca3082140e67f5ad34fb65fb6e228f119d3812261ae51449L28-R28): Removed the deprecated `--no-update` flag from the `poetry lock` command [see](https://github.com/python-poetry/poetry/pull/9327). * [`.github/workflows/ci.yaml`](diffhunk://#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133ddL14-R19): Updated the `cron` syntax and changed the version of the `lint.yaml`, `build_charm.yaml`, and `integration_test_charm.yaml` templates from `v23.0.4` to `v24.0.6`. [[1]](diffhunk://#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133ddL14-R19) [[2]](diffhunk://#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133ddL59-R59) [[3]](diffhunk://#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133ddL79-R79) * [`.github/workflows/release.yaml`](diffhunk://#diff-e426ed45842837026e10e66af23d9c7077e89eacbe6958ce7cb991130ad05adaL40-R47): Updated the version of the `build_charm.yaml` and `release_charm.yaml` templates from `v23.0.4` to `v24.0.6`. --- .github/workflows/ci.yaml | 10 +++++----- .github/workflows/release.yaml | 8 ++++---- charmcraft.yaml | 11 ++++++----- pyproject.toml | 3 +++ tox.ini | 2 +- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 715b2c6..b0990f9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,12 +11,12 @@ on: workflow_call: pull_request: schedule: - - cron: '53 0 * * *' # Daily at 00:53 UTC + - cron: "53 0 * * *" # Daily at 00:53 UTC jobs: lint: name: Lint - uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v23.0.4 + uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v24.0.6 unit-test: name: Unit test charm @@ -56,7 +56,7 @@ jobs: build: name: Build charm - uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v23.0.4 + uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v24.0.6 with: cache: true @@ -76,11 +76,11 @@ jobs: - lint - unit-test - build - uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v23.0.4 + uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v24.0.6 with: juju-agent-version: ${{ matrix.juju.agent }} juju-snap-channel: ${{ matrix.juju.snap_channel }} artifact-prefix: packed-charm-cache-true cloud: lxd permissions: - contents: write \ No newline at end of file + contents: write diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 73ce7ab..5ba62b3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,7 +13,7 @@ jobs: uses: ./.github/workflows/ci.yaml secrets: inherit permissions: - contents: write # Needed for Allure Report beta + contents: write # Needed for Allure Report beta release-libraries: name: Release libraries @@ -37,18 +37,18 @@ jobs: build: name: Build charm - uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v23.0.4 + uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v24.0.6 release: name: Release charm needs: - ci-tests - build - uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v23.0.4 + uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v24.0.6 with: channel: 3.5/edge artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} secrets: charmhub-token: ${{ secrets.CHARMHUB_TOKEN }} permissions: - contents: write # Needed to create GitHub release \ No newline at end of file + contents: write # Needed to create GitHub release diff --git a/charmcraft.yaml b/charmcraft.yaml index d026806..0907bc2 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -10,11 +10,11 @@ type: charm # see: https://github.com/canonical/data-platform-workflows/issues/246 bases: - build-on: - - name: ubuntu - channel: "22.04" + - name: ubuntu + channel: "22.04" run-on: - - name: ubuntu - channel: "22.04" + - name: ubuntu + channel: "22.04" parts: charm: @@ -29,9 +29,10 @@ parts: # Convert subset of poetry.lock to requirements.txt curl -sSL https://install.python-poetry.org | python3 - + /root/.local/bin/poetry self add poetry-plugin-export /root/.local/bin/poetry export --only main,charm-libs --output requirements.txt craftctl default charm-strict-dependencies: true charm-requirements: [requirements.txt] - charm-entrypoint: src/charm.py \ No newline at end of file + charm-entrypoint: src/charm.py diff --git a/pyproject.toml b/pyproject.toml index ece49a7..154c7d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,9 @@ pydantic = "^1.10, <2" cryptography = ">=42.0.5" jsonschema = "*" +[tool.poetry.requires-plugins] +poetry-plugin-export = ">=1.8" + [tool.poetry.group.format] optional = true diff --git a/tox.ini b/tox.ini index 0994338..8e52b94 100644 --- a/tox.ini +++ b/tox.ini @@ -25,7 +25,7 @@ description = Apply coding style standards to code commands_pre = poetry install --only format commands = - poetry lock --no-update + poetry lock poetry run ruff check --fix {[vars]all_path} poetry run ruff format {[vars]all_path}