Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into hide-all-shorcut-2
Browse files Browse the repository at this point in the history
  • Loading branch information
bmartel committed Oct 8, 2024
2 parents 99f9d7e + 0a86fa3 commit 9c950a2
Show file tree
Hide file tree
Showing 155 changed files with 2,913 additions and 1,734 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-build-ontop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
cat "${DOCKERFILE_PATH}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.6.1
uses: docker/setup-buildx-action@v3.7.1

- name: Login to DockerHub
uses: docker/[email protected]
Expand All @@ -108,7 +108,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push Docker image
uses: docker/build-push-action@v6.8.0
uses: docker/build-push-action@v6.9.0
id: docker_build_and_push
with:
context: .
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-build-ubi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.6.1
uses: docker/setup-buildx-action@v3.7.1

- name: Login to RedHat Registry
uses: docker/[email protected]
Expand Down Expand Up @@ -167,7 +167,7 @@ jobs:
core.setOutput("ubi-tags", ubiTags.join(','));
- name: Build and push ubi
uses: docker/build-push-action@v6.8.0
uses: docker/build-push-action@v6.9.0
id: docker_build_and_push_ubi
with:
context: .
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
echo "build_version=$version" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.6.1
uses: docker/setup-buildx-action@v3.7.1

- name: Login to DockerHub
uses: docker/[email protected]
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
fi
- name: Push Docker image
uses: docker/build-push-action@v6.8.0
uses: docker/build-push-action@v6.9.0
id: docker_build_and_push
with:
context: .
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-release-promote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.6.1
uses: docker/setup-buildx-action@v3.7.1

