Skip to content

Commit

Permalink
Merge pull request #6 from UCSD-E4E/feature/synology
Browse files Browse the repository at this point in the history
Feature/synology
  • Loading branch information
ccrutchf authored Jan 18, 2025
2 parents df34d55 + 1e7420f commit 782dc84
Show file tree
Hide file tree
Showing 67 changed files with 1,191 additions and 2 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Docker Image CI

on:
push:
branches: [ "release-1.15.0" ]

env:
IMAGE_NAME: ghcr.io/ucsd-e4e/label-studio

jobs:

build:
runs-on: ubuntu-latest

steps:
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
-
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Calculate version
id: version
env:
BRANCH_NAME: "develop"
run: |
set -x
sha="$(git rev-parse HEAD)"
echo "sha=$sha" >> $GITHUB_OUTPUT
pretty_branch_name="$(echo -n "${BRANCH_NAME#refs/heads/}" | sed -E 's#[/_\.-]+#-#g' | tr '[:upper:]' '[:lower:]' | cut -c1-25 | sed -E 's#-$##g')"
echo "pretty_branch_name=${pretty_branch_name}" >> "${GITHUB_OUTPUT}"
regexp='^ls-release\/(.*)$';
if [[ "$BRANCH_NAME" =~ $regexp ]]; then
image_version="${BASH_REMATCH[1]}rc${sha}"
else
image_version="${pretty_branch_name}"
fi
echo "image_version=${image_version}" >> $GITHUB_OUTPUT
echo "ubi_image_version=ubi_${image_version}" >> $GITHUB_OUTPUT
current_time="$(date +'%Y%m%d.%H%M%S')"
branch="-${pretty_branch_name}"
short_sha="$(git rev-parse --short HEAD)"
long_sha="$(git rev-parse HEAD)"
echo "sha=$long_sha" >> $GITHUB_OUTPUT
short_sha_length="$(echo $short_sha | awk '{print length}')"
current_time_length="$(echo $current_time | awk '{print length}')"
version="${current_time}$(echo $branch | cut -c1-$((50 - short_sha_length - current_time_length)))-${short_sha}"
echo "build_version=$version" >> $GITHUB_OUTPUT
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ steps.version.outputs.image_version }}
type=raw,value=${{ steps.version.outputs.build_version }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
build-args: |
BRANCH_OVERRIDE: "develop"
VERSION_OVERRIDE: ${{ steps.version.outputs.build_version }}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions label_studio/core/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@
'io_storages_azureblobimportstoragelink',
'io_storages_localfilesimportstoragelink',
'io_storages_redisimportstoragelink',
'io_storages_synologyimportstoragelink',
]

CREATE_ORGANIZATION = 'organizations.functions.create_organization'
Expand Down
2 changes: 2 additions & 0 deletions label_studio/data_manager/actions/remove_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from io_storages.localfiles.models import LocalFilesImportStorageLink
from io_storages.redis.models import RedisImportStorageLink
from io_storages.s3.models import S3ImportStorageLink
from io_storages.synology.models import SynologyImportStorageLink
from tasks.models import Task

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -138,6 +139,7 @@ def restore_storage_links_for_duplicated_tasks(duplicates) -> None:
'io_storages_azureblobimportstoragelink': AzureBlobImportStorageLink,
'io_storages_localfilesimportstoragelink': LocalFilesImportStorageLink,
'io_storages_redisimportstoragelink': RedisImportStorageLink,
'io_storages_synologyimportstoragelink': SynologyImportStorageLink,
# 'lse_io_storages_lses3importstoragelink' # not supported yet
}

Expand Down
1 change: 1 addition & 0 deletions label_studio/data_manager/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def prefetch(queryset):
'io_storages_localfilesimportstoragelink',
'io_storages_redisimportstoragelink',
'io_storages_s3importstoragelink',
'io_storages_synologyimportstoragelink',
'file_upload',
)

Expand Down
7 changes: 7 additions & 0 deletions label_studio/io_storages/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from .gcs.api import GCSExportStorageListAPI, GCSImportStorageListAPI
from .redis.api import RedisExportStorageListAPI, RedisImportStorageListAPI
from .s3.api import S3ExportStorageListAPI, S3ImportStorageListAPI
from .synology.api import SynologyExportStorageListAPI, SynologyImportStorageListAPI

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -38,6 +39,12 @@ def get_storage_list():
'import_list_api': RedisImportStorageListAPI,
'export_list_api': RedisExportStorageListAPI,
},
{
'name': 'synology',
'title': 'Synology',
'import_list_api': SynologyImportStorageListAPI,
'export_list_api': SynologyExportStorageListAPI,
},
]


Expand Down
Loading

0 comments on commit 782dc84

Please sign in to comment.