Skip to content
Snippets Groups Projects

Add gitlate ultimate scanner

Open Chad Leong requested to merge add-gitlab-ultimate into main
1 file
+ 85
82
Compare changes
  • Side-by-side
  • Inline
+ 85
82
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/tags/
# image: python:latest
@@ -6,9 +5,9 @@
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
LD_LIBRARY_PATH: "$CI_PROJECT_DIR/build"
DEFAULT_PYTHON: "3.9"
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
LD_LIBRARY_PATH: "$CI_PROJECT_DIR/build"
DEFAULT_PYTHON: "3.9"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
@@ -16,96 +15,100 @@ variables:
# 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
paths:
- .cache/pip
include:
- project: "osdu/platform/ci-cd-pipelines"
file: "scanners/gitlab-ultimate.yml"
stages:
- build
- test
- staging
- production
- build
- test
- staging
- production
before_script:
# - python -V # Print out python version for debugging
# - python -V # Print out python version for debugging
build:info:
stage: build
image: docker.io/python:$DEFAULT_PYTHON
script:
# Print out python version for debugging
- python -V
# Print out version from source code
- ver=`cat src/osducli/__init__.py | grep __VERSION__ | grep -Eo [0-9]+\(.[0-9]+\)*`
- echo $ver
stage: build
image: docker.io/python:$DEFAULT_PYTHON
script:
# Print out python version for debugging
- python -V
# Print out version from source code
- ver=`cat src/osducli/__init__.py | grep __VERSION__ | grep -Eo [0-9]+\(.[0-9]+\)*`
- echo $ver
build:build:
stage: build
image: docker.io/python:$DEFAULT_PYTHON
script:
# Install additional deploy build dependencies
- pip install setuptools wheel
- python setup.py sdist bdist_wheel
artifacts:
paths:
- dist
stage: build
image: docker.io/python:$DEFAULT_PYTHON
script:
# Install additional deploy build dependencies
- pip install setuptools wheel
- python setup.py sdist bdist_wheel
artifacts:
paths:
- dist
tox:
stage: test
image: docker.io/python:$PYTHON_VERSIONS
parallel:
matrix:
- PYTHON_VERSIONS: [ "3.8-slim", "3.9-slim", "3.10-slim" ]
stage: test
image: docker.io/python:$PYTHON_VERSIONS
parallel:
matrix:
- PYTHON_VERSIONS: ["3.8-slim", "3.9-slim", "3.10-slim"]
script:
# Print out python version for debugging
- python -V
# Upgrade pip
- python -m pip install --upgrade pip
# Install the package
- pip install --force-reinstall -f dist osducli
# Development dependencies
- pip install --force-reinstall -r requirements-dev.txt
- tox -e py
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: nose2-junit.xml
script:
# Print out python version for debugging
- python -V
# Upgrade pip
- python -m pip install --upgrade pip
# Install the package
- pip install --force-reinstall -f dist osducli
# Development dependencies
- pip install --force-reinstall -r requirements-dev.txt
- tox -e py
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: nose2-junit.xml
deploy-to-staging:
stage: staging
image: docker.io/python:$DEFAULT_PYTHON
dependencies:
- build:build
variables:
TWINE_USERNAME : __token__
TWINE_PASSWORD : $TEST_PYPI_API_KEY
TWINE_REPOSITORY : testpypi
before_script:
# Get the source version and check it matches the tag version
- ver=`cat src/osducli/__init__.py | grep __VERSION__ | grep -Eo [0-9]+\(.[0-9]+\)*`
- echo $ver
- echo $CI_COMMIT_TAG
- if [[ "v$ver" != "$CI_COMMIT_TAG" ]]; then echo "Source code and tag versions don't match" exit 1; fi
script:
- pip install twine
- python -m twine upload dist/*
only:
- /^v[0-9]+(?:.[0-9]+)*$/ # run on tagged releases
stage: staging
image: docker.io/python:$DEFAULT_PYTHON
dependencies:
- build:build
variables:
TWINE_USERNAME: __token__
TWINE_PASSWORD: $TEST_PYPI_API_KEY
TWINE_REPOSITORY: testpypi
before_script:
# Get the source version and check it matches the tag version
- ver=`cat src/osducli/__init__.py | grep __VERSION__ | grep -Eo [0-9]+\(.[0-9]+\)*`
- echo $ver
- echo $CI_COMMIT_TAG
- if [[ "v$ver" != "$CI_COMMIT_TAG" ]]; then echo "Source code and tag versions don't match" exit 1; fi
script:
- pip install twine
- python -m twine upload dist/*
only:
- /^v[0-9]+(?:.[0-9]+)*$/ # run on tagged releases
deploy-to-production:
stage: production
image: docker.io/python:$DEFAULT_PYTHON
dependencies:
- build:build
variables:
TWINE_USERNAME : __token__
TWINE_PASSWORD : $PYPI_API_KEY
TWINE_REPOSITORY : pypi
script:
- pip install twine
- python -m twine upload dist/*
when: manual
only:
- /^v[0-9]+(?:.[0-9]+)*$/ # run on tagged releases
stage: production
image: docker.io/python:$DEFAULT_PYTHON
dependencies:
- build:build
variables:
TWINE_USERNAME: __token__
TWINE_PASSWORD: $PYPI_API_KEY
TWINE_REPOSITORY: pypi
script:
- pip install twine
- python -m twine upload dist/*
when: manual
only:
- /^v[0-9]+(?:.[0-9]+)*$/ # run on tagged releases
Loading