Skip to content

Commit 0db3e77

Browse files
authored
Merge pull request #4523 from communitybridge/unicron-4519
4519: Fix edge case - when there are no corporate contributors
2 parents 1b8d869 + 7093290 commit 0db3e77

File tree

8 files changed

+127
-6
lines changed

8 files changed

+127
-6
lines changed

.github/workflows/build-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Setup python
3737
uses: actions/setup-python@v4
3838
with:
39-
python-version: '3.7'
39+
python-version: '3.8'
4040
cache: 'pip'
4141
- name: Cache Go modules
4242
uses: actions/cache@v2
@@ -103,4 +103,4 @@ jobs:
103103
104104
- name: Go Lint
105105
working-directory: cla-backend-go
106-
run: make lint
106+
run: make lint

.github/workflows/deploy-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Setup python
3737
uses: actions/setup-python@v4
3838
with:
39-
python-version: '3.7'
39+
python-version: '3.8'
4040
cache: 'pip'
4141
- name: Configure AWS Credentials
4242
uses: aws-actions/configure-aws-credentials@v4

.github/workflows/deploy-prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Setup python
4040
uses: actions/setup-python@v4
4141
with:
42-
python-version: '3.7'
42+
python-version: '3.8'
4343
cache: 'pip'
4444
- name: Configure AWS Credentials
4545
uses: aws-actions/configure-aws-credentials@v4

.github/workflows/deploy-staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Setup python
4040
uses: actions/setup-python@v4
4141
with:
42-
python-version: '3.7'
42+
python-version: '3.8'
4343
cache: 'pip'
4444
- name: Configure AWS Credentials
4545
uses: aws-actions/configure-aws-credentials@v4

cla-backend-go/signatures/repository.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4704,6 +4704,9 @@ func (repo repository) GetClaGroupCorporateContributors(ctx context.Context, cla
47044704
}
47054705

47064706
out := &models.CorporateContributorList{List: make([]*models.CorporateContributor, 0)}
4707+
if totalCount == 0 {
4708+
return out, nil
4709+
}
47074710
var lastEvaluatedKey string
47084711

47094712
currentCount := int64(0)

cla-backend/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,3 @@ Werkzeug==0.15.5
6060
wrapt==1.11.2
6161
zipp==3.15.0
6262
markupsafe==2.0.1
63-
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
# API_URL=https://[xyz].ngrok-free.app (defaults to localhost:5000)
3+
# cla_group='01af041c-fa69-4052-a23c-fb8c1d3bef24'
4+
# company_id='1dd8c59d-24cd-4155-9c6f-d4ac15ad5857'
5+
# TOKEN='...' - Auth0 JWT bearer token
6+
# XACL='...' - X-ACL
7+
# DEBUG=1 ./utils/cla_group_corporate_contributors.sh 01af041c-fa69-4052-a23c-fb8c1d3bef24 1dd8c59d-24cd-4155-9c6f-d4ac15ad5857
8+
9+
if [ -z "$TOKEN" ]
10+
then
11+
# source ./auth0_token.secret
12+
TOKEN="$(cat ./auth0.token.secret)"
13+
fi
14+
15+
if [ -z "$TOKEN" ]
16+
then
17+
echo "$0: TOKEN not specified and unable to obtain one"
18+
exit 1
19+
fi
20+
21+
if [ -z "$XACL" ]
22+
then
23+
XACL="$(cat ./x-acl.secret)"
24+
fi
25+
26+
if [ -z "$XACL" ]
27+
then
28+
echo "$0: XACL not specified and unable to obtain one"
29+
exit 2
30+
fi
31+
32+
if [ -z "$1" ]
33+
then
34+
echo "$0: you need to specify cla_group UUID as a 1st parameter, example: '01af041c-fa69-4052-a23c-fb8c1d3bef24'"
35+
exit 3
36+
fi
37+
export cla_group="$1"
38+
39+
if [ -z "$2" ]
40+
then
41+
echo "$0: you need to specify company_id as a 2nd parameter, example: '1dd8c59d-24cd-4155-9c6f-d4ac15ad5857'"
42+
exit 4
43+
fi
44+
export company_id="$2"
45+
46+
if [ -z "$3" ]
47+
then
48+
echo "$0: assuming page_size 9999, you can specify page size as a 3rd argument"
49+
export page_size="9999"
50+
else
51+
export page_size="$3"
52+
fi
53+
54+
if [ -z "$API_URL" ]
55+
then
56+
export API_URL="http://localhost:5000"
57+
fi
58+
59+
if [ ! -z "$DEBUG" ]
60+
then
61+
echo "curl -s -XGET -H 'X-ACL: ${XACL}' -H 'Authorization: Bearer ${TOKEN}' -H 'Content-Type: application/json' '${API_URL}/v4/cla-services/cla-group/${cla_group}/corporate-contributors?companyID=${company_id}&pageSize=${page_size}'"
62+
fi
63+
curl -s -XGET -H "X-ACL: ${XACL}" -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" "${API_URL}/v4/cla-group/${cla_group}/corporate-contributors?companyID=${company_id}&pageSize=${page_size}"
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
# API_URL=https://[xyz].ngrok-free.app (defaults to localhost:5000)
3+
# company_id='1dd8c59d-24cd-4155-9c6f-d4ac15ad5857'
4+
# project_sfid='a09P000000DsCE5IAN'
5+
# TOKEN='...' - Auth0 JWT bearer token
6+
# XACL='...' - X-ACL
7+
# DEBUG=1 ./utils/company_project_contributors.sh 1dd8c59d-24cd-4155-9c6f-d4ac15ad5857 a09P000000DsCE5IAN
8+
9+
if [ -z "$TOKEN" ]
10+
then
11+
# source ./auth0_token.secret
12+
TOKEN="$(cat ./auth0.token.secret)"
13+
fi
14+
15+
if [ -z "$TOKEN" ]
16+
then
17+
echo "$0: TOKEN not specified and unable to obtain one"
18+
exit 1
19+
fi
20+
21+
if [ -z "$XACL" ]
22+
then
23+
XACL="$(cat ./x-acl.secret)"
24+
fi
25+
26+
if [ -z "$XACL" ]
27+
then
28+
echo "$0: XACL not specified and unable to obtain one"
29+
exit 2
30+
fi
31+
32+
if [ -z "$1" ]
33+
then
34+
echo "$0: you need to specify company_id as a 1st parameter, example: '1dd8c59d-24cd-4155-9c6f-d4ac15ad5857'"
35+
exit 3
36+
fi
37+
export company_id="$1"
38+
39+
if [ -z "$2" ]
40+
then
41+
echo "$0: you need to specify project_sfid as a 2nd parameter, example: 'a09P000000DsCE5IAN'"
42+
exit 4
43+
fi
44+
export project_sfid="$2"
45+
46+
47+
if [ -z "$API_URL" ]
48+
then
49+
export API_URL="http://localhost:5000"
50+
fi
51+
52+
if [ ! -z "$DEBUG" ]
53+
then
54+
echo "curl -s -XGET -H 'X-ACL: ${XACL}' -H 'Authorization: Bearer ${TOKEN}' -H 'Content-Type: application/json' '${API_URL}/v4/company/${company_id}/project/${project_sfid}/contributors'"
55+
fi
56+
curl -s -XGET -H "X-ACL: ${XACL}" -H "Authorization: Bearer ${TOKEN}" -H "Content-Type: application/json" "${API_URL}/v4/company/${company_id}/project/${project_sfid}/contributors"

0 commit comments

Comments
 (0)