Skip to content

Commit 235a50a

Browse files
Merge branch 'main' into feature/#65-Add-nox-session-for-checking-if-the-changelog-got-updated
2 parents 47f74e4 + 58773f8 commit 235a50a

File tree

10 files changed

+570
-184
lines changed

10 files changed

+570
-184
lines changed

.github/workflows/checks.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,25 @@ jobs:
136136
path: .security.json
137137
include-hidden-files: true
138138

139+
Vulnerabilities:
140+
name: Check Vulnerabilities (Python-${{ matrix.python-version }})
141+
needs: [ Version-Check, build-matrix ]
142+
runs-on: ubuntu-latest
143+
strategy:
144+
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
145+
146+
steps:
147+
- name: SCM Checkout
148+
uses: actions/checkout@v4
149+
150+
- name: Setup Python & Poetry Environment
151+
uses: ./.github/actions/python-environment
152+
with:
153+
python-version: ${{ matrix.python-version }}
154+
155+
- name: Run Package vulnerabilities Check
156+
run: poetry run nox -s dependency:audit
157+
139158
Format:
140159
name: Format Check
141160
runs-on: ubuntu-latest

doc/changes/unreleased.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
## ✨ Added
44

5+
* [#73](https://github.com/exasol/python-toolbox/issues/73): Added nox target for auditing work spaces in regard to known vulnerabilities
56
* [#65](https://github.com/exasol/python-toolbox/issues/65): Added a Nox task for checking if the changelog got updated.

doc/developer_guide/developer_guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
:maxdepth: 2
99

1010
../design
11-
development
1211
plugins
1312
modules/modules
13+
../user_guide/how_to_release

doc/developer_guide/development.rst

Lines changed: 0 additions & 77 deletions
This file was deleted.

doc/user_guide/how_to_release.rst

Lines changed: 76 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,79 @@
11
How to Release?
22
===============
33

4-
#. Use :code:`nox -s release:prepare` to prepare the project for a new release.
5-
#. Merge your **Pull Request** to the **default branch**
6-
#. Use :code:`git remote show origin | sed -n '/HEAD branch/s/.*: //p'` to output the **default branch**
7-
#. Use :code:`git checkout <default branch>` Switch to the **default branch**
8-
#. Use :code:`git pull` to update branch
9-
#. Use :code:`TAG=<name>` to set a variable named **"TAG"**
10-
#. Use :code:`git tag "${TAG}"` to create a new tag in your repo
11-
#. Use :code:`git push origin "${TAG}"` to push it to remote
12-
#. GitHub workflow **CD** reacts on this tag and starts the release process
4+
Creating a Release
5+
++++++++++++++++++
6+
7+
1. Set a variable named **TAG** with the appropriate version numbers:
8+
9+
.. code-block:: shell
10+
11+
TAG="<major>.<minor>.<patch>"
12+
13+
#. Prepare the project for a new release:
14+
15+
.. code-block:: shell
16+
17+
nox -s release:prepare -- "${TAG}"
18+
19+
#. Merge your **Pull Request** to the **default branch**
20+
#. Switch to the **default branch**:
21+
22+
.. code-block:: shell
23+
24+
git checkout $(git remote show origin | sed -n '/HEAD branch/s/.*: //p')
25+
26+
#. Update branch:
27+
28+
.. code-block:: shell
29+
30+
git pull
31+
32+
#. Create a new tag in your local repo:
33+
34+
.. code-block:: shell
35+
36+
git tag "${TAG}"
37+
38+
#. Push the repo to remote:
39+
40+
.. code-block:: shell
41+
42+
git push origin "${TAG}"
43+
44+
.. hint::
45+
46+
GitHub workflow **.github/workflows/cd.yml** reacts on this tag and starts the release process
47+
48+
What to do if the release failed?
49+
+++++++++++++++++++++++++++++++++
50+
51+
The release failed during pre-release checks
52+
--------------------------------------------
53+
54+
#. Delete the local tag
55+
56+
.. code-block:: shell
57+
58+
git tag -d "${TAG}"
59+
60+
#. Delete the remote tag
61+
62+
.. code-block:: shell
63+
64+
git push --delete origin "${TAG}"
65+
66+
#. Fix the issue(s) which lead to the failing checks
67+
#. Start the release process from the beginning
68+
69+
70+
One of the release steps failed (Partial Release)
71+
-------------------------------------------------
72+
#. Check the Github action/workflow to see which steps failed
73+
#. Finish or redo the failed release steps manually
74+
75+
.. note:: Example
76+
77+
**Scenario**: Publishing of the release on Github was successfully but during the PyPi release, the upload step got interrupted.
78+
79+
**Solution**: Manually push the package to PyPi

exasol/toolbox/nox/_dependencies.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,20 @@ def _normalize_package_name(name: str) -> str:
212212
return template.format(heading=heading(), rows=rows)
213213

214214

215+
def _audit(session: Session) -> None:
216+
session.run("poetry", "run", "pip-audit")
217+
218+
215219
@nox.session(name="dependency:licenses", python=False)
216220
def dependency_licenses(session: Session) -> None:
217221
"""returns the packages and their licenses"""
218222
toml = Path("pyproject.toml")
219223
dependencies = _dependencies(toml.read_text())
220224
package_infos = _licenses()
221225
print(_packages_to_markdown(dependencies=dependencies, packages=package_infos))
226+
227+
228+
@nox.session(name="dependency:audit", python=False)
229+
def audit(session: Session) -> None:
230+
"""Check for known vulnerabilities"""
231+
_audit(session)

exasol/toolbox/nox/tasks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def check(session: Session) -> None:
8282

8383
from exasol.toolbox.nox._dependencies import (
8484
dependency_licenses,
85+
audit
8586
)
8687

8788
# isort: on

exasol/toolbox/templates/github/workflows/checks.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,25 @@ jobs:
139139
path: .security.json
140140
include-hidden-files: true
141141

142+
Vulnerabilities:
143+
name: Check Vulnerabilities (Python-${{ matrix.python-version }})
144+
needs: [ Version-Check, build-matrix ]
145+
runs-on: ubuntu-latest
146+
strategy:
147+
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
148+
149+
steps:
150+
- name: SCM Checkout
151+
uses: actions/checkout@v4
152+
153+
- name: Setup Python & Poetry Environment
154+
uses: ./.github/actions/python-environment
155+
with:
156+
python-version: ${{ matrix.python-version }}
157+
158+
- name: Run Package vulnerabilities Check
159+
run: poetry run nox -s dependency:audit
160+
142161
Format:
143162
name: Format Check
144163
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)