Commit 17ff1b24 authored by BorjaEst's avatar BorjaEst
Browse files

1st attempt to add JePL2.0.0 -based CI/CD

parent ca0e1bc0
......@@ -62,6 +62,7 @@ htmlcov/
.coverage
.coverage.*
.cache
.stestr
nosetests.xml
coverage.xml
*.cover
......@@ -69,4 +70,4 @@ coverage.xml
.hypothesis/
.pytest_cache/
cover/
flake8.log
config:
project_repos:
o3skim:
repo: 'https://git.scc.kit.edu/synergy.o3as/o3skim.git'
branch: dev
dockerhub: synergyimk/o3as
dockertag: latest
sqa_criteria:
qc_style:
repos:
o3as:
container: o3skim-testing
tox:
tox_file: /o3skim-testing/tox.ini
testenv:
- pep8
qc_coverage:
repos:
o3as:
container: o3skim-testing
tox:
tox_file: /o3skim-testing/tox.ini
testenv:
- cover
- cobertura
qc_security:
repos:
o3as:
container: o3skim-testing
tox:
tox_file: /o3skim-testing/tox.ini
testenv:
- bandit
#environment:
# LANG: C.UTF-8
timeout: 900
version: "3.6"
services:
o3skim-testing:
image: "indigodatacloud/ci-images:python3.6"
hostname: "o3skim-testing"
volumes:
- type: bind
source: ./o3skim
target: /o3skim-testing
[DEFAULT]
test_path=./tests/
top_dir=./
#!/usr/bin/groovy
@Library(['github.com/indigo-dc/jenkins-pipeline-library@2.0.0']) _
def projectConfig
pipeline {
environment {
registry = "synergyimk/o3skim"
registryCredential = 'dockerhub_id'
}
agent any
stages {
stage('Image build') {
steps {
echo '====================building image===================================='
script { customImage = docker.build(registry) }
}
}
stage('Unit testing') {
stage('SQA baseline dynamic stages') {
steps {
echo '====================executing unittest================================'
script { customImage.inside("--entrypoint=''") {sh 'tox'} }
script {
projectConfig = pipelineConfig()
buildStages(projectConfig)
}
}
}
stage('Docker-hub upload') {
steps {
echo '====================uploading docker-hub=============================='
script { docker.withRegistry('', registryCredential) { customImage.push() } }
post {
cleanup {
cleanWs()
}
}
}
}
}
\ No newline at end of file
}
# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
[tox]
envlist = py36
minversion = 1.6
envlist = py36,pep8
skipsdist = True
[testenv]
deps =
pytest
usedevelop = True
basepython = python3
whitelist_externals = find
install_command = pip install -U {opts} {packages}
# use en_US.UTF-8 as C.UTF-8 doesn't exist in RHEL7
setenv =
VIRTUAL_ENV={envdir}
LC_ALL=C.UTF-8
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=160
deps = -r{toxinidir}/test-requirements.txt
commands = find . -type f -name "*.pyc" -delete
[testenv:cover]
# TODO(stephenfin): Remove the PYTHON hack below in favour of a [coverage]
# section once we rely on coverage 4.3+
#
# https://bitbucket.org/ned/coveragepy/issues/519/
envdir = {toxworkdir}/shared
setenv =
{[testenv]setenv}
PYTHON=coverage run --source o3skim --parallel-mode
commands =
{[testenv]commands}
coverage erase
stestr -v run --serial {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:py36]
# TODO(efried): Remove this once https://github.com/tox-dev/tox/issues/425 is fixed.
basepython = python3.6
commands =
pytest
{[testenv]commands}
stestr -v run --serial {posargs}
[testenv:pep8]
envdir = {toxworkdir}/shared
commands = - flake8 --format=pylint --output-file=flake8.log
[testenv:bandit]
envdir = {toxworkdir}/shared
commands = bandit -r o3skim -x tests -s B110,B410
[flake8]
# H803 skipped on purpose per list discussion.
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
ignore = E123,E125,H803,H405
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
[testenv:cobertura]
commands = py.test --cov=o3skim --cov-report=xml --cov-report=term-missing tests
[testenv:bandit-report]
#basepython = python2.7
commands =
- mkdir /tmp/bandit
- bandit -r o3skim -x tests -s B110,B410 -f html -o /tmp/bandit/index.html
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment