Skip to content

Commit c651e34

Browse files
Merge pull request #4773 from linuxfoundation/unicron-fix-github-installation-and-merge-queue
Unicron fix GitHub installation and merge queue
2 parents 0799a5d + 74c21cc commit c651e34

File tree

3 files changed

+24
-37
lines changed

3 files changed

+24
-37
lines changed

cla-backend/cla/models/dynamo_models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4000,6 +4000,10 @@ def __str__(self):
40004000
)
40014001

40024002
def to_dict(self):
4003+
if getattr(self.model, 'skip_cla', None) is None:
4004+
self.model.skip_cla = {}
4005+
if getattr(self.model, 'enable_co_authors', None) is None:
4006+
self.model.enable_co_authors = {}
40034007
ret = dict(self.model)
40044008

40054009
if "organization_installation_id" not in ret:

cla-backend/cla/models/github_models.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@ def received_activity(self, data):
139139
elif data["action"] == "checks_requested":
140140
cla.log.debug("github_models.received_activity - Handling checks requested pull request")
141141
return self.process_checks_requested_merge_group(data)
142-
elif data["action"] == "enqueued":
143-
cla.log.debug("github_models.received_activity - Handling enqueued pull request")
144-
return self.process_enqueued_pull_request(data)
145142
else:
146143
cla.log.debug("github_models.received_activity - Ignoring unsupported action: {}".format(data["action"]))
147144

@@ -459,30 +456,6 @@ def process_opened_pull_request(self, data):
459456
installation_id = data["installation"]["id"]
460457
self.update_change_request(installation_id, github_repository_id, pull_request_id)
461458

462-
def process_enqueued_pull_request(self, data):
463-
"""
464-
Helper method to handle a webhook fired from GitHub for an enqueued PR.
465-
466-
:param data: The data returned from GitHub on this webhook.
467-
:type data: dict
468-
"""
469-
merge_group_sha = data.get("pull_request", {}).get("merge_commit_sha")
470-
github_repository_id = data.get("repository", {}).get("id")
471-
installation_id = data.get("installation", {}).get("id")
472-
pull_request_id = data.get("pull_request", {}).get("number")
473-
if None in (installation_id, github_repository_id, merge_group_sha, pull_request_id):
474-
cla.log.warning(
475-
"process_enqueued_pull_request: Missing required field(s): "
476-
f"installation_id={installation_id}, "
477-
f"github_repository_id={github_repository_id}, "
478-
f"merge_group_sha={merge_group_sha}, "
479-
f"pull_request_id={pull_request_id}. "
480-
"Aborting update_merge_group."
481-
)
482-
return
483-
484-
self.update_merge_group(installation_id, github_repository_id, merge_group_sha, pull_request_id)
485-
486459
def process_checks_requested_merge_group(self, data):
487460
"""
488461
Helper method to handle a webhook fired from GitHub for a merge group event.

utils/search_aws_log_group.sh

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,34 @@ then
3535
exit 2
3636
fi
3737

38+
to_epoch_ms () {
39+
local v="$1"
40+
if [[ "$v" =~ ^[0-9]{13}$ ]]
41+
then
42+
echo "$v"; return
43+
fi
44+
if [[ "$v" =~ ^[0-9]{10}$ ]]
45+
then
46+
echo "${v}000"; return
47+
fi
48+
v="${v/T/ }"
49+
v="${v/Z/ UTC}"
50+
echo "$(date -d "$v" +%s)000"
51+
}
52+
3853
if [ -z "${DTFROM}" ]
3954
then
40-
export DTFROM="$(date -d '3 days ago' +%s)000"
55+
export DTFROM="$(to_epoch_ms '3 days ago')"
4156
else
42-
if [[ ! "$DTFROM" =~ ^[0-9]+$ ]]
43-
then
44-
export DTFROM="$(date -d "${DTFROM}" +%s)000"
45-
fi
57+
export DTFROM="$(to_epoch_ms "${DTFROM}")"
4658
fi
4759

60+
# DTTO
4861
if [ -z "${DTTO}" ]
4962
then
50-
export DTTO="$(date +%s)000"
63+
export DTTO="$(to_epoch_ms 'now')"
5164
else
52-
if [[ ! "$DTTO" =~ ^[0-9]+$ ]]
53-
then
54-
export DTTO="$(date -d "${DTTO}" +%s)000"
55-
fi
65+
export DTTO="$(to_epoch_ms "${DTTO}")"
5666
fi
5767

5868
if [ ! -z "${DEBUG}" ]

0 commit comments

Comments
 (0)