Skip to content

Commit 32985ac

Browse files
committed
Merge remote-tracking branch 'origin/candidate-9.4.x' into candidate-9.6.x
Signed-off-by: Gordon Smith <[email protected]> # Conflicts: # commons-hpcc/pom.xml # dfsclient/pom.xml # pom.xml # wsclient/pom.xml
2 parents 9f245d2 + 4984728 commit 32985ac

File tree

14 files changed

+1141
-755
lines changed

14 files changed

+1141
-755
lines changed

.github/workflows/Jirabot.yml

+54-49
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
jirabot:
1515
runs-on: ubuntu-20.04
1616
steps:
17-
- uses: "actions/setup-python@v2"
17+
- uses: "actions/setup-python@v5"
1818
with:
1919
python-version: "3.8"
2020
- name: "Install dependencies"
@@ -23,9 +23,8 @@ jobs:
2323
python -VV
2424
python -m site
2525
python -m pip install --upgrade pip setuptools wheel
26-
python -m pip install --upgrade jira
26+
python -m pip install --upgrade atlassian-python-api
2727
python -m pip --version
28-
python -m pip freeze | grep jira
2928
- name: "Run"
3029
env:
3130
JIRABOT_USERNAME : ${{ secrets.JIRABOT_USERNAME }}
@@ -43,49 +42,61 @@ jobs:
4342
run: |
4443
import os
4544
import re
45+
import time
46+
import sys
4647
import json
47-
from jira.client import JIRA
48+
from atlassian.jira import Jira
4849
49-
def updateIssue(jira, issue, prAuthorEmail : str, transitionMap: dict, propertyMap: dict, pull_url: str) -> str:
50+
def updateIssue(jira, issue, prAuthor : str, transitionMap: dict, propertyMap: dict, pull_url: str) -> str:
5051
result = ''
5152
52-
statusName = str(issue.fields.status)
53+
issueName = issue['key']
54+
issueFields = issue['fields']
55+
56+
statusName = str(issueFields['status']['name'])
5357
transition = transitionMap.get(statusName, None)
5458
5559
if transition == None:
5660
print('Error: Unable to find transition for status: ' + statusName)
5761
elif transition != '':
5862
try:
59-
jira.transition_issue(issue, transition)
63+
jira.issue_transition(issueName, transition)
6064
result += 'Workflow Transition: ' + transition + '\n'
6165
except Exception as error:
62-
transitions = jira.transitions(issue)
66+
transitions = jira.get_issue_transitions(issueName)
6367
result += 'Error: Transition: "' + transition + '" failed with: "' + str(error) + '" Valid transitions=' + str(transitions) + '\n'
6468
6569
prFieldName = propertyMap.get('pullRequestFieldName', 'customfield_10010')
66-
try:
67-
currentPR = getattr(issue.fields, prFieldName)
68-
except:
70+
71+
if prFieldName in issueFields:
72+
currentPR = issueFields[prFieldName]
73+
else:
74+
print('Error: Unable to find pull request field with field name: ' + prFieldName)
6975
currentPR = None
70-
print('Error: Unable to get current pull request with field name: ' + prFieldName)
7176
7277
if currentPR is None:
73-
issue.update(fields={prFieldName: pull_url})
78+
jira.update_issue_field(issueName, {prFieldName: pull_url})
7479
result += 'Updated PR\n'
7580
elif currentPR is not None and currentPR != pull_url:
7681
result += 'Additional PR: ' + pull_url + '\n'
7782
78-
if prAuthorEmail:
79-
if issue.fields.assignee is None:
80-
jira.assign_issue(issue, prAuthorEmail)
81-
result += 'Assigning user: ' + prAuthorEmail + '\n'
83+
if prAuthor:
84+
assignee = issueFields['assignee']
85+
if assignee is None:
86+
assigneeId = ''
87+
assigneeEmail = ''
8288
else:
83-
assigneeEmail = None
84-
if issue.fields.assignee:
85-
assigneeEmail = issue.fields.assignee.emailAddress
86-
if assigneeEmail is None or assigneeEmail.lower() != assigneeEmail.lower():
87-
result += 'Changing assignee from: ' + assigneeEmail + ' to: ' + prAuthorEmail + '\n'
88-
jira.assign_issue(issue, prAuthorEmail)
89+
assigneeId = assignee['accountId']
90+
assigneeEmail = assignee["emailAddress"]
91+
92+
prAuthorId = prAuthor["accountId"]
93+
prAuthorEmail = prAuthor["emailAddress"]
94+
if assigneeId is None or assigneeId == '':
95+
jira.assign_issue(issueName, prAuthorId)
96+
result += 'Assigning user: ' + prAuthorEmail + '\n'
97+
elif assigneeId != prAuthorId:
98+
result += 'Changing assignee from: ' + assigneeEmail + ' to: ' + prAuthorEmail + '\n'
99+
jira.assign_issue(issueName, prAuthorId)
89100
90101
return result
91102
@@ -114,34 +125,20 @@ jobs:
114125
prAuthor = userDict.get(prAuthor)
115126
print('Mapped Github user to Jira user: ' + prAuthor)
116127
117-
options = {
118-
'server': jira_url
119-
}
120-
121-
jira = JIRA(options=options, basic_auth=(jirabot_user, jirabot_pass))
128+
jira = Jira(url=jira_url, username= jirabot_user, password= jirabot_pass, cloud=True)
122129
123-
# Need to change how we find users for Jira Cloud, unfortunately the API doesn't provide this information.
124-
# At the moment checking if the URL contains atlassian.net appears to be the easiest way to determine if it's Jira Cloud.
125-
isJiraCloud = False
126-
if jira_url.find('atlassian.net') > 0:
127-
isJiraCloud = True
128-
129-
if isJiraCloud:
130-
res = jira.search_users(query=prAuthor)
131-
if res and len(res) > 0:
132-
jiraUser = res[0]
130+
jiraUser = None
131+
userSearchResults = jira.user_find_by_user_string(query=prAuthor)
132+
if userSearchResults and len(userSearchResults) > 0:
133+
jiraUser = userSearchResults[0]
133134
else:
134-
jiraUser = jira.user(prAuthor)
135-
136-
jiraUserEmail = None
137-
if jiraUser is None:
138135
print('Error: Unable to find Jira user: ' + prAuthor + ' continuing without assigning')
139-
else:
140-
jiraUserEmail = jiraUser.emailAddress
141136
142-
print("Jira User Email:" + str(jiraUserEmail))
137+
if not jira.issue_exists(issue_name):
138+
sys.exit('Error: Unable to find Jira issue: ' + issue_name)
139+
else:
140+
issue = jira.issue(issue_name)
143141
144-
issue = jira.issue(issue_name)
145142
result = 'Jirabot Action Result:\n'
146143
147144
transitionMap = json.loads(os.environ['JIRA_ISSUE_TRANSITION_MAP'])
@@ -154,10 +151,18 @@ jobs:
154151
print('Error: JIRA_ISSUE_PROPERTY_MAP is not a valid JSON object, ignoring.')
155152
jiraIssuePropertyMap = {}
156153
157-
result += updateIssue(jira, issue, jiraUserEmail, transitionMap, jiraIssuePropertyMap, pull_url)
158-
jira.add_comment(issue, result)
154+
result += updateIssue(jira, issue, jiraUser, transitionMap, jiraIssuePropertyMap, pull_url)
155+
jira.issue_add_comment(issue_name, result)
156+
157+
result = 'Jira Issue: ' + jira_url + '/browse/' + issue_name + '\n\n' + result
158+
159+
# Escape the result for JSON
160+
result = json.dumps(result)
161+
162+
curlCommand = 'curl -X POST %s -H "Content-Type: application/json" -H "Authorization: token %s" --data \'{ "body": %s }\'' % ( comments_url, github_token, result )
163+
os.system(curlCommand)
159164
else:
160165
print('Unable to find Jira issue name in title')
161166
162167
print(result)
163-
shell: python
168+
shell: python

.github/workflows/baremetal-regression-suite.yml

+11-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
7474
if gitTagProcessStatus != 0:
7575
print('Unable to retrieve latest git tag. With error: ' + str(err))
76-
sys.exit(1)
76+
return None
7777
7878
latestGitTag = str(output)
7979
@@ -82,11 +82,14 @@ jobs:
8282
return extractVersion(versionMatch.group(1))
8383
else:
8484
print('Unable to extract version from git tag: ' + latestGitTag)
85-
sys.exit(2)
85+
return None
8686
8787
def getLatestBranchVersion(branchName):
8888
8989
latestVersion = getTagVersionForCmd("git tag --list 'hpcc4j_*-release' --sort=-v:refname | head -n 1")
90+
if latestVersion is None:
91+
print('Unable to find latest release version')
92+
sys.exit(2)
9093
9194
if branchName == 'master':
9295
return [latestVersion[0], latestVersion[1], latestVersion[2]]
@@ -102,7 +105,12 @@ jobs:
102105
103106
# Get latest release in branch
104107
findLatestBranchVer = "git tag --list 'hpcc4j_" + str(branchVersion[0]) + "." + str(branchVersion[1]) + "*-release' --sort=-v:refname | head -n 1"
105-
return getTagVersionForCmd(findLatestBranchVer)
108+
latestBranchVersion = getTagVersionForCmd(findLatestBranchVer)
109+
if latestBranchVersion is None:
110+
print('No release found for branch: ' + branchName + ' using latest release: ' + str(latestVersion))
111+
return latestVersion
112+
else:
113+
return latestBranchVersion
106114
107115
branch_name = os.environ['BRANCH_NAME']
108116

dfsclient/src/test/java/org/hpccsystems/dfs/client/DFSReadWriteTest.java

+40-11
Original file line numberDiff line numberDiff line change
@@ -92,25 +92,43 @@ public void readWithForcedTimeoutTest() throws Exception
9292
public void nullCharTests() throws Exception
9393
{
9494
// Unicode
95+
boolean unicodePassed = true;
9596
{
9697
FieldDef recordDef = null;
9798
{
9899
FieldDef[] fieldDefs = new FieldDef[2];
99100
fieldDefs[0] = new FieldDef("uni", FieldType.STRING, "STRING", 100, false, false, HpccSrcType.UTF16LE, new FieldDef[0]);
100-
fieldDefs[1] = new FieldDef("fixedUni", FieldType.STRING, "STRING", 100, true, false, HpccSrcType.UTF16LE, new FieldDef[0]);
101+
fieldDefs[1] = new FieldDef("fixedUni", FieldType.STRING, "STRING", 200, true, false, HpccSrcType.UTF16LE, new FieldDef[0]);
101102

102103
recordDef = new FieldDef("RootRecord", FieldType.RECORD, "rec", 4, false, false, HpccSrcType.LITTLE_ENDIAN, fieldDefs);
103104
}
104105

105106
List<HPCCRecord> records = new ArrayList<HPCCRecord>();
106107
int maxUTF16BMPChar = Character.MAX_CODE_POINT;
107-
for (int i = 0; i < maxUTF16BMPChar; i++) {
108+
for (int i = 0; i < maxUTF16BMPChar; i++)
109+
{
110+
108111
String strMidEOS = "";
109-
for (int j = 0; j < 98; j++, i++) {
110-
if (j == 50) {
112+
for (int j = 0; j < 98; j++, i++)
113+
{
114+
if (!Character.isValidCodePoint(i) || !Character.isDefined(i))
115+
{
116+
continue;
117+
}
118+
119+
char[] chars = Character.toChars(i);
120+
if (Character.isSurrogate(chars[0]))
121+
{
122+
continue;
123+
}
124+
125+
if (j == 50 && strMidEOS.length() > 0)
126+
{
111127
strMidEOS += "\0";
112128
}
113-
strMidEOS += Character.toString((char) i);
129+
130+
String charStr = new String(chars);
131+
strMidEOS += charStr;
114132
}
115133

116134
Object[] fields = {strMidEOS, strMidEOS};
@@ -123,17 +141,20 @@ public void nullCharTests() throws Exception
123141
HPCCFile file = new HPCCFile(fileName, connString , hpccUser, hpccPass);
124142
List<HPCCRecord> readRecords = readFile(file, 10000, false, false, BinaryRecordReader.TRIM_STRINGS);
125143

126-
for (int i = 0; i < records.size(); i++) {
144+
for (int i = 0; i < records.size(); i++)
145+
{
127146
HPCCRecord record = records.get(i);
128147
HPCCRecord readRecord = readRecords.get(i);
129148
if (readRecord.equals(record) == false)
130149
{
131150
System.out.println("Record: " + i + " did not match\n" + record + "\n" + readRecord);
151+
unicodePassed = false;
132152
}
133153
}
134154
}
135155

136156
// SBC / ASCII
157+
boolean sbcPassed = true;
137158
{
138159
FieldDef recordDef = null;
139160
{
@@ -145,13 +166,16 @@ public void nullCharTests() throws Exception
145166
}
146167

147168
List<HPCCRecord> records = new ArrayList<HPCCRecord>();
148-
for (int i = 0; i < 255; i++) {
169+
for (int i = 0; i < 255; i++)
170+
{
149171
String strMidEOS = "";
150-
for (int j = 0; j < 9; j++, i++) {
151-
if (j == 5) {
172+
for (int j = 0; j < 9; j++, i++)
173+
{
174+
if (j == 5)
175+
{
152176
strMidEOS += "\0";
153177
}
154-
strMidEOS += Character.toString((char) i);
178+
strMidEOS += new String(Character.toChars(j));
155179
}
156180

157181
Object[] fields = {strMidEOS, strMidEOS};
@@ -164,15 +188,20 @@ public void nullCharTests() throws Exception
164188
HPCCFile file = new HPCCFile(fileName, connString , hpccUser, hpccPass);
165189
List<HPCCRecord> readRecords = readFile(file, 10000, false, false, BinaryRecordReader.TRIM_STRINGS);
166190

167-
for (int i = 0; i < records.size(); i++) {
191+
for (int i = 0; i < records.size(); i++)
192+
{
168193
HPCCRecord record = records.get(i);
169194
HPCCRecord readRecord = readRecords.get(i);
170195
if (readRecord.equals(record) == false)
171196
{
172197
System.out.println("Record: " + i + " did not match\n" + record + "\n" + readRecord);
198+
sbcPassed = false;
173199
}
174200
}
175201
}
202+
203+
assertTrue("Unicode EOS character test failed. See mismatches above.", unicodePassed);
204+
assertTrue("Single byte EOS character test failed. See mismatches above.", sbcPassed);
176205
}
177206

178207
@Test

wsclient/src/main/java/org/hpccsystems/ws/client/antlr/EclRecord.g4

+14-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ opts:
7777
opt:
7878
maxlength
7979
| maxcount
80+
| setdefaultvalall
81+
| setdefaultval
8082
| defaultval
8183
| xpath
8284
| xmldefaultval
@@ -93,7 +95,7 @@ maxcount:
9395
;
9496

9597
defaultval:
96-
'DEFAULT' OPAREN STRING CPAREN
98+
('DEFAULT' OPAREN STRING CPAREN)
9799
;
98100

99101
xpath:
@@ -104,6 +106,13 @@ xmldefaultval:
104106
'XMLDEFAULT' OPAREN STRING CPAREN
105107
;
106108

109+
setdefaultval:
110+
'DEFAULT' OPAREN SETSTRING CPAREN
111+
;
112+
setdefaultvalall:
113+
'DEFAULT' OPAREN 'ALL' CPAREN
114+
;
115+
107116
annotation_name : ATOKEN;
108117
annotation_param : (TOKEN|UTOKEN);
109118
annotation_arguments : annotation_param (COMMA annotation_param)*;
@@ -114,6 +123,8 @@ comment:
114123
( '/*' annotation? (COMMA annotation)* .*? (.*?'*/' | '*/'))
115124
;
116125

126+
OSQUARE : '[';
127+
CSQUARE : ']';
117128
OPAREN : '(';
118129
CPAREN : ')';
119130
OCURLY : '{';
@@ -130,9 +141,11 @@ DATASET_SYM : 'DATASET';
130141
WS : [ \t\r\n] -> skip;
131142
INT : [0-9]+ ;
132143
fragment ESCAPED_QUOTE : '\\\'';
144+
SETSTRING : '[\'' ( ESCAPED_QUOTE | SETTOKEN | ('\'') | ~(']'))* '\']';
133145
STRING : '\'' ( ESCAPED_QUOTE | ~('\'') )* '\'';
134146
ATOKEN: [@][a-zA-Z0-9_-]+[a-zA-Z0-9_];
135147
TOKEN : ~[_\r\n\t; (),:={}-]~[\r\n \t;(),:={}-]* ;
136148
UTOKEN: [_]+[a-zA-Z0-9_-]+[a-zA-Z0-9_];
137149
ECL_NUMBERED_TYPE: TOKEN INT?;
150+
SETTOKEN: [a-zA-Z0-9,_-];
138151

0 commit comments

Comments
 (0)