Skip to content

Commit 5626f33

Browse files
authored
Documentation/721 add workflow generate (#724)
* Split up API into sub-files & fix so BaseConfig can be viewed * Update to workflow:generate in docs * Add workflow_patcher page * Add models to API
1 parent 251e5ea commit 5626f33

File tree

15 files changed

+252
-62
lines changed

15 files changed

+252
-62
lines changed

doc/api/base_config.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.. _base_config:
2+
3+
BaseConfig
4+
==========
5+
6+
.. currentmodule:: exasol.toolbox.config
7+
8+
.. autoclass:: BaseConfig
9+
:members:
10+
:undoc-members:
11+
:show-inheritance:
12+
:member-order: bysource
13+
:special-members: __init__

doc/api/index.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. _api:
2+
3+
:octicon:`cpu` API Reference
4+
=============================
5+
6+
.. toctree::
7+
:maxdepth: 2
8+
9+
base_config
10+
workflow_exceptions
11+
workflow_patcher_config

doc/api.rst renamed to doc/api/workflow_exceptions.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
.. _api:
2-
3-
:octicon:`cpu` API Reference
4-
=============================
5-
61
.. _workflow_exceptions:
72

83
Workflow Exceptions
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.. _workflow_patcher_config:
2+
3+
WorkflowPatcherConfig
4+
=====================
5+
6+
.. currentmodule:: exasol.toolbox.util.workflows.patch_workflow
7+
8+
.. autoclass:: WorkflowPatcherConfig
9+
:members:
10+
:undoc-members:
11+
:show-inheritance:
12+
:member-order: bysource
13+
:special-members: __init__
14+
15+
.. autoclass:: Workflow
16+
:members:
17+
:undoc-members:
18+
:show-inheritance:
19+
:member-order: bysource
20+
:special-members: __init__
21+
22+
.. autoclass:: StepCustomization
23+
:members:
24+
:undoc-members:
25+
:show-inheritance:
26+
:member-order: bysource
27+
:special-members: __init__
28+
29+
.. autoclass:: StepContent
30+
:members:
31+
:undoc-members:
32+
:show-inheritance:
33+
:member-order: bysource
34+
:special-members: __init__
35+
36+
.. autofunction:: validate_workflow_name

doc/changes/unreleased.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,29 @@
22

33
## Summary
44

5+
In this major version:
6+
* the Nox session `workflow:generate` has been added to replace the deprecated
7+
`tbx workflow install` and `tbx workflow update`. It has the additional feature
8+
that users may customize the PTB provided workflows with a `.workflow-patcher.yml`
9+
file.
10+
* the GitHub workflow templates have been modified to include step_ids and to follow
11+
an AP-format naming convention, as such it is anticipated that updating the workflows
12+
results in several small changes.
13+
514
## Feature
615

716
* #691: Started customization of PTB workflows by defining the YML schema
817
* #712: Added basic logging to workflow processing
9-
* #714: Added logic to modify a workflow using the .workflow-patcher.yml
10-
* #717: Restricted workflow names in .workflow-patcher.yml to template workflow names
11-
* #719: Added nox session `workflow:generate` to generate/update workflows using the `.workflow-patcher.yml` (if desired)
18+
* #714: Added logic to modify a workflow using the` .workflow-patcher.yml`
19+
* #717: Restricted workflow names in `.workflow-patcher.yml` to template workflow names
20+
* #719: Added Nox session `workflow:generate` to generate/update workflows using the `.workflow-patcher.yml` (if desired)
1221
* #725: Added newline after headlines for dependency changes
1322

1423
## Documentation
1524

1625
* #705: Described how the versions of poetry and python are retrieved
1726
* #706: Added description how to ignore findings to the User Guide
27+
* #721: Added documentation for Nox session `workflow:generate`
1828

1929
## Refactoring
2030

doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ Documentation of the Exasol-Toolbox
5252
developer_guide/developer_guide
5353
tools
5454
github_actions/github_actions
55-
api
55+
api/index
5656
changes/changelog

doc/user_guide/configuration.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ especially when starting a new project.
1111

1212
features/metrics/sonar
1313
Formatting <features/formatting_code/configuration>
14+
features/github_workflows/github_project_configuration

doc/user_guide/features/github_workflows/create_and_update.rst

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
Creating and Updating the GitHub Workflows in Your Project
44
==========================================================
55

6-
PTB can initially generate the GitHub workflows in your project and also
6+
The PTB can initially generate the GitHub workflows in your project and also
77
update existing workflows.
88

99
The workflows are based on Jinja templates with variables populated by the
10-
PTB. The PTB reads the values from various places within your project, see
11-
:ref:`template_variables`.
10+
PTB. The PTB reads the values from various attributes and properties of your
11+
project's config, see :ref:`template_variables`.
1212

1313
Please note that the PTB only updates the values in the GitHub workflows when
1414
*updating* the workflows. So, after updating the :ref:`list of Python versions
@@ -36,8 +36,8 @@ Many workflows are using a Build-matrix to iterate over multiple versions of
3636
Python and/or the Exasol Docker DB. This is to make sure your code is valid,
3737
free of bugs and working correctly for each combination of these items.
3838

39-
PTB has a default for these versions, but you can override it in file
40-
``noxconfig.py``, e.g.
39+
The PTB has a default for these versions, but you can override it in the
40+
``noxconfig.py`` file, e.g.
4141

4242
.. code-block:: shell
4343
@@ -49,18 +49,62 @@ PTB has a default for these versions, but you can override it in file
4949
Some workflows are expected to not depend on a specific Python version and
5050
will use only the lowest Python version in the list specified above.
5151
52+
.. _customize_workflows:
53+
54+
Customize Workflows for Your Project
55+
------------------------------------
56+
57+
The PTB allows you to customise workflows by targeting specific jobs or steps:
58+
59+
* Remove a job by its job_name.
60+
* Replace a step (referenced by step_id) with one or more new steps.
61+
* Insert steps after a specific step_id.
62+
63+
.. note::
64+
65+
These operations do not currently cascade. For example, removing a job
66+
without accounting for its downstream dependencies may result in errors.
67+
You must manually adjust any subsequent steps that rely on the removed
68+
job's or step's output.
69+
70+
To utilize this feature, create a ``.workflow-patcher.yml`` file in your project's
71+
root directory, as specified further in :ref:`workflow_patcher`. This file will be
72+
automatically detected, validated by a pydantic model, and
73+
used when you :ref:`install or update your workflows <update_workflows>`.
74+
75+
.. note::
76+
The pydantic validation checks that the yml file is in the expected format
77+
and that the specified workflow names exist. However, when a workflow is being
78+
generated, each removed job or modified step_id is checked to see if it exists.
79+
If it does not exist, an exception will be raised (:ref:`workflow_exceptions`).
80+
5281
.. _update_workflows:
5382
5483
Add all Workflows to Your Project
5584
---------------------------------
5685
5786
.. code-block:: shell
5887
59-
tbx workflow install all
88+
poetry run -- nox -s workflow:generate -- all
6089
6190
.. warning::
62-
#. If you already have various workflows, you may want to run the
63-
:code:`update` command instead of the :code:`install` command.
91+
Some workflows depend on other workflows. Please ensure you have all
92+
the required workflows if you do not install all of them.
93+
94+
.. note::
95+
96+
The commands:
97+
98+
* ``tbx workflow install all`` - used to install workflows
99+
* ``tbx workflow update all`` - used to update workflows
100+
101+
are considered historic variants of this command.
102+
103+
**Deprecation Notice:**
104+
These ``tbx`` endpoints are marked as **deprecated** and are scheduled for removal
105+
by **April 22nd, 2026**.
64106
65-
#. Some workflows depend on other workflows. Please ensure you have all
66-
the required workflows if you do not install all of them.
107+
Please note that these legacy commands do not allow users to use their specified
108+
``.workflow-patcher.yml`` file to further customise or patch workflows. Users
109+
should transition to the ``nox``-based command to leverage full customisation
110+
features.

doc/user_guide/features/github_workflows/github_project_configuration.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ Branch Protection
77
-----------------
88

99
The best and most maintainable way to have solid branch protection
10-
(:code:`Settings/Branches/main`) is to require the workflow :code:`CI / Allow
11-
Merge` to pass successfully.
10+
(:code:`Settings/Branches/main`) is to require the workflow :code:`merge-gate / Allow
11+
Merge` to pass successfully. Additionally, if it makes sense for your project,
12+
you can further require that ``SonarCloud Code Analysis`` passes.
1213

1314
.. note::
1415
Setting the required status checks to pass before merging is only possible
@@ -17,7 +18,7 @@ Merge` to pass successfully.
1718
Manual Approval
1819
---------------
1920

20-
If your CI workflow involves slow or expensive steps you can guard these to be
21+
If your CI workflow involves slow or expensive steps, you can guard these to be
2122
executed only after manual approval. The CI workflow will automatically create
2223
a GitHub environment named :code:`manual-approval`. You only need to add
2324
reviewers in (:code:`Settings/Environments/manual-approval`) and move the
@@ -27,11 +28,11 @@ file :code:`.github/workflows/merge-gate.yml`.
2728
Secrets
2829
-------
2930

30-
For accessing specific services in the Internet, your project often needs a
31+
For accessing specific services in the internet, your project often needs a
3132
related *token* or other credentials. These credentials can be acquired by
3233
registering on the service's website.
3334

34-
In many cases your company or organization may manage the credentials
35+
In many cases, your company or organization may manage the credentials
3536
centrally and enable the use in multiple projects. The credentials can be
3637
managed as Secrets in GitHub and can be made accessible to GitHub projects and
3738
used by their workflows.

doc/user_guide/features/github_workflows/index.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ GitHub Workflow Templates
1010
github_project_configuration
1111
create_and_update
1212
template_variables
13+
workflow_patcher
1314

1415
The PTB ships with configurable GitHub workflow templates covering the most common
1516
CI/CD setup variants for Python projects. The templates are defined in:
@@ -20,13 +21,15 @@ workflows from the templates.
2021

2122
.. code-block:: bash
2223
23-
poetry run -- tbx workflow --help
24+
poetry run -- nox -s workflow:generate --help
2425
2526
.. attention::
2627

2728
In most cases, we recommend using _all_ workflows without change to ensure
2829
consistent interdependencies. For more details, see :ref:`ci_actions`.
2930

31+
The deprecated alternate is to use the CLI provided by
32+
``poetry run -- tbx workflow --help``. This will be removed by April 22nd, 2026.
3033

3134
Workflows
3235
---------

0 commit comments

Comments
 (0)