Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document adding a job to GitLab CICD #1086

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions doc/source/start.rst
Expand Up @@ -121,3 +121,24 @@ Then run ``pre-commit install`` and you're ready to go.
.. _pre-commit: https://pre-commit.com/
.. _have it installed: https://pre-commit.com/#install
.. _`real git tag/revision`: https://github.com/PyCQA/bandit/releases

GitLab CI/CD integration
------------------

To integrate Bandit with `GitLab continuous integration and delivery (CI/CD)`_,
use a job like so:

.. code-block:: yaml

bandit:
cache: {}
image:
name: cytopia/bandit:1-py3.10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Good addition. Looking at this though, makes me realise we should really start producing our own images, just in case cytopia/bandit:1-py3.10 were to fall into bad hands. I will raise an issue, but until then let's keep this PR open.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, @lukehinds! Thanks for considering this contribution. Yes, I also noticed that using the cytopia image is suboptimal and first-party Docker images would be preferable. By adding this job to the documentation, users might get encouraged to trust the source of the image. I have subscribed to the issue about creating such an image, so I can update this PR with the image name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

entrypoint: [""]
script:
- bandit --configfile pyproject.toml -r my_package/
stage: lint_static

> **NOTE**: Adapt the package name from `my_package` to your package name.

.. _GitLab continuous integration and delivery (CI/CD): https://docs.gitlab.com/ee/ci/