diff --git a/backend/python/plugins/azuredevops/azuredevops/main.py b/backend/python/plugins/azuredevops/azuredevops/main.py index 966aca974f5..d31b53b3d3a 100644 --- a/backend/python/plugins/azuredevops/azuredevops/main.py +++ b/backend/python/plugins/azuredevops/azuredevops/main.py @@ -51,13 +51,13 @@ def domain_scopes(self, git_repo: GitRepository): name=git_repo.name, url=git_repo.url, forked_from=git_repo.parent_repository_url, - updated_date=git_repo.updated_date, + # updated_date=git_repo.updated_date, ) yield CicdScope( name=git_repo.name, description=git_repo.name, url=git_repo.url, - updatedDate=git_repo.updated_date, + # updatedDate=git_repo.updated_date, ) def remote_scope_groups(self, connection) -> list[RemoteScopeGroup]: diff --git a/backend/python/plugins/azuredevops/azuredevops/streams/builds.py b/backend/python/plugins/azuredevops/azuredevops/streams/builds.py index b24dc1be8eb..da44bc03c4c 100644 --- a/backend/python/plugins/azuredevops/azuredevops/streams/builds.py +++ b/backend/python/plugins/azuredevops/azuredevops/streams/builds.py @@ -62,9 +62,11 @@ def convert(self, b: Build, ctx: Context): type = devops.CICDType.BUILD if ctx.scope_config.deployment_pattern and ctx.scope_config.deployment_pattern.search(b.name): type = devops.CICDType.DEPLOYMENT - environment = devops.CICDEnvironment.TESTING - if ctx.scope_config.production_pattern and ctx.scope_config.production_pattern.search(b.name): - environment = devops.CICDEnvironment.PRODUCTION + + environment = devops.CICDEnvironment.PRODUCTION + if ctx.scope_config.production_pattern is not None and ctx.scope_config.production_pattern.search( + b.name) is None: + environment = "" if b.finish_time: duration_sec = abs(b.finish_time.timestamp() - b.start_time.timestamp()) diff --git a/backend/python/plugins/azuredevops/azuredevops/streams/jobs.py b/backend/python/plugins/azuredevops/azuredevops/streams/jobs.py index 06a6e481a30..dae50ad47cd 100644 --- a/backend/python/plugins/azuredevops/azuredevops/streams/jobs.py +++ b/backend/python/plugins/azuredevops/azuredevops/streams/jobs.py @@ -13,16 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Iterable - from http import HTTPStatus +from typing import Iterable +import pydevlake.domain_layer.devops as devops from azuredevops.api import AzureDevOpsAPI from azuredevops.models import Job, Build, GitRepository from azuredevops.streams.builds import Builds from pydevlake import Context, Substream, DomainType from pydevlake.api import APIException -import pydevlake.domain_layer.devops as devops class Jobs(Substream): @@ -81,12 +80,13 @@ def convert(self, j: Job, ctx: Context) -> Iterable[devops.CICDPipeline]: type = devops.CICDType.BUILD if ctx.scope_config.deployment_pattern and ctx.scope_config.deployment_pattern.search(j.name): type = devops.CICDType.DEPLOYMENT - environment = devops.CICDEnvironment.TESTING - if ctx.scope_config.production_pattern and ctx.scope_config.production_pattern.search(j.name): - environment = devops.CICDEnvironment.PRODUCTION + environment = devops.CICDEnvironment.PRODUCTION + if ctx.scope_config.production_pattern is not None and ctx.scope_config.production_pattern.search( + j.name) is None: + environment = "" if j.finish_time: - duration_sec = abs(j.finish_time.timestamp()-j.start_time.timestamp()) + duration_sec = abs(j.finish_time.timestamp() - j.start_time.timestamp()) else: duration_sec = float(0.0) @@ -95,10 +95,10 @@ def convert(self, j: Job, ctx: Context) -> Iterable[devops.CICDPipeline]: name=j.name, pipeline_id=j.build_id, status=status, - original_status = str(j.state), - original_result = str(j.result), + original_status=str(j.state), + original_result=str(j.result), created_date=j.start_time, - started_date =j.start_time, + started_date=j.start_time, finished_date=j.finish_time, result=result, type=type, diff --git a/backend/python/plugins/azuredevops/azuredevops/streams/pull_requests.py b/backend/python/plugins/azuredevops/azuredevops/streams/pull_requests.py index bebb7bed872..77cc118b050 100644 --- a/backend/python/plugins/azuredevops/azuredevops/streams/pull_requests.py +++ b/backend/python/plugins/azuredevops/azuredevops/streams/pull_requests.py @@ -64,7 +64,7 @@ def convert(self, pr: GitPullRequest, ctx): merged_date=pr.closed_date, closed_date=pr.closed_date, type=pr.type, - component="", # not supported + component="", # not supported merge_commit_sha=pr.merge_commit_sha, head_ref=pr.source_ref_name, base_ref=pr.target_ref_name, diff --git a/backend/python/pydevlake/pydevlake/domain_layer/devops.py b/backend/python/pydevlake/pydevlake/domain_layer/devops.py index 3ac97feddb0..80630e17031 100644 --- a/backend/python/pydevlake/pydevlake/domain_layer/devops.py +++ b/backend/python/pydevlake/pydevlake/domain_layer/devops.py @@ -66,7 +66,7 @@ class CICDPipeline(DomainModel, table=True): queued_duration_sec: Optional[float] type: Optional[CICDType] - environment: Optional[str] + environment: Optional[CICDEnvironment] class CiCDPipelineCommit(NoPKModel, table=True):