Skip to content

Commit de79bae

Browse files
ci: adding fossa scan to workflow (#115)
1 parent ba01a54 commit de79bae

File tree

66 files changed

+1770
-1792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1770
-1792
lines changed

.fossa.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 3
2+
server: https://app.fossa.com
3+
4+
project:
5+
id: "addonfactory-cloudconnect-library"
6+
team: "TA-Automation"

.github/workflows/build-test-release.yml

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,29 @@ on:
1111
branches: [main, develop]
1212

1313
jobs:
14-
compliance-dependencies:
15-
name: Compliance Dependencies
14+
fossa-scan:
15+
continue-on-error: true
1616
runs-on: ubuntu-latest
17-
1817
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v2
21-
- name: ort-action
22-
uses: splunk/[email protected]
23-
id: ort-action
24-
with:
25-
UsePython3: "3.7"
26-
- name: ort-action-artifacts-reports
27-
uses: actions/upload-artifact@v2
28-
with:
29-
name: analysis-reports
30-
path: |
31-
.ort/reports/*
32-
if: always()
33-
- name: ort-action-artifacts-analyzer
18+
- uses: actions/checkout@v3
19+
- name: run fossa anlyze and create report
20+
run: |
21+
curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install-latest.sh | bash
22+
fossa analyze --debug
23+
fossa report attribution --format text > /tmp/THIRDPARTY
24+
env:
25+
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}
26+
- name: upload THIRDPARTY file
3427
uses: actions/upload-artifact@v2
3528
with:
36-
name: analysis-analyzer
37-
path: |
38-
.ort/analyzer/*
39-
if: always()
29+
name: THIRDPARTY
30+
path: /tmp/THIRDPARTY
31+
- name: run fossa test
32+
run: |
33+
fossa test --debug
34+
env:
35+
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}
36+
4037
compliance-copyrights:
4138
name: Compliance Copyright Headers
4239
runs-on: ubuntu-latest
@@ -140,11 +137,10 @@ jobs:
140137
build:
141138
name: Build Release
142139
needs:
143-
#- lint
144-
#- test-unit
140+
- test-unit
145141
- review_secrets
146142
- compliance-copyrights
147-
- compliance-dependencies
143+
- fossa-scan
148144
runs-on: ubuntu-latest
149145
steps:
150146
- uses: actions/checkout@v2
@@ -162,10 +158,9 @@ jobs:
162158
poetry build
163159
- uses: actions/download-artifact@v2
164160
with:
165-
name: analysis-reports
166-
path: /tmp/analysis-reports
161+
name: THIRDPARTY
167162
- name: Update Notices
168-
run: cp -f /tmp/analysis-reports/NOTICE_summary NOTICE
163+
run: cp -f THIRDPARTY NOTICE
169164
- name: Semantic Release
170165
uses: cycjimmy/[email protected]
171166
with:

.pre-commit-config.yaml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,13 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
exclude: (^test/functional|^examples)
1716
repos:
18-
- repo: https://github.com/asottile/pyupgrade
19-
rev: v2.29.1
17+
- repo: https://github.com/pre-commit/pre-commit-hooks
18+
rev: v4.2.0
2019
hooks:
21-
- id: pyupgrade
22-
args: [--py37-plus]
20+
- id: check-merge-conflict
21+
- id: debug-statements
2322
- repo: https://github.com/psf/black
24-
rev: 21.11b1
23+
rev: 22.3.0
2524
hooks:
2625
- id: black
27-
- repo: https://github.com/PyCQA/isort
28-
rev: 5.10.1
29-
hooks:
30-
- id: isort

cloudconnectlib/core/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def _retry_send_request_if_needed(self, uri, method="GET", headers=None, body=No
263263
status = resp.status_code
264264

265265
if self._is_need_retry(status, i, retries):
266-
delay = 2 ** i
266+
delay = 2**i
267267
_logger.warning(
268268
"The response status=%s of request which url=%s and"
269269
" method=%s. Retry after %s seconds.",

examples/1.0/snow_helsinki/Splunk_TA_snow/bin/splunk_ta_snow_import_declare.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,3 @@
1313
new_paths = [path for path in sys.path if not pattern.search(path) or ta_name in path]
1414
new_paths.insert(0, os.path.sep.join([os.path.dirname(__file__), ta_lib_name]))
1515
sys.path = new_paths
16-
17-

examples/1.0/snow_helsinki/Splunk_TA_snow/bin/splunk_ta_snow_rh_account.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import re
3+
34
ta_name = os.path.basename(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
45
ta_lib_name = re.sub("[^\w]+", "_", ta_name.lower())
56
__import__(ta_lib_name + "_import_declare")
@@ -14,33 +15,23 @@
1415

1516

1617
fields = [
17-
1818
field.RestField(
19-
'username',
20-
required=True,
21-
encrypted=False,
22-
default=None,
23-
validator=None
24-
),
25-
19+
"username", required=True, encrypted=False, default=None, validator=None
20+
),
2621
field.RestField(
27-
'password',
28-
required=True,
29-
encrypted=False,
30-
default=None,
31-
validator=None
32-
)
22+
"password", required=True, encrypted=False, default=None, validator=None
23+
),
3324
]
3425
model = RestModel(fields, name=None)
3526

3627

3728
endpoint = SingleModel(
38-
'splunk_ta_snow_account',
29+
"splunk_ta_snow_account",
3930
model,
4031
)
4132

4233

43-
if __name__ == '__main__':
34+
if __name__ == "__main__":
4435
admin_external.handle(
4536
endpoint,
4637
handler=AdminExternalHandler,

examples/1.0/snow_helsinki/Splunk_TA_snow/bin/splunk_ta_snow_rh_settings.py

Lines changed: 19 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import re
3+
34
ta_name = os.path.basename(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
45
ta_lib_name = re.sub("[^\w]+", "_", ta_name.lower())
56
__import__(ta_lib_name + "_import_declare")
@@ -14,81 +15,43 @@
1415

1516

1617
fields_logging = [
17-
1818
field.RestField(
19-
'loglevel',
20-
required=False,
21-
encrypted=False,
22-
default='INFO',
23-
validator=None
19+
"loglevel", required=False, encrypted=False, default="INFO", validator=None
2420
)
2521
]
26-
model_logging = RestModel(fields_logging, name='logging')
22+
model_logging = RestModel(fields_logging, name="logging")
2723

2824

2925
fields_proxy = [
30-
3126
field.RestField(
32-
'proxy_enabled',
33-
required=False,
34-
encrypted=False,
35-
default=None,
36-
validator=None
37-
),
38-
27+
"proxy_enabled", required=False, encrypted=False, default=None, validator=None
28+
),
3929
field.RestField(
40-
'proxy_type',
41-
required=False,
42-
encrypted=False,
43-
default='http',
44-
validator=None
45-
),
46-
30+
"proxy_type", required=False, encrypted=False, default="http", validator=None
31+
),
4732
field.RestField(
48-
'proxy_url',
49-
required=False,
50-
encrypted=False,
51-
default=None,
52-
validator=None
53-
),
54-
33+
"proxy_url", required=False, encrypted=False, default=None, validator=None
34+
),
5535
field.RestField(
56-
'proxy_port',
57-
required=False,
58-
encrypted=False,
59-
default=None,
60-
validator=None
61-
),
62-
36+
"proxy_port", required=False, encrypted=False, default=None, validator=None
37+
),
6338
field.RestField(
64-
'proxy_username',
65-
required=False,
66-
encrypted=False,
67-
default=None,
68-
validator=None
69-
),
70-
39+
"proxy_username", required=False, encrypted=False, default=None, validator=None
40+
),
7141
field.RestField(
72-
'proxy_password',
73-
required=False,
74-
encrypted=True,
75-
default=None,
76-
validator=None
77-
)
42+
"proxy_password", required=False, encrypted=True, default=None, validator=None
43+
),
7844
]
79-
model_proxy = RestModel(fields_proxy, name='proxy')
45+
model_proxy = RestModel(fields_proxy, name="proxy")
8046

8147

8248
endpoint = MultipleModel(
83-
'splunk_ta_snow_settings',
84-
models=[
85-
model_logging,
86-
model_proxy
87-
],
49+
"splunk_ta_snow_settings",
50+
models=[model_logging, model_proxy],
8851
)
8952

9053

91-
if __name__ == '__main__':
54+
if __name__ == "__main__":
9255
admin_external.handle(
9356
endpoint,
9457
handler=AdminExternalHandler,

examples/1.0/snow_helsinki/Splunk_TA_snow/bin/splunk_ta_snow_rh_snow_inputs.py

Lines changed: 15 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import re
3+
34
ta_name = os.path.basename(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
45
ta_lib_name = re.sub("[^\w]+", "_", ta_name.lower())
56
__import__(ta_lib_name + "_import_declare")
@@ -14,65 +15,35 @@
1415

1516

1617
fields = [
17-
1818
field.RestField(
19-
'account',
20-
required=False,
21-
encrypted=False,
22-
default=None,
23-
validator=None
24-
),
25-
19+
"account", required=False, encrypted=False, default=None, validator=None
20+
),
2621
field.RestField(
27-
'interval',
28-
required=False,
29-
encrypted=False,
30-
default='60',
31-
validator=None
32-
),
33-
22+
"interval", required=False, encrypted=False, default="60", validator=None
23+
),
3424
field.RestField(
35-
'snow_host',
36-
required=False,
37-
encrypted=False,
38-
default=None,
39-
validator=None
40-
),
41-
25+
"snow_host", required=False, encrypted=False, default=None, validator=None
26+
),
4227
field.RestField(
43-
'sysparm_limit',
44-
required=False,
45-
encrypted=False,
46-
default=None,
47-
validator=None
48-
),
49-
28+
"sysparm_limit", required=False, encrypted=False, default=None, validator=None
29+
),
5030
field.RestField(
51-
'since_when',
52-
required=False,
53-
encrypted=False,
54-
default=None,
55-
validator=None
56-
),
57-
31+
"since_when", required=False, encrypted=False, default=None, validator=None
32+
),
5833
field.RestField(
59-
'table_name',
60-
required=False,
61-
encrypted=False,
62-
default=None,
63-
validator=None
64-
)
34+
"table_name", required=False, encrypted=False, default=None, validator=None
35+
),
6536
]
6637
model = RestModel(fields, name=None)
6738

6839

6940
endpoint = DataInputModel(
70-
'snow_inputs',
41+
"snow_inputs",
7142
model,
7243
)
7344

7445

75-
if __name__ == '__main__':
46+
if __name__ == "__main__":
7647
admin_external.handle(
7748
endpoint,
7849
handler=AdminExternalHandler,

0 commit comments

Comments
 (0)