Skip to content

Commit

Permalink
tmp ref attempt wip
Browse files Browse the repository at this point in the history
  • Loading branch information
alafanechere committed Apr 27, 2023
1 parent 2783502 commit 0950d39
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def __init__(
is_local: bool,
git_branch: str,
git_revision: str,
modified_files: List[str],
gha_workflow_run_url: Optional[str] = None,
pipeline_start_timestamp: Optional[int] = None,
ci_context: Optional[str] = None,
Expand All @@ -77,6 +78,7 @@ def __init__(
is_local (bool): Whether the context is for a local run or a CI run.
git_branch (str): The current git branch name.
git_revision (str): The current git revision, commit hash.
modified_files (List[str]): The list of modified files for this context.
gha_workflow_run_url (Optional[str], optional): URL to the github action workflow run. Only valid for CI run. Defaults to None.
pipeline_start_timestamp (Optional[int], optional): Timestamp at which the pipeline started. Defaults to None.
ci_context (Optional[str], optional): Pull requests, workflow dispatch or nightly build. Defaults to None.
Expand All @@ -85,13 +87,13 @@ def __init__(
self.is_local = is_local
self.git_branch = git_branch
self.git_revision = git_revision
self.modified_files = modified_files
self.gha_workflow_run_url = gha_workflow_run_url
self.pipeline_start_timestamp = pipeline_start_timestamp
self.created_at = datetime.utcnow()
self.ci_context = ci_context
self.state = ContextState.INITIALIZED
self.is_ci_optional = is_ci_optional

self.logger = logging.getLogger(self.pipeline_name)
self.dagger_client = None
self._report = None
Expand Down Expand Up @@ -249,6 +251,7 @@ def __init__(
is_local (bool): Whether the context is for a local run or a CI run.
git_branch (str): The current git branch name.
git_revision (str): The current git revision, commit hash.
modified_files (List[str]): The list of modified files for this context.
use_remote_secrets (bool, optional): Whether to download secrets for GSM or use the local secrets. Defaults to True.
connector_acceptance_test_image (Optional[str], optional): The image to use to run connector acceptance tests. Defaults to DEFAULT_CONNECTOR_ACCEPTANCE_TEST_IMAGE.
gha_workflow_run_url (Optional[str], optional): URL to the github action workflow run. Only valid for CI run. Defaults to None.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

from abc import ABC, abstractmethod
from functools import cached_property
from pathlib import Path
from typing import ClassVar, Optional

import asyncer
import requests
import yaml
from ci_connector_ops.pipelines.actions import environments
from ci_connector_ops.pipelines.bases import PytestStep, Step, StepResult, StepStatus
from ci_connector_ops.pipelines.contexts import CIContext
from ci_connector_ops.pipelines.contexts import CIContext, PipelineContext
from ci_connector_ops.pipelines.utils import METADATA_FILE_NAME
from ci_connector_ops.utils import DESTINATION_DEFINITIONS_FILE_PATH, SOURCE_DEFINITIONS_FILE_PATH
from dagger import File
Expand All @@ -26,9 +27,14 @@ class VersionCheck(Step, ABC):
GITHUB_URL_PREFIX_FOR_CONNECTORS = "https://raw.githubusercontent.com/airbytehq/airbyte/master/airbyte-integrations/connectors"
failure_message: ClassVar

def __init__(self, context: PipelineContext, metadata_path: Path) -> None:
super().__init__(context)
self.current_metadata = yaml.safe_load(metadata_path.read_text())["data"]
self.connector_technical_name = self.metadata["dockerRepository"].split("/")[-1]

@property
def github_master_metadata_url(self):
return f"{self.GITHUB_URL_PREFIX_FOR_CONNECTORS}/{self.context.connector.technical_name}/{METADATA_FILE_NAME}"
return f"{self.GITHUB_URL_PREFIX_FOR_CONNECTORS}/{self.connector_technical_name}/{METADATA_FILE_NAME}"

@cached_property
def master_metadata(self) -> dict:
Expand All @@ -43,7 +49,7 @@ def master_connector_version(self) -> version.Version:

@property
def current_connector_version(self) -> version.Version:
return version.parse(str(self.context.metadata["dockerImageTag"]))
return version.parse(str(self.current_metadata["dockerImageTag"]))

@property
def success_result(self) -> StepResult:
Expand Down

0 comments on commit 0950d39

Please sign in to comment.