Skip to content

Commit

Permalink
Merge pull request #28 from bioimage-io/sandbox
Browse files Browse the repository at this point in the history
add sandbox flag
  • Loading branch information
FynnBe authored Apr 10, 2024
2 parents 44699bb + 1ef44ee commit 5b41d99
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 13 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/emails_to_chat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ name: forward emails to chat

on:
workflow_call:
inputs:
sandbox:
description: Flag to use sandbox instead
required: false
default: true
type: boolean
# schedule:
# - cron: "0 * * * *" # every hour at minute 0

Expand All @@ -11,7 +17,7 @@ concurrency: forward-emails-to-chat
env:
S3_HOST: ${{vars.S3_HOST}}
S3_BUCKET: ${{vars.S3_BUCKET}}
S3_FOLDER: ${{vars.S3_FOLDER}}
S3_FOLDER: ${{inputs.sandbox && vars.S3_SANDBOX_FOLDER || vars.S3_FOLDER}}
S3_ACCESS_KEY_ID: ${{secrets.S3_ACCESS_KEY_ID}}
S3_SECRET_ACCESS_KEY: ${{secrets.S3_SECRET_ACCESS_KEY}}
MAIL_PASSWORD: ${{secrets.MAIL_PASSWORD}}
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ on:
description: Name of bioimage.io maintainer accepting this resource version
required: true
type: string

sandbox:
description: Flag to publish within sandbox instead
required: false
default: false
type: boolean

concurrency: ${{inputs.resource_id}}

Expand All @@ -29,5 +33,5 @@ jobs:
reviewer: ${{inputs.reviewer}}
S3_HOST: ${{vars.S3_HOST}}
S3_BUCKET: ${{vars.S3_BUCKET}}
S3_FOLDER: ${{vars.S3_FOLDER}}
S3_FOLDER: ${{inputs.sandbox && vars.S3_SANDBOX_FOLDER || vars.S3_FOLDER}}
secrets: inherit
14 changes: 11 additions & 3 deletions .github/workflows/retest_all.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: retest all bioimageio resources adding to their logs

on: workflow_dispatch
on:
workflow_dispatch:
inputs:
sandbox:
description: Flag to use sandbox instead
required: false
default: true
type: boolean

concurrency: retest

jobs:
Expand All @@ -10,7 +18,7 @@ jobs:
matrix: ${{steps.get_matrix.outputs.matrix}}

steps:
- run: wget ${{vars.S3_HOST}}/${{vars.S3_BUCKET}}/${{vars.S3_FOLDER}}/collection.json
- run: wget ${{vars.S3_HOST}}/${{vars.S3_BUCKET}}/${{inputs.sandbox && vars.S3_SANDBOX_FOLDER || vars.S3_FOLDER}}/collection.json
- shell: python
id: get_matrix
run: |
Expand All @@ -35,7 +43,7 @@ jobs:
conclude: 'no'
S3_HOST: ${{vars.S3_HOST}}
S3_BUCKET: ${{vars.S3_BUCKET}}
S3_FOLDER: ${{vars.S3_FOLDER}}
S3_FOLDER: ${{inputs.sandbox && vars.S3_SANDBOX_FOLDER || vars.S3_FOLDER}}
secrets: inherit

# TODO: call emailer
9 changes: 7 additions & 2 deletions .github/workflows/stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ on:
description: "Download URL of the resource package zip-file"
required: true
type: string
sandbox:
description: Flag to stage to sandbox instead
required: false
default: false
type: boolean

concurrency: ${{inputs.resource_id}}

Expand All @@ -23,7 +28,7 @@ jobs:
package_url: ${{inputs.package_url}}
S3_HOST: ${{vars.S3_HOST}}
S3_BUCKET: ${{vars.S3_BUCKET}}
S3_FOLDER: ${{vars.S3_FOLDER}}
S3_FOLDER: ${{inputs.sandbox && vars.S3_SANDBOX_FOLDER || vars.S3_FOLDER}}
secrets: inherit

test:
Expand All @@ -34,5 +39,5 @@ jobs:
version: ${{needs.stage.outputs.version}}
S3_HOST: ${{vars.S3_HOST}}
S3_BUCKET: ${{vars.S3_BUCKET}}
S3_FOLDER: ${{vars.S3_FOLDER}}
S3_FOLDER: ${{inputs.sandbox && vars.S3_SANDBOX_FOLDER || vars.S3_FOLDER}}
secrets: inherit
7 changes: 6 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ on:
description: stage number to test
required: true
type: number
sandbox:
description: Flag to test resource in sandbox instead
required: false
default: false
type: boolean

concurrency: ${{inputs.resource_id}}

Expand All @@ -23,7 +28,7 @@ jobs:
version: staged/${{inputs.stage_number}}
S3_HOST: ${{vars.S3_HOST}}
S3_BUCKET: ${{vars.S3_BUCKET}}
S3_FOLDER: ${{vars.S3_FOLDER}}
S3_FOLDER: ${{inputs.sandbox && vars.S3_SANDBOX_FOLDER || vars.S3_FOLDER}}
secrets: inherit

# TODO: call emailer
7 changes: 3 additions & 4 deletions bioimageio_collection_backoffice/s3_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class Client:

def __post_init__(self):
self.prefix = self.prefix.strip("/")
if not self.prefix:
raise ValueError("empty prefix not allowed")

self._client = Minio(
self.host,
access_key=self.access_key,
Expand Down Expand Up @@ -178,10 +181,6 @@ def _cp_dir(self, src: str, tgt: str):

return objects

def rm_obj(self, name: str) -> None:
"""remove single object"""
self._client.remove_object(self.bucket, name)

def _rm_objs(
self, objects: Sequence[Object], *, bypass_governance_mode: bool
) -> None:
Expand Down

0 comments on commit 5b41d99

Please sign in to comment.