Skip to content

Commit b8699c3

Browse files
committed
chore(ci): upgrade poetry 2.x
Version is now defined in a common workflow file. Signed-off-by: Fatih Acar <[email protected]>
1 parent 81033e2 commit b8699c3

File tree

11 files changed

+61
-16
lines changed

11 files changed

+61
-16
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ USER vscode
3636

3737
RUN pip install toml invoke
3838

39-
RUN curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.5 python3 - \
39+
RUN curl -sSL https://install.python-poetry.org | POETRY_VERSION=2.1.3 python3 - \
4040
&& echo "export PATH=\"$HOME/.local/bin:$PATH\"" >> $HOME/.bashrc
4141

4242
RUN bash -c "$(curl -sL https://get.containerlab.dev)"

.github/workflows/ci-docker-image.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ env:
4444
DOCKERFILE: "development/Dockerfile"
4545

4646
jobs:
47+
prepare-environment:
48+
uses: ./.github/workflows/define-versions.yml
4749
build:
50+
needs: prepare-environment
51+
env:
52+
POETRY_VERSION: ${{ needs.prepare-environment.outputs.POETRY_VERSION }}
4853
runs-on:
4954
group: huge-runners
5055
steps:

.github/workflows/ci.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ env:
3030
METRICS_ENDPOINT: ${{ secrets.METRICS_ENDPOINT }}
3131

3232
jobs:
33-
# ------------------------------------------ Check Files Changes ------------------------------------------
33+
prepare-environment:
34+
uses: ./.github/workflows/define-versions.yml
35+
# ------------------------------------------ Check Files Changes ------------------------------------------
3436
files-changed:
3537
name: Detect which file has changed
3638
runs-on: ubuntu-latest
@@ -61,7 +63,7 @@ jobs:
6163
token: ${{ github.token }}
6264
filters: .github/file-filters.yml
6365

64-
# ------------------------------------------ All Linter ------------------------------------------
66+
# ------------------------------------------ All Linter ------------------------------------------
6567
yaml-lint:
6668
if: needs.files-changed.outputs.yaml == 'true'
6769
needs: ["files-changed"]
@@ -160,7 +162,7 @@ jobs:
160162

161163
infrahub-testcontainers-check:
162164
if: needs.files-changed.outputs.infrahub_poetry_files == 'true'
163-
needs: ["files-changed"]
165+
needs: ["prepare-environment", "files-changed"]
164166
runs-on: ubuntu-latest
165167
timeout-minutes: 5
166168
steps:
@@ -176,7 +178,7 @@ jobs:
176178