- name: Login to DockerHub
uses: docker/[email protected]
Expand Down Expand Up @@ -208,7 +208,7 @@ jobs:
EOF
- name: Build and Push Release Ubuntu Docker image
uses: docker/build-push-action@v6.8.0
uses: docker/build-push-action@v6.9.0
id: docker_build
with:
context: ${{ steps.release_dockerfile.outputs.release_dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ jobs:

- name: Upload coverage to Codecov
if: ${{ github.event.pull_request.head.repo.fork == false && github.event.pull_request.user.login != 'dependabot[bot]' }}
uses: codecov/codecov-action@v4.5.0
uses: codecov/codecov-action@v4.6.0
with:
name: codecov-python-${{ matrix.python-version }}
flags: pytests
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/zendesk_issue_commented.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "ZenDesk: Push an issue comment to zendesk ticket"

on:
issue_comment:
types:
- created

jobs:
issue_commented:
name: Issue comment
if: ${{ !github.event.issue.pull_request && github.event.issue.user.login != 'heidi-humansignal' }}
runs-on: ubuntu-latest
steps:
- uses: hmarr/[email protected]

- env:
ZENDESK_HOST: ${{ vars.ZENDESK_HOST }}
ZENDESK_USER: ${{ vars.ZENDESK_USER }}
ZENDESK_TOKEN: ${{ secrets.ZENDESK_TOKEN }}
ISSUE_URL: ${{ github.event.issue.html_url }}
ISSUE_COMMENT_BODY: ${{ github.event.comment.body }}
ISSUE_USER: ${{ github.event.comment.user.login }}
WORKFLOW_RUN_LINK: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
run: |
echo "Looking up ticket by issue: ${ISSUE_URL}"
tickets=$(curl "https://${ZENDESK_HOST}/api/v2/search.json?query=external_id:${ISSUE_URL}" \
--user "${ZENDESK_USER}/token:${ZENDESK_TOKEN}" \
-H "Content-Type: application/json")
ticket_id=$(echo $tickets | jq '.results[0].id')
echo "Found Zendesk ticket ${ticket_id}"
echo "Looking up user by issuer: ${ISSUE_USER}"
users=$(curl "https://labelstudio.zendesk.com/api/v2/users/[email protected]" \
--user "${ZENDESK_USER}/token:${ZENDESK_TOKEN}" \
--header "Content-Type: application/json")
user_id=$(echo $users | jq '.users[0].id')
if [[ "$user_id" == "null" ]]; then
echo "Fall back to generic github user"
user_id="388861316959"
else
echo "Found user ${user_id}"
fi
body=$(jq -n --arg body "$ISSUE_COMMENT_BODY" '{body: $body}' | jq .body)
echo "$body"
curl "https://${ZENDESK_HOST}/api/v2/tickets/${ticket_id}.json" \
--request PUT \
--user "${ZENDESK_USER}/token:${ZENDESK_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @- <<DATA
{
"ticket": {
"comment": {
"body": "[GITHUB_ISSUE_COMMENT]\n\n${body:1:-1}\n\nGITHUB ISSUE URL: ${ISSUE_URL}\nWORKFLOW RUN: ${WORKFLOW_RUN_LINK}",
"author_id": $user_id
}
}
}
DATA
48 changes: 48 additions & 0 deletions .github/workflows/zendesk_issue_created.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "ZenDesk: Create a zendesk ticket out of an issue"

on:
issues:
types:
- opened

jobs:
issue_created:
name: Issue created
runs-on: ubuntu-latest
steps:
- uses: hmarr/[email protected]

- env:
ZENDESK_HOST: ${{ vars.ZENDESK_HOST }}
ZENDESK_USER: ${{ vars.ZENDESK_USER }}
ZENDESK_TOKEN: ${{ secrets.ZENDESK_TOKEN }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_BODY: ${{ github.event.issue.body }}
ISSUE_USER: ${{ github.event.issue.user.login }}
ISSUE_URL: ${{ github.event.issue.html_url }}
WORKFLOW_RUN_LINK: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
run: |
body=$(jq -n --arg body "$ISSUE_BODY" '{body: $body}' | jq .body)
echo "$body"
curl https://${ZENDESK_HOST}/api/v2/tickets \
--request POST \
--user "${ZENDESK_USER}/token:${ZENDESK_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @- <<DATA
{
"ticket": {
"subject": "Github_Issue: $ISSUE_TITLE",
"comment": {
"body": "[GITHUB_ISSUE_DESCRIPTION]\n\n${body:1:-1}\n\nGITHUB ISSUE URL: ${ISSUE_URL}\nWORKFLOW RUN: ${WORKFLOW_RUN_LINK}"
},
"tags": ["gh-issue"],
"external_id": "$ISSUE_URL",
"requester": {
"locale_id": 1,
"name": "$ISSUE_USER from Github",
"email": "[email protected]"
}
}
}
DATA
86 changes: 86 additions & 0 deletions .github/workflows/zendesk_task_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: "ZenDesk: Comment GitHub Issue on Zendesk Ticket Comment"

on:
workflow_dispatch:
inputs:
client_payload:
description: "Payload from Zendesk"
required: true
type: string

jobs:
process_comment_and_labels:
runs-on: ubuntu-latest
steps:
- uses: hmarr/[email protected]

- uses: actions/github-script@v5
env:
PAYLOAD: ${{ inputs.client_payload }}
with:
github-token: ${{ secrets.GIT_PAT_HEIDI }}
script: |
const payload = JSON.parse(process.env.PAYLOAD);
console.log("Parsed payload: ", JSON.stringify(payload, null, 2));
// Extract issue details from the Zendesk external_id
const parts = payload.ticket.external_id.split("/");
const issue_number = parts[parts.length - 1];
const issue_repo = parts[parts.length - 3];
const issue_owner = parts[parts.length - 4];
// Extract comment details
const comment_author = payload.comment.author || "HumanSignal Support";
const comment_body = payload.comment.body;
const formatted_comment_body = `${comment_body}\n\n*Comment by ${comment_author}*`;
// Add a comment to the GitHub issue
await github.rest.issues.createComment({
owner: issue_owner,
repo: issue_repo,
issue_number: issue_number,
body: formatted_comment_body
});
// Extract labels from the custom_field
let new_labels = [];
if (payload.ticket.custom_field) {
new_labels = payload.ticket.custom_field.split(" ").map(label => label.trim());
}
// Get the current labels on the GitHub issue
const { data: current_labels } = await github.rest.issues.listLabelsOnIssue({
owner: issue_owner,
repo: issue_repo,
issue_number: issue_number
});
const current_label_names = current_labels.map(label => label.name);
// Labels to be added
const labels_to_add = new_labels.filter(label => !current_label_names.includes(label));
// Labels to be removed
const labels_to_remove = current_label_names.filter(label => !new_labels.includes(label));
// Remove labels that are not in the new labels list
for (const label of labels_to_remove) {
await github.rest.issues.removeLabel({
owner: issue_owner,
repo: issue_repo,
issue_number: issue_number,
name: label
});
}
// Add the new labels
if (labels_to_add.length > 0) {
await github.rest.issues.addLabels({
owner: issue_owner,
repo: issue_repo,
issue_number: issue_number,
labels: labels_to_add
});
}
console.log("Comment and labels successfully added to GitHub issue.");
40 changes: 40 additions & 0 deletions .github/workflows/zendesk_task_solve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "ZenDesk: Close GitHub Issue on Zendesk Ticket Solved"

on:
workflow_dispatch:
inputs:
client_payload:
description: "Payload from Zendesk"
required: true
type: string

jobs:
close_issue:
runs-on: ubuntu-latest
steps:
- uses: hmarr/[email protected]

- uses: actions/github-script@v5
env:
PAYLOAD: ${{ inputs.client_payload }}
with:
github-token: ${{ secrets.GIT_PAT_HEIDI }}
script: |
const payload = JSON.parse(process.env.PAYLOAD);
console.log("Parsed payload: ", JSON.stringify(payload, null, 2));
// Extract issue details from the Zendesk external_id
const parts = payload.ticket.external_id.split("/");
const issue_number = parts[parts.length - 1];
const issue_repo = parts[parts.length - 3];
const issue_owner = parts[parts.length - 4];
// Close the GitHub issue
await github.rest.issues.update({
owner: issue_owner,
repo: issue_repo,
issue_number: issue_number,
state: "closed"
});
console.log(`GitHub issue #${issue_number} closed successfully.`);
1 change: 1 addition & 0 deletions label_studio/core/feature_flags/stale_feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
'ff_front_dev_1495_avatar_mess_210122_short': True,
'ff_front_1170_outliner_030222_short': True,
'fflag_fix_front_lsdv_4620_memory_leaks_100723_short': False,
'fflag_feat_optic_198_multi_select_users_short': True,
'fflag_fix_back_lsdv_5410_temporary_disable_auto_inference_jobs_short': True,
'fflag_feat_front_prod_292_archive_workspaces_short': True,
}
27 changes: 27 additions & 0 deletions label_studio/feature_flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -1824,6 +1824,33 @@
"version": 2,
"deleted": false
},
"fflag_feat_all_optic_1181_membership_performance": {
"key": "fflag_feat_all_optic_1181_membership_performance",
"on": false,
"prerequisites": [],
"targets": [],
"contextTargets": [],
"rules": [],
"fallthrough": {
"variation": 0
},
"offVariation": 1,
"variations": [
true,
false
],
"clientSideAvailability": {
"usingMobileKey": false,
"usingEnvironmentId": false
},
"clientSide": false,
"salt": "3691490c5dc2478e9f6ea4ee816efb87",
"trackEvents": false,
"trackEventsFallthrough": false,
"debugEventsUntilDate": null,
"version": 2,
"deleted": false
},
"fflag_feat_all_optic_520_annotator_report_short": {
"key": "fflag_feat_all_optic_520_annotator_report_short",
"on": false,
Expand Down
6 changes: 5 additions & 1 deletion label_studio/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ def reset_token(self) -> Token:
def get_initials(self, is_deleted=False):
initials = '?'

if flag_set('fflag_feat_all_optic_114_soft_delete_for_churned_employees', user=self) and is_deleted:
if (
getattr(settings, 'CLOUD_INSTANCE', False)
or flag_set('fflag_feat_all_optic_114_soft_delete_for_churned_employees', user=self)
) and is_deleted:

return 'DU'

if not self.first_name and not self.last_name:
Expand Down
Loading

0 comments on commit 9c950a2

Please sign in to comment.