Skip to content
Snippets Groups Projects
Commit 4bb11b9e authored by Cédric OLIVIER's avatar Cédric OLIVIER
Browse files

feat: Change boolean variable behaviour


BREAKING CHANGE: boolean variable now triggered on explicit 'true' value

Signed-off-by: default avatarCédric OLIVIER <cedric3.olivier@orange.com>
parent 7a29d782
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ Default configuration follows [this Python project structure](https://docs.pytho ...@@ -36,7 +36,7 @@ Default configuration follows [this Python project structure](https://docs.pytho
The Python template supports [Poetry](https://python-poetry.org/) as packaging and dependency management tool. The Python template supports [Poetry](https://python-poetry.org/) as packaging and dependency management tool.
If a `pyproject.toml` and `poetry.lock` file is detected at the root of your project structure, requirements will automatically be generated from Poetry. If a `pyproject.toml` and `poetry.lock` file is detected at the root of your project structure, requirements will automatically be generated from Poetry.
Poetry support is disabled if `PYTHON_POETRY_DISABLED` has a value. Poetry support is disabled if `PYTHON_POETRY_DISABLED` is set to `true`.
:warning: as stated in [Poetry documentation](https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control), _You should commit the `poetry.lock` file to your project repo so that all people working on the project are locked to the same versions of dependencies_. :warning: as stated in [Poetry documentation](https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control), _You should commit the `poetry.lock` file to your project repo so that all people working on the project are locked to the same versions of dependencies_.
...@@ -53,7 +53,7 @@ It uses the following variables: ...@@ -53,7 +53,7 @@ It uses the following variables:
#### `py-pylint` job #### `py-pylint` job
This job is **disabled by default** and performs code analysis based on [pylint](http://pylint.pycqa.org/en/latest/) Python lib. This job is **disabled by default** and performs code analysis based on [pylint](http://pylint.pycqa.org/en/latest/) Python lib.
It is activated by setting `$PYLINT_ENABLED`. It is activated by setting `$PYLINT_ENABLED` to `true`.
It is bound to the `build` stage, and uses the following variables: It is bound to the `build` stage, and uses the following variables:
...@@ -78,7 +78,7 @@ The Python template features four alternative test jobs: ...@@ -78,7 +78,7 @@ The Python template features four alternative test jobs:
#### `py-unittest` job #### `py-unittest` job
This job is **disabled by default** and performs tests based on [unittest](https://docs.python.org/3/library/unittest.html) Python lib. This job is **disabled by default** and performs tests based on [unittest](https://docs.python.org/3/library/unittest.html) Python lib.
It is activated by setting `$UNITTEST_ENABLED`. It is activated by setting `$UNITTEST_ENABLED` to `true`.
In order to produce JUnit test reports, the tests are executed with the [xmlrunner](https://github.com/xmlrunner/unittest-xml-reporting) module. In order to produce JUnit test reports, the tests are executed with the [xmlrunner](https://github.com/xmlrunner/unittest-xml-reporting) module.
...@@ -111,7 +111,7 @@ source = ...@@ -111,7 +111,7 @@ source =
#### `py-pytest` job #### `py-pytest` job
This job is **disabled by default** and performs tests based on [pytest](https://docs.pytest.org/en/latest/) Python lib. This job is **disabled by default** and performs tests based on [pytest](https://docs.pytest.org/en/latest/) Python lib.
It is activated by setting `$PYTEST_ENABLED`. It is activated by setting `$PYTEST_ENABLED` to `true`.
It is bound to the `build` stage, and uses the following variables: It is bound to the `build` stage, and uses the following variables:
...@@ -142,7 +142,7 @@ source = ...@@ -142,7 +142,7 @@ source =
#### `py-nosetest` job #### `py-nosetest` job
This job is **disabled by default** and performs tests based on [nose](https://nose.readthedocs.io/en/latest/) Python lib. This job is **disabled by default** and performs tests based on [nose](https://nose.readthedocs.io/en/latest/) Python lib.
It is activated by setting `$NOSETESTS_ENABLED`. It is activated by setting `$NOSETESTS_ENABLED` to `true`.
It is bound to the `build` stage, and uses the following variables: It is bound to the `build` stage, and uses the following variables:
...@@ -207,7 +207,7 @@ It is bound to the `test` stage, and uses the following variables: ...@@ -207,7 +207,7 @@ It is bound to the `test` stage, and uses the following variables:
| Name | description | default value | | Name | description | default value |
| ---------------- | ---------------------------------------------------------------------- | ----------------- | | ---------------- | ---------------------------------------------------------------------- | ----------------- |
| `BANDIT_ENABLED` | Variable to enable Bandit analysis | _none_ (disabled) | | `BANDIT_ENABLED` | Set to `true` to enable Bandit analysis | _none_ (disabled) |
| `BANDIT_ARGS` | Additional [Bandit CLI options](https://github.com/PyCQA/bandit#usage) | `--recursive .` | | `BANDIT_ARGS` | Additional [Bandit CLI options](https://github.com/PyCQA/bandit#usage) | `--recursive .` |
This job outputs a **textual report** in the console, and in case of failure also exports a JSON report in the `reports/` This job outputs a **textual report** in the console, and in case of failure also exports a JSON report in the `reports/`
...@@ -221,7 +221,7 @@ It is bound to the `test` stage, and uses the following variables: ...@@ -221,7 +221,7 @@ It is bound to the `test` stage, and uses the following variables:
| Name | description | default value | | Name | description | default value |
| ---------------- | ----------------------------------------------------------------------- | ----------------- | | ---------------- | ----------------------------------------------------------------------- | ----------------- |
| `SAFETY_ENABLED` | Variable to enable Safety job | _none_ (disabled) | | `SAFETY_ENABLED` | Set to `true` to enable Safety job | _none_ (disabled) |
| `SAFETY_ARGS` | Additional [Safety CLI options](https://github.com/pyupio/safety#usage) | `--full-report` | | `SAFETY_ARGS` | Additional [Safety CLI options](https://github.com/pyupio/safety#usage) | `--full-report` |
This job outputs a **textual report** in the console, and in case of failure also exports a JSON report in the `reports/` This job outputs a **textual report** in the console, and in case of failure also exports a JSON report in the `reports/`
...@@ -275,7 +275,7 @@ It is bound to the `publish` stage, applies only on tags and uses the following ...@@ -275,7 +275,7 @@ It is bound to the `publish` stage, applies only on tags and uses the following
| Name | description | default value | | Name | description | default value |
| ------------------------ | -------------------------------------------------------------------------------------- | --------------------------------- | | ------------------------ | -------------------------------------------------------------------------------------- | --------------------------------- |
| `DOCS_ENABLED` | Variable to enable pages job | _none_ (disabled) | | `DOCS_ENABLED` | Set to `true` to enable pages job | _none_ (disabled) |
| `DOCS_REQUIREMENTS_FILE` | Python dependencies for documentation generation _(relative to `$PYTHON_PROJECT_DIR`)_ | `docs-requirements.txt` | | `DOCS_REQUIREMENTS_FILE` | Python dependencies for documentation generation _(relative to `$PYTHON_PROJECT_DIR`)_ | `docs-requirements.txt` |
| `DOCS_DIRECTORY` | Directory containing docs source | `docs` | | `DOCS_DIRECTORY` | Directory containing docs source | `docs` |
| `DOCS_BUILD_DIR` | Output build directory for documentation | `public` | | `DOCS_BUILD_DIR` | Output build directory for documentation | `public` |
......
...@@ -70,7 +70,7 @@ variables: ...@@ -70,7 +70,7 @@ variables:
} }
function install_test_requirements() { function install_test_requirements() {
if [[ -f "pyproject.toml" ]] && [[ -z "${PYTHON_POETRY_DISABLED}" ]]; then if [[ -f "pyproject.toml" ]] && [[ "${PYTHON_POETRY_DISABLED}" != "true" ]]; then
if [[ ! -f "poetry.lock" ]]; then if [[ ! -f "poetry.lock" ]]; then
log_error "Poetry detected but \\e[33;1mpoetry.lock\\e[0m file not found: you shall commit it with your project files" log_error "Poetry detected but \\e[33;1mpoetry.lock\\e[0m file not found: you shall commit it with your project files"
exit 1 exit 1
...@@ -305,7 +305,7 @@ variables: ...@@ -305,7 +305,7 @@ variables:
fi fi
} }
if [[ -z "$TEMPLATE_CHECK_UPDATE_DISABLED" ]]; then check_for_update python "1.3.0"; fi if [[ "$TEMPLATE_CHECK_UPDATE_DISABLED" != "true" ]]; then check_for_update python "1.3.0"; fi
unscope_variables unscope_variables
# ENDSCRIPT # ENDSCRIPT
...@@ -373,11 +373,11 @@ py-lint: ...@@ -373,11 +373,11 @@ py-lint:
- if: $CI_MERGE_REQUEST_ID - if: $CI_MERGE_REQUEST_ID
when: never when: never
# on production branch(es): if $PYLINT_ENABLED is set # on production branch(es): if $PYLINT_ENABLED is set
- if: '$PYLINT_ENABLED && $CI_COMMIT_REF_NAME =~ $PROD_REF' - if: '$PYLINT_ENABLED == "true" && $CI_COMMIT_REF_NAME =~ $PROD_REF'
# on integration branch(es): if $PYLINT_ENABLED is set # on integration branch(es): if $PYLINT_ENABLED is set
- if: '$PYLINT_ENABLED && $CI_COMMIT_REF_NAME =~ $INTEG_REF' - if: '$PYLINT_ENABLED == "true" && $CI_COMMIT_REF_NAME =~ $INTEG_REF'
# on non-production, non-integration branches, with $PYLINT_ENABLED set: auto & non-blocking # on non-production, non-integration branches, with $PYLINT_ENABLED set: auto & non-blocking
- if: '$PYLINT_ENABLED' - if: '$PYLINT_ENABLED == "true"'
allow_failure: true allow_failure: true
py-compile: py-compile:
...@@ -391,7 +391,7 @@ py-compile: ...@@ -391,7 +391,7 @@ py-compile:
- if: $CI_MERGE_REQUEST_ID - if: $CI_MERGE_REQUEST_ID
when: never when: never
# on any branch: only when none of supported unit test framework is enabled # on any branch: only when none of supported unit test framework is enabled
- if: '$UNITTEST_ENABLED == null && $PYTEST_ENABLED == null && $NOSETESTS_ENABLED == null' - if: '$UNITTEST_ENABLED != "true" && $PYTEST_ENABLED != "true" && $NOSETESTS_ENABLED != "true"'
############################################################################################### ###############################################################################################
# test stage # # test stage #
...@@ -427,7 +427,7 @@ py-unittest: ...@@ -427,7 +427,7 @@ py-unittest:
- if: $CI_MERGE_REQUEST_ID - if: $CI_MERGE_REQUEST_ID
when: never when: never
# on any branch: when $UNITTEST_ENABLED is set # on any branch: when $UNITTEST_ENABLED is set
- if: $UNITTEST_ENABLED - if: '$UNITTEST_ENABLED == "true"'
py-pytest: py-pytest:
extends: .python-base extends: .python-base
...@@ -455,7 +455,7 @@ py-pytest: ...@@ -455,7 +455,7 @@ py-pytest:
- if: $CI_MERGE_REQUEST_ID - if: $CI_MERGE_REQUEST_ID
when: never when: never
# on any branch: when $PYTEST_ENABLED is set # on any branch: when $PYTEST_ENABLED is set
- if: $PYTEST_ENABLED - if: '$PYTEST_ENABLED == "true"'
py-nosetests: py-nosetests:
extends: .python-base extends: .python-base
...@@ -482,7 +482,7 @@ py-nosetests: ...@@ -482,7 +482,7 @@ py-nosetests:
- if: $CI_MERGE_REQUEST_ID - if: $CI_MERGE_REQUEST_ID
when: never when: never
# on any branch: when $NOSETESTS_ENABLED is set # on any branch: when $NOSETESTS_ENABLED is set
- if: $NOSETESTS_ENABLED - if: '$NOSETESTS_ENABLED == "true"'
# Bandit (SAST) # Bandit (SAST)
py-bandit: py-bandit:
...@@ -512,11 +512,11 @@ py-bandit: ...@@ -512,11 +512,11 @@ py-bandit:
- if: $CI_MERGE_REQUEST_ID - if: $CI_MERGE_REQUEST_ID
when: never when: never
# on production branch(es): if $BANDIT_ENABLED is set # on production branch(es): if $BANDIT_ENABLED is set
- if: '$BANDIT_ENABLED && $CI_COMMIT_REF_NAME =~ $PROD_REF' - if: '$BANDIT_ENABLED == "true" && $CI_COMMIT_REF_NAME =~ $PROD_REF'
# on integration branch(es): if $BANDIT_ENABLED is set # on integration branch(es): if $BANDIT_ENABLED is set
- if: '$BANDIT_ENABLED && $CI_COMMIT_REF_NAME =~ $INTEG_REF' - if: '$BANDIT_ENABLED == "true" && $CI_COMMIT_REF_NAME =~ $INTEG_REF'
# on non-production, non-integration branches, with $BANDIT_ENABLED set: manual & non-blocking # on non-production, non-integration branches, with $BANDIT_ENABLED set: manual & non-blocking
- if: '$BANDIT_ENABLED' - if: '$BANDIT_ENABLED == "true"'
when: manual when: manual
allow_failure: true allow_failure: true
...@@ -549,11 +549,11 @@ py-safety: ...@@ -549,11 +549,11 @@ py-safety:
- if: $CI_MERGE_REQUEST_ID - if: $CI_MERGE_REQUEST_ID
when: never when: never
# on production branch(es): if $SAFETY_ENABLED is set # on production branch(es): if $SAFETY_ENABLED is set
- if: '$SAFETY_ENABLED && $CI_COMMIT_REF_NAME =~ $PROD_REF' - if: '$SAFETY_ENABLED == "true" && $CI_COMMIT_REF_NAME =~ $PROD_REF'
# on integration branch(es): if $SAFETY_ENABLED is set # on integration branch(es): if $SAFETY_ENABLED is set
- if: '$SAFETY_ENABLED && $CI_COMMIT_REF_NAME =~ $INTEG_REF' - if: '$SAFETY_ENABLED == "true" && $CI_COMMIT_REF_NAME =~ $INTEG_REF'
# on non-production, non-integration branches, with $SAFETY_ENABLED set: manual & non-blocking # on non-production, non-integration branches, with $SAFETY_ENABLED set: manual & non-blocking
- if: '$SAFETY_ENABLED' - if: '$SAFETY_ENABLED == "true"'
when: manual when: manual
allow_failure: true allow_failure: true
...@@ -593,7 +593,7 @@ py-docs: ...@@ -593,7 +593,7 @@ py-docs:
- $DOCS_BUILD_DIR - $DOCS_BUILD_DIR
rules: rules:
# on tags with $DOCS_ENABLED set # on tags with $DOCS_ENABLED set
- if: '$DOCS_ENABLED && $CI_COMMIT_TAG' - if: '$DOCS_ENABLED == "true" && $CI_COMMIT_TAG'
# (manual from master branch): triggers a release (tag creation) # (manual from master branch): triggers a release (tag creation)
py-release: py-release:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment