Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
Browse files Browse the repository at this point in the history
…9.4.x

Signed-off-by: Gordon Smith <[email protected]>

# Conflicts:
#	helm/hpcc/Chart.yaml
#	helm/hpcc/templates/_helpers.tpl
#	version.cmake
  • Loading branch information
GordonSmith committed Aug 23, 2024
2 parents a2790d3 + 66fe731 commit 00aaaee
Show file tree
Hide file tree
Showing 13 changed files with 142 additions and 88 deletions.
80 changes: 41 additions & 39 deletions .github/workflows/jirabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,61 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GHUB_JIRA_USER_MAP: ${{ vars.GHUB_JIRA_USER_MAP }}
JIRA_ISSUE_PROPERTY_MAP: ${{ vars.JIRA_ISSUE_PROPERTY_MAP }}
JIRA_ISSUE_TRANSITION_MAP: ${{ vars.JIRA_ISSUE_TRANSITION_MAP }}
run: |
import os
import re
import time
import sys
import json
import subprocess
from email.utils import parseaddr
from atlassian.jira import Jira
def updateIssue(jira, issue, prAuthor : str, transitionMap: dict, propertyMap: dict, pull_url: str) -> str:
def sanitizeInput(input: str, inputType: str) -> str:
if inputType.lower() == 'email':
# Return the email address only, returns '' if not valid or found
return parseaddr(input)[1]
else:
return ''
def updateIssue(jira, issue, prAuthor : str, propertyMap: dict, pull_url: str) -> str:
result = ''
issueName = issue['key']
issueFields = issue['fields']
statusName = str(issueFields['status']['name'])
transition = transitionMap.get(statusName, None)
# Need to update user first in case we are starting from Unresourced
if prAuthor:
assignee = issueFields['assignee']
if assignee is None:
assigneeId = ''
assigneeEmail = ''
else:
assigneeId = assignee['accountId']
assigneeEmail = assignee["emailAddress"]
assigneeEmail = sanitizeInput(assigneeEmail, 'email')
prAuthorId = prAuthor["accountId"]
prAuthorEmail = prAuthor["emailAddress"]
prAuthorEmail = sanitizeInput(prAuthorEmail, 'email')
if assigneeId is None or assigneeId == '':
jira.assign_issue(issueName, prAuthorId)
result += 'Assigning user: ' + prAuthorEmail + '\n'
elif assigneeId != prAuthorId:
result += 'Changing assignee from: ' + assigneeEmail + ' to: ' + prAuthorEmail + '\n'
jira.assign_issue(issueName, prAuthorId)
if transition == None:
print('Error: Unable to find transition for status: ' + statusName)
elif transition != '':
transitionFlow = ['Merge Pending']
for desiredStatus in transitionFlow:
try:
jira.issue_transition(issueName, transition)
result += 'Workflow Transition: ' + transition + '\n'
transitionId = jira.get_transition_id_to_status_name(issueName, desiredStatus)
jira.set_issue_status_by_transition_id(issueName, transitionId)
result += 'Workflow Transition To: ' + desiredStatus + '\n'
except Exception as error:
transitions = jira.get_issue_transitions(issueName)
result += 'Error: Transition: "' + transition + '" failed with: "' + str(error) + '" Valid transitions=' + str(transitions) + '\n'
result += 'Error: Transitioning to: "' + desiredStatus + '" failed with: "' + str(error) + '" Valid transitions=' + str(transitions) + '\n'
prFieldName = propertyMap.get('pullRequestFieldName', 'customfield_10010')
Expand All @@ -80,24 +108,6 @@ jobs:
elif currentPR is not None and currentPR != pull_url:
result += 'Additional PR: ' + pull_url + '\n'
if prAuthor:
assignee = issueFields['assignee']
if assignee is None:
assigneeId = ''
assigneeEmail = ''
else:
assigneeId = assignee['accountId']
assigneeEmail = assignee["emailAddress"]
prAuthorId = prAuthor["accountId"]
prAuthorEmail = prAuthor["emailAddress"]
if assigneeId is None or assigneeId == '':
jira.assign_issue(issueName, prAuthorId)
result += 'Assigning user: ' + prAuthorEmail + '\n'
elif assigneeId != prAuthorId:
result += 'Changing assignee from: ' + assigneeEmail + ' to: ' + prAuthorEmail + '\n'
jira.assign_issue(issueName, prAuthorId)
return result
jirabot_user = os.environ['JIRABOT_USERNAME']
Expand All @@ -110,7 +120,6 @@ jobs:
github_token = os.environ['GITHUB_TOKEN']
comments_url = os.environ['COMMENTS_URL']
print("%s %s %s" % (title, prAuthor, comments_url))
result = ''
issuem = re.search("(HPCC|HH|IDE|EPE|ML|HPCC4J|JAPI)-[0-9]+", title)
if issuem:
Expand All @@ -131,7 +140,7 @@ jobs:
if userSearchResults and len(userSearchResults) > 0:
jiraUser = userSearchResults[0]
else:
print('Error: Unable to find Jira user: ' + prAuthor + ' continuing without assigning')
print('Error: Unable to map GitHub user to Jira user, continuing without assigning')
if not jira.issue_exists(issue_name):
sys.exit('Error: Unable to find Jira issue: ' + issue_name)
Expand All @@ -140,27 +149,20 @@ jobs:
result = 'Jirabot Action Result:\n'
transitionMap = json.loads(os.environ['JIRA_ISSUE_TRANSITION_MAP'])
if not isinstance(transitionMap, dict):
print('Error: JIRA_ISSUE_TRANSITION_MAP is not a valid JSON object, ignoring.')
transitionMap = {}
jiraIssuePropertyMap = json.loads(os.environ['JIRA_ISSUE_PROPERTY_MAP'])
if not isinstance(jiraIssuePropertyMap, dict):
print('Error: JIRA_ISSUE_PROPERTY_MAP is not a valid JSON object, ignoring.')
jiraIssuePropertyMap = {}
result += updateIssue(jira, issue, jiraUser, transitionMap, jiraIssuePropertyMap, pull_url)
result += updateIssue(jira, issue, jiraUser, jiraIssuePropertyMap, pull_url)
jira.issue_add_comment(issue_name, result)
result = 'Jira Issue: ' + jira_url + '/browse/' + issue_name + '\n\n' + result
# Escape the result for JSON
result = json.dumps(result)
curlCommand = 'curl -X POST %s -H "Content-Type: application/json" -H "Authorization: token %s" --data \'{ "body": %s }\'' % ( comments_url, github_token, result )
print(curlCommand)
os.system(curlCommand)
subprocess.run(['curl', '-X', 'POST', comments_url, '-H', 'Content-Type: application/json', '-H', f'Authorization: token {github_token}', '--data', f'{{ "body": {result} }}'], check=True)
else:
print('Unable to find Jira issue name in title')
Expand Down
3 changes: 3 additions & 0 deletions esp/src/eslint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
module.exports = {
rules: {
"no-src-react": {
meta: {
fixable: "code"
},
create: function (context) {
return {
ImportDeclaration(node) {
Expand Down
25 changes: 10 additions & 15 deletions esp/src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion esp/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@hpcc-js/timeline": "2.53.0",
"@hpcc-js/tree": "2.41.0",
"@hpcc-js/util": "2.52.0",
"@hpcc-js/wasm": "2.18.1",
"@hpcc-js/wasm": "2.18.2",
"@kubernetes/client-node": "0.20.0",
"clipboard": "2.0.11",
"d3-dsv": "3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion esp/src/src-react/components/ECLArchive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const ECLArchive: React.FunctionComponent<ECLArchiveProps> = ({
return <HolyGrail fullscreen={fullscreen}
header={<CommandBar items={buttons} farItems={rightButtons} />}
main={
<DockPanel hideSingleTabs onDockPanelCreate={setDockpanel}>
<DockPanel hideSingleTabs onCreate={setDockpanel}>
<DockPanelItem key="scopesTable" title="Files" >
{ // Only render after archive is loaded (to ensure it "defaults to open") ---
archive?.modAttrs.length &&
Expand Down
7 changes: 6 additions & 1 deletion esp/src/src-react/components/Files.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export const Files: React.FunctionComponent<FilesProps> = ({
}
return "";
},
field: nlsHPCC.Protected,
},
IsCompressed: {
headerIcon: "ZipFolder",
Expand All @@ -168,6 +169,7 @@ export const Files: React.FunctionComponent<FilesProps> = ({
}
return "";
},
field: nlsHPCC.Compressed,
},
Name: {
label: nlsHPCC.LogicalName,
Expand All @@ -194,18 +196,21 @@ export const Files: React.FunctionComponent<FilesProps> = ({
formatter: (value, row) => {
return Utility.formatNum(row.IntRecordCount);
},
csvFormatter: (value, row) => row.IntRecordCount,
},
FileSize: {
label: nlsHPCC.Size,
formatter: (value, row) => {
return Utility.convertedSize(row.IntSize);
},
csvFormatter: (value, row) => row.IntSize,
},
CompressedFileSizeString: {
label: nlsHPCC.CompressedSize,
formatter: (value, row) => {
return Utility.convertedSize(row.CompressedFileSize);
}
},
csvFormatter: (value, row) => row.CompressedFileSize,
},
Parts: {
label: nlsHPCC.Parts, width: 40,
Expand Down
2 changes: 1 addition & 1 deletion esp/src/src-react/components/Frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const Frame: React.FunctionComponent<FrameProps> = () => {

router.resolve(hashHistory.location).then(setBody);

userKeyValStore().get("user_cookie_consent")
userKeyValStore().get(USER_COOKIE_CONSENT)
.then((resp) => {
setShowCookieConsent(resp === "1");
})
Expand Down
2 changes: 1 addition & 1 deletion esp/src/src-react/components/Metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
</>}
main={
<ErrorBoundary>
<DockPanel layout={options?.layout} onDockPanelCreate={setDockpanel}>
<DockPanel layout={options?.layout} onCreate={setDockpanel}>
<DockPanelItem key="scopesTable" title={nlsHPCC.Metrics}>
<HolyGrail
header={<Stack horizontal>
Expand Down
11 changes: 7 additions & 4 deletions esp/src/src-react/components/Queries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export const Queries: React.FunctionComponent<QueriesProps> = ({
return <Icon iconName="Pause" />;
}
return "";
}
},
field: nlsHPCC.Suspended,
},
ErrorCount: {
headerIcon: "Warning",
Expand All @@ -124,7 +125,8 @@ export const Queries: React.FunctionComponent<QueriesProps> = ({
return <Icon iconName="Warning" />;
}
return "";
}
},
field: nlsHPCC.ErrorWarnings,
},
MixedNodeStates: {
headerIcon: "Error",
Expand All @@ -136,7 +138,7 @@ export const Queries: React.FunctionComponent<QueriesProps> = ({
return <Icon iconName="Error" />;
}
return "";
}
},
},
Activated: {
headerIcon: "SkypeCircleCheck",
Expand All @@ -147,7 +149,8 @@ export const Queries: React.FunctionComponent<QueriesProps> = ({
return <Icon iconName="SkypeCircleCheck" />;
}
return "";
}
},
field: nlsHPCC.Active,
},
Id: {
label: nlsHPCC.ID,
Expand Down
Loading

0 comments on commit 00aaaee

Please sign in to comment.