177179
- name: "Setup Python environment"
178180
run: |
179-
pipx install poetry==1.8.5
181+
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
180182
poetry config virtualenvs.create true --local
181183
poetry env use 3.12
182184
@@ -403,13 +405,14 @@ jobs:
403405
!contains(needs.*.result, 'cancelled') &&
404406
(needs.files-changed.outputs.backend == 'true' ||
405407
needs.files-changed.outputs.testcontainers == 'true')
406-
needs: ["files-changed", "yaml-lint", "python-lint"]
408+
needs: ["prepare-environment", "files-changed", "yaml-lint", "python-lint"]
407409
runs-on:
408410
group: huge-runners
409411
timeout-minutes: 45
410412
env:
411413
INFRAHUB_DB_TYPE: neo4j
412414
PYTEST_XDIST_WORKER_COUNT: 1
415+
POETRY_VERSION: ${{ needs.prepare-environment.outputs.POETRY_VERSION }}
413416
steps:
414417
- name: "Check out repository code"
415418
uses: "actions/checkout@v4"
@@ -508,7 +511,7 @@ jobs:
508511
!contains(needs.*.result, 'cancelled') &&
509512
(needs.files-changed.outputs.backend == 'true' ||
510513
needs.files-changed.outputs.documentation == 'true')
511-
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
514+
needs: ["prepare-environment", "files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
512515
runs-on: ubuntu-latest
513516
steps:
514517
- name: Check out repository code
@@ -521,7 +524,7 @@ jobs:
521524
python-version: 3.12
522525
- name: "Setup environment"
523526
run: |
524-
pipx install poetry==1.8.5
527+
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
525528
poetry config virtualenvs.create true --local
526529
poetry env use 3.12
527530
pip install invoke toml
@@ -624,7 +627,7 @@ jobs:
624627
!contains(needs.*.result, 'failure') &&
625628
!contains(needs.*.result, 'cancelled') &&
626629
(needs.files-changed.outputs.python == 'true') || (needs.files-changed.outputs.documentation == 'true')
627-
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
630+
needs: ["prepare-environment", "files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
628631
runs-on: "ubuntu-22.04"
629632
timeout-minutes: 5
630633
steps:
@@ -638,7 +641,7 @@ jobs:
638641
python-version: "3.12"
639642
- name: "Setup Python environment"
640643
run: |
641-
pipx install poetry==1.8.5
644+
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
642645
poetry config virtualenvs.create true --local
643646
poetry env use 3.12
644647
- name: "Install dependencies"
@@ -704,6 +707,7 @@ jobs:
704707
run:
705708
working-directory: ./frontend/app
706709
needs:
710+
- prepare-environment
707711
- javascript-lint
708712
- files-changed
709713
- yaml-lint
@@ -723,6 +727,7 @@ jobs:
723727
- name: E2E-testing-playwright
724728
env:
725729
INFRAHUB_DB_TYPE: neo4j
730+
POETRY_VERSION: ${{ needs.prepare-environment.outputs.POETRY_VERSION }}
726731
# - name: E2E-testing-playwright-nats
727732
# env:
728733
# INFRAHUB_DB_TYPE: neo4j
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
# yamllint disable rule:truthy rule:truthy rule:line-length
3+
name: "Define versions"
4+
on:
5+
workflow_call:
6+
outputs:
7+
POETRY_VERSION:
8+
value: "2.1.3"
9+
10+
jobs:
11+
prepare:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- run: "true"

.github/workflows/poetry-check.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ on:
99
description: "Directory in which poetry check will be executed"
1010
default: "./"
1111
jobs:
12+
prepare-environment:
13+
uses: ./.github/workflows/define-versions.yml
1214
poetry_check:
15+
needs: prepare-environment
1316
runs-on: "ubuntu-latest"
1417
steps:
1518
- name: "Check out repository code"
@@ -22,7 +25,7 @@ jobs:
2225
python-version: "3.12"
2326
- name: "Setup environment"
2427
run: |
25-
pipx install poetry==1.8.5
28+
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
2629
- name: "Validate pyproject.toml and consistency with poetry.lock"
2730
run: |
2831
poetry check

.github/workflows/publish-pypi.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ on:
2828
default: false
2929

3030
jobs:
31+
prepare-environment:
32+
uses: ./.github/workflows/define-versions.yml
3133
publish_to_pypi:
3234
name: "Publish Infrahub-Server and Infrahub-Testcontainers to PyPI"
3335
runs-on: "ubuntu-22.04"
3436
strategy:
3537
matrix:
3638
package_dir: ["", "python_testcontainers"]
39+
needs: prepare-environment
3740
steps:
3841
- name: "Set up Python"
3942
uses: "actions/setup-python@v5"
@@ -42,7 +45,7 @@ jobs:
4245
- name: "Install Poetry"
4346
uses: "snok/install-poetry@v1"
4447
with:
45-
version: 1.8.5
48+
version: ${{ needs.prepare-environment.outputs.POETRY_VERSION }}
4649
virtualenvs-create: true
4750
virtualenvs-in-project: true
4851
installer-parallel: true

.github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ on:
88
- published
99

1010
jobs:
11+
prepare-environment:
12+
uses: ./.github/workflows/define-versions.yml
1113
check_release:
1214
runs-on: ubuntu-22.04
15+
needs: prepare-environment
1316
outputs:
1417
is_prerelease: ${{ steps.release.outputs.is_prerelease }}
1518
is_devrelease: ${{ steps.release.outputs.is_devrelease }}
@@ -30,7 +33,7 @@ jobs:
3033
- name: "Install Poetry"
3134
uses: "snok/install-poetry@v1"
3235
with:
33-
version: 1.8.5
36+
version: ${{ needs.prepare-environment.outputs.POETRY_VERSION }}
3437
virtualenvs-create: true
3538
virtualenvs-in-project: true
3639
installer-parallel: true

.github/workflows/update-compose-file-and-chart.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ on:
1818
- closed
1919

2020
jobs:
21+
prepare-environment:
22+
uses: ./.github/workflows/define-versions.yml
2123
update-docker-compose:
2224
runs-on: ubuntu-latest
25+
needs: prepare-environment
2326
if: |
2427
github.event_name == 'push' ||
2528
(github.event_name == 'pull_request' && github.event.pull_request.merged == true &&
@@ -38,7 +41,7 @@ jobs:
3841
python-version: 3.12
3942
- name: "Setup environment"
4043
run: |
41-
pipx install poetry==1.8.5
44+
pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
4245
poetry config virtualenvs.prefer-active-python true
4346
- name: "Install Package"
4447
run: "poetry install --all-extras"

.github/workflows/version-upgrade.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ env:
2626
VMAGENT_PORT: 0
2727

2828
jobs:
29+
prepare-environment:
30+
uses: ./.github/workflows/define-versions.yml
2931
migration-tests:
3032
strategy:
3133
fail-fast: false
@@ -38,8 +40,10 @@ jobs:
3840
runs-on:
3941
group: huge-runners
4042
timeout-minutes: 120
43+
needs: prepare-environment
4144
env:
4245
INFRAHUB_DB_TYPE: neo4j
46+
POETRY_VERSION: ${{ needs.prepare-environment.outputs.POETRY_VERSION }}
4347
steps:
4448
- name: "Check out repository code"
4549
uses: "actions/checkout@v4"
@@ -51,7 +55,7 @@ jobs:
5155
python-version: 3.12
5256
- name: "Setup python environment"
5357
run: |
54-
pipx install poetry==1.8.5
58+
pipx install poetry==${{ env.POETRY_VERSION }}
5559
poetry config virtualenvs.prefer-active-python true
5660
pip install invoke toml
5761
- name: "Install Package"

development/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# STAGE : Base Python Image
33
# ****************************************************************
44
ARG PYTHON_VER=3.12
5+
ARG POETRY_VER
56
FROM docker.io/python:${PYTHON_VER}-slim AS base
67

78
ENV PYTHONUNBUFFERED 1
@@ -24,7 +25,7 @@ RUN apt-get update && \
2425
tee /etc/apt/sources.list.d/docker.list > /dev/null && \
2526
apt-get update && \
2627
apt-get install --no-install-recommends -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin && \
27-
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.5 python3 - && \
28+
curl -sSL https://install.python-poetry.org | POETRY_VERSION=$POETRY_VER python3 - && \
2829
apt-get autoremove -y && \
2930
apt-get clean all && \
3031
rm -rf /var/lib/apt/lists/* && \

0 commit comments

Comments
 (0)