Skip to content

Commit 51591cb

Browse files
authored
build: bump poetry to 2.3.4 and consolidate SDK workflows (#10681)
1 parent e24e1ab commit 51591cb

19 files changed

Lines changed: 48 additions & 68 deletions

.github/actions/setup-python-poetry/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ inputs:
1313
poetry-version:
1414
description: 'Poetry version to install'
1515
required: false
16-
default: '2.1.1'
16+
default: '2.3.4'
1717
install-dependencies:
1818
description: 'Install Python dependencies with Poetry'
1919
required: false
2020
default: 'true'
21+
update-lock:
22+
description: 'Run `poetry lock` during setup. Only enable when a prior step mutates pyproject.toml (e.g. API `@master` VCS rewrite). Default: false.'
23+
required: false
24+
default: 'false'
2125

2226
runs:
2327
using: 'composite'
@@ -74,7 +78,7 @@ runs:
7478
grep -A2 -B2 "resolved_reference" poetry.lock
7579
7680
- name: Update poetry.lock (prowler repo only)
77-
if: github.repository == 'prowler-cloud/prowler'
81+
if: github.repository == 'prowler-cloud/prowler' && inputs.update-lock == 'true'
7882
shell: bash
7983
working-directory: ${{ inputs.working-directory }}
8084
run: poetry lock

.github/workflows/api-code-quality.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
with:
6868
python-version: ${{ matrix.python-version }}
6969
working-directory: ./api
70+
update-lock: 'true'
7071

7172
- name: Poetry check
7273
if: steps.check-changes.outputs.any_changed == 'true'

.github/workflows/api-security.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
with:
7171
python-version: ${{ matrix.python-version }}
7272
working-directory: ./api
73+
update-lock: 'true'
7374

7475
- name: Bandit
7576
if: steps.check-changes.outputs.any_changed == 'true'

.github/workflows/api-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ jobs:
116116
with:
117117
python-version: ${{ matrix.python-version }}
118118
working-directory: ./api
119+
update-lock: 'true'
119120

120121
- name: Run tests with pytest
121122
if: steps.check-changes.outputs.any_changed == 'true'

.github/workflows/prepare-release.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,11 @@ jobs:
3838
token: ${{ secrets.PROWLER_BOT_ACCESS_TOKEN }}
3939
persist-credentials: false
4040

41-
- name: Set up Python
42-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
41+
- name: Setup Python with Poetry
42+
uses: ./.github/actions/setup-python-poetry
4343
with:
4444
python-version: '3.12'
45-
46-
- name: Install Poetry
47-
run: |
48-
python3 -m pip install --user poetry==2.1.1
49-
echo "$HOME/.local/bin" >> $GITHUB_PATH
45+
install-dependencies: 'false'
5046

5147
- name: Configure Git
5248
run: |

.github/workflows/sdk-code-quality.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,11 @@ jobs:
6969
contrib/**
7070
**/AGENTS.md
7171
72-
- name: Install Poetry
72+
- name: Setup Python with Poetry
7373
if: steps.check-changes.outputs.any_changed == 'true'
74-
run: pipx install poetry==2.1.1
75-
76-
- name: Set up Python ${{ matrix.python-version }}
77-
if: steps.check-changes.outputs.any_changed == 'true'
78-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
74+
uses: ./.github/actions/setup-python-poetry
7975
with:
8076
python-version: ${{ matrix.python-version }}
81-
cache: 'poetry'
82-
83-
- name: Install dependencies
84-
if: steps.check-changes.outputs.any_changed == 'true'
85-
run: |
86-
poetry install --no-root
87-
poetry run pip list
8877

8978
- name: Check Poetry lock file
9079
if: steps.check-changes.outputs.any_changed == 'true'

.github/workflows/sdk-container-build-push.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,14 @@ jobs:
7474
with:
7575
persist-credentials: false
7676

77-
- name: Set up Python ${{ env.PYTHON_VERSION }}
78-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
77+
- name: Setup Python with Poetry
78+
uses: ./.github/actions/setup-python-poetry
7979
with:
8080
python-version: ${{ env.PYTHON_VERSION }}
81+
install-dependencies: 'false'
8182

82-
- name: Install Poetry
83-
run: |
84-
pipx install poetry==2.1.1
85-
pipx inject poetry poetry-bumpversion
83+
- name: Inject poetry-bumpversion plugin
84+
run: pipx inject poetry poetry-bumpversion
8685

8786
- name: Get Prowler version and set tags
8887
id: get-prowler-version

.github/workflows/sdk-pypi-release.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,11 @@ jobs:
7373
with:
7474
persist-credentials: false
7575

76-
- name: Install Poetry
77-
run: pipx install poetry==2.1.1
78-
79-
- name: Set up Python ${{ env.PYTHON_VERSION }}
80-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
76+
- name: Setup Python with Poetry
77+
uses: ./.github/actions/setup-python-poetry
8178
with:
8279
python-version: ${{ env.PYTHON_VERSION }}
80+
install-dependencies: 'false'
8381

8482
- name: Build Prowler package
8583
run: poetry build
@@ -111,13 +109,11 @@ jobs:
111109
with:
112110
persist-credentials: false
113111

114-
- name: Install Poetry
115-
run: pipx install poetry==2.1.1
116-
117-
- name: Set up Python ${{ env.PYTHON_VERSION }}
118-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
112+
- name: Setup Python with Poetry
113+
uses: ./.github/actions/setup-python-poetry
119114
with:
120115
python-version: ${{ env.PYTHON_VERSION }}
116+
install-dependencies: 'false'
121117

122118
- name: Install toml package
123119
run: pip install toml

.github/workflows/sdk-security.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,11 @@ jobs:
6969
contrib/**
7070
**/AGENTS.md
7171
72-
- name: Install Poetry
72+
- name: Setup Python with Poetry
7373
if: steps.check-changes.outputs.any_changed == 'true'
74-
run: pipx install poetry==2.1.1
75-
76-
- name: Set up Python 3.12
77-
if: steps.check-changes.outputs.any_changed == 'true'
78-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
74+
uses: ./.github/actions/setup-python-poetry
7975
with:
8076
python-version: '3.12'
81-
cache: 'poetry'
82-
83-
- name: Install dependencies
84-
if: steps.check-changes.outputs.any_changed == 'true'
85-
run: poetry install --no-root
8677

8778
- name: Security scan with Bandit
8879
if: steps.check-changes.outputs.any_changed == 'true'

.github/workflows/sdk-tests.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,11 @@ jobs:
9090
contrib/**
9191
**/AGENTS.md
9292
93-
- name: Install Poetry
93+
- name: Setup Python with Poetry
9494
if: steps.check-changes.outputs.any_changed == 'true'
95-
run: pipx install poetry==2.1.1
96-
97-
- name: Set up Python ${{ matrix.python-version }}
98-
if: steps.check-changes.outputs.any_changed == 'true'
99-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
95+
uses: ./.github/actions/setup-python-poetry
10096
with:
10197
python-version: ${{ matrix.python-version }}
102-
cache: 'poetry'
103-
104-
- name: Install dependencies
105-
if: steps.check-changes.outputs.any_changed == 'true'
106-
run: poetry install --no-root
10798

10899
# AWS Provider
109100
- name: Check if AWS files changed

0 commit comments

Comments
 (0)