-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fb-optic-1553' of github.com:HumanSignal/label-studio i…
…nto fb-optic-1553
- Loading branch information
Showing
57 changed files
with
1,180 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,7 @@ jobs: | |
cat "${DOCKERFILE_PATH}" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.8.0 | ||
uses: docker/setup-buildx-action@v3.9.0 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,7 @@ jobs: | |
echo "build_version=$version" >> $GITHUB_OUTPUT | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.8.0 | ||
uses: docker/setup-buildx-action@v3.9.0 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,7 +154,7 @@ jobs: | |
fi | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.8.0 | ||
uses: docker/setup-buildx-action@v3.9.0 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: 'Follow Merge: Sync PR LSE' | ||
name: 'Follow Merge: Dispatch' | ||
|
||
on: | ||
pull_request_target: | ||
|
@@ -19,13 +19,10 @@ on: | |
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref }} | ||
|
||
env: | ||
DOWNSTREAM_REPOSITORY: "label-studio-enterprise" | ||
|
||
jobs: | ||
sync: | ||
name: "Sync" | ||
if: startsWith(github.head_ref, 'fb-') | ||
if: startsWith(github.head_ref, 'fb-') || (startsWith(github.head_ref, 'revert-') && contains(github.head_ref, '-fb-') ) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: hmarr/[email protected] | ||
|
@@ -60,25 +57,20 @@ jobs: | |
body: [ | ||
'Hi @${{ github.actor }}!', | ||
'', | ||
`Unfortunately you don't have membership in ${owner} organization, your PR wasn't synced with ${owner}/${{ env.DOWNSTREAM_REPOSITORY }}.` | ||
`Unfortunately you don't have membership in ${owner} organization, Follow Merge dispatch is skipped.` | ||
].join('\n') | ||
}); | ||
throw `${{ github.actor }} don't have membership in ${owner} organization` | ||
- name: Dispatch Follow Merge Workflow | ||
uses: actions/github-script@v7 | ||
env: | ||
BRANCH_NAME: ${{ github.head_ref }} | ||
- name: Checkout Actions Hub | ||
uses: actions/checkout@v4 | ||
with: | ||
github-token: ${{ secrets.GIT_PAT }} | ||
script: | | ||
const branch_name = process.env.BRANCH_NAME; | ||
github.rest.actions.createWorkflowDispatch({ | ||
owner: "HumanSignal", | ||
repo: "label-studio-enterprise", | ||
workflow_id: "follow-merge-upstream-repo-sync-v2.yml", | ||
ref: "develop", | ||
inputs: { | ||
branch_name: branch_name, | ||
} | ||
}); | ||
token: ${{ secrets.GIT_PAT }} | ||
repository: HumanSignal/actions-hub | ||
path: ./.github/actions-hub | ||
|
||
- name: Dispatch label-studio-enterprise Follow Merge | ||
uses: ./.github/actions-hub/actions/follow-merge-dispatch | ||
with: | ||
github_token: ${{ secrets.GIT_PAT }} | ||
downstream_repository: "label-studio-enterprise" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,8 +26,7 @@ jobs: | |
name: Sync PR | ||
runs-on: ubuntu-latest | ||
outputs: | ||
adala: "${{ steps.upstream-prs.outputs.adala }}" | ||
label-studio-query-vectordb: "${{ steps.upstream-prs.outputs.label-studio-query-vectordb }}" | ||
label-studio-sdk: "${{ steps.upstream-prs.outputs.label-studio-sdk }}" | ||
steps: | ||
- uses: hmarr/[email protected] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.contrib import admin | ||
from rest_framework_simplejwt.token_blacklist.models import BlacklistedToken, OutstandingToken | ||
|
||
# don't allow token management from admin console | ||
admin.site.unregister(BlacklistedToken) | ||
admin.site.unregister(OutstandingToken) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class JWTAuthConfig(AppConfig): | ||
name = 'jwt_auth' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import logging | ||
|
||
from rest_framework.authentication import TokenAuthentication | ||
from rest_framework.exceptions import AuthenticationFailed | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class TokenAuthenticationPhaseout(TokenAuthentication): | ||
"""TokenAuthentication with features to help phase out legacy token auth | ||
Logs usage and triggers a 401 if legacy token auth is not enabled for the organization.""" | ||
|
||
def authenticate(self, request): | ||
"""Authenticate the request and log if successful.""" | ||
from core.feature_flags import flag_set | ||
|
||
auth_result = super().authenticate(request) | ||
JWT_ACCESS_TOKEN_ENABLED = flag_set('fflag__feature_develop__prompts__dia_1829_jwt_token_auth') | ||
if JWT_ACCESS_TOKEN_ENABLED and (auth_result is not None): | ||
user, _ = auth_result | ||
org = user.active_organization | ||
org_id = org.id if org else None | ||
|
||
# raise 401 if legacy API token auth disabled (i.e. this token is no longer valid) | ||
if org and (not org.jwt.legacy_api_tokens_enabled): | ||
raise AuthenticationFailed( | ||
'Authentication token no longer valid: legacy token authentication has been disabled for this organization' | ||
) | ||
|
||
logger.info( | ||
'Legacy token authentication used', | ||
extra={'user_id': user.id, 'organization_id': org_id, 'endpoint': request.path}, | ||
) | ||
return auth_result |
Oops, something went wrong.