Skip to content
Snippets Groups Projects

SAST implementation

Merged Mayr, Hannes requested to merge dev into main
1 file
+ 31
61
Compare changes
  • Side-by-side
  • Inline
+ 31
61
# This file is a template, and might need editing before it works on your project.
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/tags/
image: python:latest
image: python:latest
stages:
stages:
- linting
- linting
- testing
- testing
- docs
- docs
 
- test
# Change pip's cache directory to be inside the project directory since we can
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
# only cache local items.
variables:
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
# - .cache/pip #
# - venv/ #
before_script:
before_script:
- python --version # For debugging
- python --version # For debugging
- pip install -r requirements.txt # install dependencies from file
- pip install -r requirements.txt # install dependencies from file
# - pip install virtualenv
# - virtualenv venv
# - source venv/bin/activate
PEP8:
PEP8:
stage: linting
stage: linting
script:
script:
- pip install flake8
- pip install flake8
- flake8 --count . # PEP8 linting
- flake8 --count .
Pylint:
Pylint:
stage: linting
stage: linting
# allow_failure: true
script:
script:
- pip install pylint
- pip install pylint
- find . -type f -name '*.py' | xargs pylint -rn --rcfile='plotid/.pylintrc' # Find all python files and check the code with pylint
- find . -type f -name '*.py' | xargs pylint -rn --rcfile='plotid/.pylintrc' # Find all python files and check the code with pylint.
test:
test:
stage: testing
stage: testing
tags:
tags:
- docker
- docker
script:
script:
# - python -m unittest discover -s ./tests/ -p "test*" # deprecated unittest command
- python tests/runner_tests.py
- python tests/runner_tests.py
coverage: "/TOTAL.*\\s+(\\d+\\.\\d+%)$/"
coverage: '/TOTAL.*\s+(\d+\.\d+%)$/'
# - pip install tox flake8 # you can also use tox
# - tox -e py36,flake8
pages:
pages:
stage: docs
stage: docs
script:
script:
@@ -72,17 +41,18 @@ pages:
@@ -72,17 +41,18 @@ pages:
paths:
paths:
- public
- public
rules:
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
- if: "$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH"
- when: manual
- when: manual
sast:
# Commenting out all other stages and jobs
variables:
#run:
SAST_EXCLUDED_PATHS: spec, test, tmp
# script:
stage: test
# - python setup.py bdist_wheel
include:
# # an alternative approach is to install and run:
- template: Security/SAST.gitlab-ci.yml
# - pip install dist/*
# You can override the included template(s) by including variable overrides
# # run the command here
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# artifacts:
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
# paths:
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
# - dist/*.whl
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
# Note that environment variables can be set in several places
 
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
Loading