Skip to content

Commit

Permalink
fix(core): regression in migration after git refactoring (#2450)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-alisafaee committed Nov 8, 2021
1 parent c97d563 commit 7366c11
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test_deploy.yml
Expand Up @@ -628,7 +628,7 @@ jobs:
publish-chart:
runs-on: ubuntu-latest
needs: [docs-linux, test-linux-cli, test-linux-core, test-linux-service, test-macos-cli, test-macos-core, test-macos-service, test-linux-integration, test-macos-integration]
needs: [docs-linux, test-linux-cli, test-linux-core, test-linux-service, test-macos-cli, test-macos-core, test-macos-service, test-linux-integration, test-linux-integration-service, test-macos-integration]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v2
Expand All @@ -655,7 +655,7 @@ jobs:

coveralls-final:
name: Aggregate coveralls data
needs: [test-linux-cli, test-linux-core, test-linux-service, test-linux-api, test-linux-integration]
needs: [test-linux-cli, test-linux-core, test-linux-service, test-linux-api, test-linux-integration, test-linux-integration-service]
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion renku/core/management/migrations/m_0005__2_cwl.py
Expand Up @@ -475,7 +475,7 @@ def find_previous_commit(self, path, revision="HEAD"):

def find_from_client(path, revision):
try:
return self.client.repository.get_previous_commit(paths=path, revision=revision, full_history=True)
return self.client.repository.get_previous_commit(path=path, revision=revision, full_history=True)
except errors.GitCommitNotFoundError:
communication.warn(f"Cannot find previous commit for {path} from {str(revision)}")
return revision
Expand Down
Expand Up @@ -506,7 +506,7 @@ def _convert_invalidated_entity(entity: old_schema.Entity, client) -> Optional[E
assert not isinstance(entity, old_schema.Collection), f"Collection passed as invalidated: {entity._id}"

commit_sha = _extract_commit_sha(entity_id=entity._id)
commit = client.repository.get_previous_commit(revision=commit_sha, paths=entity.path)
commit = client.repository.get_previous_commit(revision=commit_sha, path=entity.path)
revision = commit.hexsha
checksum = client.repository.get_object_hash(revision=revision, path=entity.path)
if not checksum:
Expand Down
8 changes: 6 additions & 2 deletions renku/core/metadata/repository.py
Expand Up @@ -286,12 +286,16 @@ def get_attributes(self, *paths: Union[Path, str]) -> Dict[str, Dict[str, str]]:

return attributes

def get_previous_commit(self, path: Union[Path, str], revision: Union["Commit", str] = None) -> Optional["Commit"]:
def get_previous_commit(
self, path: Union[Path, str], revision: Union["Commit", str] = None, full_history: bool = False
) -> Optional["Commit"]:
"""Return a previous commit for a given path starting from ``revision``."""
revision = revision or "HEAD"
assert isinstance(revision, (Commit, str)), f"'revision' must be Commit/str not '{type(revision)}'"

commit = _find_previous_commit_helper(repository=self, path=path, revision=str(revision))
commit = _find_previous_commit_helper(
repository=self, path=path, revision=str(revision), full_history=full_history
)
if not commit:
raise errors.GitCommitNotFoundError(f"Cannot find previous commit for '{path}' from '{revision}'")
return commit
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -91,6 +91,7 @@ def run(self):
"black==21.9b0",
"check-manifest>=0.37,<0.47",
"coverage>=4.5.3,<5.6",
"cwl-utils>=0.12",
"fakeredis>=1.4.1,<1.6.2",
"flake8>=3.8,<3.10",
"flaky==3.7.0",
Expand Down Expand Up @@ -165,7 +166,6 @@ def run(self):
"cryptography>=3.4.1,<3.5",
"cwlgen>=0.4.0,<=0.4.2",
"cwltool==3.1.20210922203925",
"cwl-utils>=0.10",
"deepmerge==0.3.0",
"environ_config>=18.2.0,<21.3.0",
"filelock>=3.0.0,<=3.0.12",
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/test_datasets.py
Expand Up @@ -881,7 +881,7 @@ def test_datasets_ls_files_correct_commit(runner, client, directory_tree):
"""Test ls-files shows the size stored in git and not the current file size."""
assert 0 == runner.invoke(cli, ["dataset", "add", "my-dataset", "-c", str(directory_tree / "file1")]).exit_code

commit = client.repository.get_previous_commit(paths=client.path / DATA_DIR / "my-dataset" / "file1")
commit = client.repository.get_previous_commit(path=client.path / DATA_DIR / "my-dataset" / "file1")

# check include / exclude filters
result = runner.invoke(cli, ["dataset", "ls-files", "--columns=commit,path"])
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/test_workflow.py
Expand Up @@ -26,7 +26,7 @@
import pexpect
import pyte
import pytest
from cwl_utils import parser_v1_2 as cwlgen
from cwl_utils.parser import cwl_v1_2 as cwlgen

from renku.cli import cli
from renku.core.metadata.database import Database
Expand Down
Binary file modified tests/data/old-workflows-complicated-v0.10.3.git.tar.gz
Binary file not shown.

0 comments on commit 7366c11

Please sign in to comment.