-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathuploadws.py
33 lines (26 loc) · 1.08 KB
/
uploadws.py
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
# SPDX-FileCopyrightText: Copyright The Linux Foundation
# SPDX-FileType: SOURCE
# SPDX-License-Identifier: Apache-2.0
import os
from datatypes import Status
from manualws import wsAgentForSubproject
from ws.wscfg import isWSEnabled
def doUploadWSForSubproject(cfg, prj, sp):
# make sure the subproject has not already had its code uploaded to WS
# even though wsAgentForSubproject permits a broader range of statuses
# for manual runs
if sp._status != Status.ZIPPEDCODE:
print(f"{prj._name}/{sp._name}: skipping, status is {sp._status.name}, expected ZIPPEDCODE")
return True
if not isWSEnabled(cfg, prj, sp):
print(f"{prj._name}/{sp._name}: skipping, WhiteSource is disabled")
sp._status = Status.UPLOADEDWS
return True
retval = wsAgentForSubproject(cfg, prj, sp)
if not retval:
return False
# once we get here, the WhiteSource agent has run
sp._status = Status.UPLOADEDWS
# and when we return, the runner framework should update the project's
# status to reflect the min of its subprojects
return True