blob: 84ae83bad83054b747fb6a5bf359d2dd511abc9c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
---
stages:
- linting
- unit_test
- build
- test
- deploy
image: docker:git
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay
# Variables for pytest.gitlab-ci.yml
PYTHON_VERSIONS: "v3.7 v3.8 v3.9 v3.10"
COVERAGE_FILE: sdk-tests-cov.xml
# Variables for Container-Scanning.gitlab-ci.yml
CI_APPLICATION_REPOSITORY: $CI_REGISTRY_IMAGE #/$CI_COMMIT_REF_SLUG
CI_APPLICATION_TAG: $CI_COMMIT_REF_SLUG #$CI_COMMIT_SHA
# Variable for pylint/pydocstyle/SAST/Code-Quality.gitlab-ci.yml
SRC_PATH: '/src'
DOC_PATH: '/docs'
# Variable for SAST
SAST_EXCLUDED_PATHS: "docs,integration_tests,scripts,tests"
SAST_BANDIT_EXCLUDED_PATHS: "docs,integration_tests,scripts,tests"
.before_script_docker: &before_script_docker
before_script:
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
build_master:
stage: build
<<: *before_script_docker
script:
- docker build -t "$CI_REGISTRY_IMAGE:latest" .
- docker push "$CI_REGISTRY_IMAGE:latest"
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
build_testing:
stage: build
<<: *before_script_docker
script:
- docker build -t "$CI_REGISTRY_IMAGE:${CI_COMMIT_REF_SLUG}" .
- docker push "$CI_REGISTRY_IMAGE:${CI_COMMIT_REF_SLUG}"
rules:
- if: '$CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != "master"'
build_stable:
stage: build
<<: *before_script_docker
script:
- docker build -t "$CI_REGISTRY_IMAGE:${CI_COMMIT_TAG}" .
- docker push "$CI_REGISTRY_IMAGE:${CI_COMMIT_TAG}"
rules:
- if: '$CI_COMMIT_TAG'
.integration_tests: &integration_tests
stage: test
variables:
FF_NETWORK_PER_BUILD: 1 # Enable https://docs.gitlab.com/runner/executors/docker.html#network-per-build feature
services:
- name: registry.gitlab.com/orange-opensource/lfn/onap/mock_servers/mock-sdc:develop
alias: sdc.api.fe.simpledemo.onap.org
- name: registry.gitlab.com/orange-opensource/lfn/onap/mock_servers/mock-sdnc:latest
alias: sdnc.api.simpledemo.onap.org
- name: registry.gitlab.com/orange-opensource/lfn/onap/mock_servers/mock-so:latest
alias: so.api.simpledemo.onap.org
- name: registry.gitlab.com/orange-opensource/lfn/onap/mock_servers/mock-aai:latest
alias: aai.api.sparky.simpledemo.onap.org
- name: registry.gitlab.com/orange-opensource/lfn/onap/mock_servers/mock-clamp:develop
alias: clamp.api.simpledemo.onap.org
- name: registry.gitlab.com/orange-opensource/lfn/onap/mock_servers/mock-cds:latest
alias: cds.api.simpledemo.onap.org
- name: registry.gitlab.com/orange-opensource/lfn/onap/mock_servers/mock-msb-k8s:latest
alias: msb.k8s.api.simpledemo.onap.org
- name: registry.gitlab.com/orange-opensource/lfn/onap/mock_servers/mock-dcae/mock-ves:latest
alias: ves.api.simpledemo.onap.org
- name: registry.gitlab.com/orange-opensource/lfn/onap/mock_servers/mock-dmaap:latest
alias: dmaap.api.simpledemo.onap.org
script:
- pip install .
- pip install pytest mock # mock is needed as pytest parse all files before selection
- PYTHONPATH=$PYTHONPATH:integration_tests/ ONAP_PYTHON_SDK_SETTINGS="urls" pytest --verbose -c /dev/null --junitxml=pytest-integration.xml integration_tests
artifacts:
reports:
junit: pytest-*.xml
integration_tests:3.7:
image: python:3.7
<<: *integration_tests
integration_tests:3.8:
image: python:3.8
<<: *integration_tests
integration_tests:3.9:
image: python:3.9
<<: *integration_tests
integration_tests:3.10:
image: python:3.10
<<: *integration_tests
bandit:
image: python:3.10
stage: linting
script:
- pip install -r requirements.txt
- pip3 install bandit
- bandit -r src/onapsdk
pages:
stage: deploy
image:
name: python:3.7
script:
- chmod +x scripts/build_all_branches_in.sh
- scripts/build_all_branches_in.sh
artifacts:
paths:
- public
except:
variables:
- $JOBS_DISABLED
upload:
stage: deploy
image:
name: python:3.8
script:
- pip install -r upload-requirements.txt
- python setup.py sdist bdist_wheel
- twine upload --non-interactive dist/*
rules:
- if: '$CI_COMMIT_TAG'
# https://docs.gitlab.com/ee/update/deprecations.html#dependency-scanning-python-39-and-36-image-deprecation
gemnasium-python-dependency_scanning:
image:
name: registry.gitlab.com/gitlab-org/security-products/analyzers/gemnasium-python:2-python-3.9
include:
- remote: 'https://gitlab.com/Orange-OpenSource/lfn/ci_cd/gitlab-ci-templates/raw/master/pylint.gitlab-ci.yml'
- remote: 'https://gitlab.com/Orange-OpenSource/lfn/ci_cd/gitlab-ci-templates/-/raw/master/pytest.gitlab-ci.yml'
- remote: 'https://gitlab.com/Orange-OpenSource/lfn/ci_cd/gitlab-ci-templates/raw/master/pydocstyle.gitlab-ci.yml'
- remote: 'https://gitlab.com/Orange-OpenSource/lfn/ci_cd/gitlab-ci-templates/raw/master/doc8.gitlab-ci.yml'
- remote: 'https://gitlab.com/Orange-OpenSource/lfn/ci_cd/gitlab-ci-templates/raw/master/pyup.gitlab-ci.yml'
- template: License-Scanning.gitlab-ci.yml
- template: Dependency-Scanning.gitlab-ci.yml
- template: Jobs/Code-Quality.gitlab-ci.yml
- template: SAST.gitlab-ci.yml
- template: Container-Scanning.gitlab-ci.yml
|