diff --git a/.github/workflows/retest_all.yaml b/.github/workflows/retest_all.yaml new file mode 100644 index 00000000..c8ee27f7 --- /dev/null +++ b/.github/workflows/retest_all.yaml @@ -0,0 +1,41 @@ +name: retest all bioimageio resources adding to their logs + +on: workflow_dispatch +concurrency: retest + +jobs: + setup: + runs-on: ubuntu-latest + outputs: + matrix: ${{steps.get_matrix.outputs.matrix}} + + steps: + - run: wget ${{vars.S3_HOST}}/${{vars.S3_BUCKET}}/${{vars.S3_FOLDER}}/collection.json + - shell: python + id: get_matrix + run: | + import json, os + + with open("collection.json") as f: + collection = json.load(f) + + published = [{"id": entry["id"], "v": entry["version"]} for entry in collection["collection"]] + matrix = {"include": published} + with open(os.environ["GITHUB_OUTPUT"], "a") as f: + print(f"matrix={matrix}", file=f) + + test: + needs: setup + strategy: + matrix: ${{fromJson(needs.setup.outputs.matrix)}} + uses: bioimage-io/collection/.github/workflows/test_call.yaml@main + with: + resource_id: ${{matrix.id}} + version: ${{matrix.v}} + conclude: 'no' + S3_HOST: ${{vars.S3_HOST}} + S3_BUCKET: ${{vars.S3_BUCKET}} + S3_FOLDER: ${{vars.S3_FOLDER}} + secrets: inherit + +# TODO: call emailer diff --git a/.github/workflows/test_call.yaml b/.github/workflows/test_call.yaml index ad958ed3..592eec6a 100644 --- a/.github/workflows/test_call.yaml +++ b/.github/workflows/test_call.yaml @@ -11,6 +11,11 @@ on: description: "Version number prefixed with 'staged/', e.g. 'staged/1' (testing published versions again is not (yet) implemented)" required: true type: string + conclude: + description: "Wether or not to trigger a status update based on test results" + required: false + default: 'yes' + type: string S3_HOST: required: true type: string @@ -91,7 +96,7 @@ jobs: conclude: needs: [validate_format, test] - if: always() # run even if test job fails + if: (inputs.conclude == 'yes') && always() # run even if test job fails runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/bioimageio_collection_backoffice/_backoffice.py b/bioimageio_collection_backoffice/_backoffice.py index 6ff12823..be43baad 100644 --- a/bioimageio_collection_backoffice/_backoffice.py +++ b/bioimageio_collection_backoffice/_backoffice.py @@ -53,10 +53,6 @@ def stage(self, resource_id: str, package_url: str): def validate_format(self, resource_id: str, version: str): """validate a (staged) resource version's bioimageio.yaml""" rv = get_remote_resource_version(self.client, resource_id, version) - if isinstance(rv, PublishedVersion): - logger.error("Revalidation of published resources is not implemented") - return - dynamic_test_cases, conda_envs = validate_format(rv) set_gh_actions_outputs( has_dynamic_test_cases=bool(dynamic_test_cases), diff --git a/bioimageio_collection_backoffice/generate_collection_json.py b/bioimageio_collection_backoffice/generate_collection_json.py index 7ce3155d..e5cf616d 100644 --- a/bioimageio_collection_backoffice/generate_collection_json.py +++ b/bioimageio_collection_backoffice/generate_collection_json.py @@ -109,6 +109,7 @@ def maybe_swap_with_thumbnail( entry["nickname_icon"] = entry["id_emoji"] entry["entry_source"] = client.get_file_url(rdf_s3_path) entry["rdf_source"] = entry["entry_source"] + entry["version"] = v entry["versions"] = versions return entry diff --git a/bioimageio_collection_backoffice/validate_format.py b/bioimageio_collection_backoffice/validate_format.py index 32294b4a..2c030f7e 100644 --- a/bioimageio_collection_backoffice/validate_format.py +++ b/bioimageio_collection_backoffice/validate_format.py @@ -11,7 +11,7 @@ from ruyaml import YAML from typing_extensions import assert_never -from .remote_resource import StagedVersion +from .remote_resource import PublishedVersion, StagedVersion from .s3_structure.log import BioimageioLog, Logs yaml = YAML(typ="safe") @@ -218,12 +218,14 @@ def prepare_dynamic_test_cases( return validation_cases, conda_envs -def validate_format(staged: StagedVersion): - if not staged.exists(): - raise ValueError(f"{staged} not found") +def validate_format(rv: Union[StagedVersion, PublishedVersion]): + if not rv.exists(): + raise ValueError(f"{rv} not found") - staged.set_testing_status("Validating RDF format") - rdf_source = staged.rdf_url + if isinstance(rv, StagedVersion): + rv.set_testing_status("Validating RDF format") + + rdf_source = rv.rdf_url rd = load_description(rdf_source, format_version="discover") if not isinstance(rd, InvalidDescr): rd.validation_summary.add_detail( @@ -251,15 +253,15 @@ def validate_format(staged: StagedVersion): rd = rd_latest rd.validation_summary.status = "passed" # passed in 'discover' mode if not isinstance(rd, InvalidDescr) and rd.version is not None: - published = staged.get_versions().published - if str(rd.version) in {v.sem_ver for v in published.values()}: - error = ErrorEntry( - loc=("version",), - msg=f"Trying to publish version {rd.version} again!", - type="error", - ) - else: - error = None + error = None + if isinstance(rv, StagedVersion): + published = rv.get_versions().published + if str(rd.version) in {v.sem_ver for v in published.values()}: + error = ErrorEntry( + loc=("version",), + msg=f"Trying to publish version {rd.version} again!", + type="error", + ) rd.validation_summary.add_detail( ValidationDetail( @@ -270,5 +272,5 @@ def validate_format(staged: StagedVersion): ) summary = rd.validation_summary - staged.extend_log(Logs(bioimageio_spec=[BioimageioLog(log=summary)])) + rv.extend_log(Logs(bioimageio_spec=[BioimageioLog(log=summary)])) return dynamic_test_cases, conda_envs