Skip to content

Commit

Permalink
Merge pull request #4523 from communitybridge/unicron-4519
Browse files Browse the repository at this point in the history
4519: Fix edge case - when there are no corporate contributors
  • Loading branch information
mlehotskylf authored Jan 22, 2025
2 parents 1b8d869 + 7093290 commit 0db3e77
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: '3.8'
cache: 'pip'
- name: Cache Go modules
uses: actions/cache@v2
Expand Down Expand Up @@ -103,4 +103,4 @@ jobs:
- name: Go Lint
working-directory: cla-backend-go
run: make lint
run: make lint
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: '3.8'
cache: 'pip'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: '3.8'
cache: 'pip'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: '3.8'
cache: 'pip'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
Expand Down
3 changes: 3 additions & 0 deletions cla-backend-go/signatures/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -4704,6 +4704,9 @@ func (repo repository) GetClaGroupCorporateContributors(ctx context.Context, cla
}

out := &models.CorporateContributorList{List: make([]*models.CorporateContributor, 0)}
if totalCount == 0 {
return out, nil
}
var lastEvaluatedKey string

currentCount := int64(0)
Expand Down
1 change: 0 additions & 1 deletion cla-backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,3 @@ Werkzeug==0.15.5
wrapt==1.11.2
zipp==3.15.0
markupsafe==2.0.1
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
63 changes: 63 additions & 0 deletions utils/cla_group_corporate_contributors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
# API_URL=https://[xyz].ngrok-free.app (defaults to localhost:5000)
# cla_group='01af041c-fa69-4052-a23c-fb8c1d3bef24'
# company_id='1dd8c59d-24cd-4155-9c6f-d4ac15ad5857'
# TOKEN='...' - Auth0 JWT bearer token
# XACL='...' - X-ACL
# DEBUG=1 ./utils/cla_group_corporate_contributors.sh 01af041c-fa69-4052-a23c-fb8c1d3bef24 1dd8c59d-24cd-4155-9c6f-d4ac15ad5857

if [ -z "$TOKEN" ]
then
# source ./auth0_token.secret
TOKEN="$(cat ./auth0.token.secret)"
fi

if [ -z "$TOKEN" ]
then
echo "$0: TOKEN not specified and unable to obtain one"
exit 1
fi

if [ -z "$XACL" ]
then
XACL="$(cat ./x-acl.secret)"
fi

if [ -z "$XACL" ]
then
echo "$0: XACL not specified and unable to obtain one"
exit 2
fi

if [ -z "$1" ]
then
echo "$0: you need to specify cla_group UUID as a 1st parameter, example: '01af041c-fa69-4052-a23c-fb8c1d3bef24'"
exit 3
fi
export cla_group="$1"

if [ -z "$2" ]
then
echo "$0: you need to specify company_id as a 2nd parameter, example: '1dd8c59d-24cd-4155-9c6f-d4ac15ad5857'"
exit 4
fi
export company_id="$2"

if [ -z "$3" ]
then
echo "$0: assuming page_size 9999, you can specify page size as a 3rd argument"
export page_size="9999"
else
export page_size="$3"
fi

if [ -z "$API_URL" ]
then
export API_URL="http://localhost:5000"
fi

if [ ! -z "$DEBUG" ]
then
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}'"
fi
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}"
56 changes: 56 additions & 0 deletions utils/company_project_contributors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
# API_URL=https://[xyz].ngrok-free.app (defaults to localhost:5000)
# company_id='1dd8c59d-24cd-4155-9c6f-d4ac15ad5857'
# project_sfid='a09P000000DsCE5IAN'
# TOKEN='...' - Auth0 JWT bearer token
# XACL='...' - X-ACL
# DEBUG=1 ./utils/company_project_contributors.sh 1dd8c59d-24cd-4155-9c6f-d4ac15ad5857 a09P000000DsCE5IAN

if [ -z "$TOKEN" ]
then
# source ./auth0_token.secret
TOKEN="$(cat ./auth0.token.secret)"
fi

if [ -z "$TOKEN" ]
then
echo "$0: TOKEN not specified and unable to obtain one"
exit 1
fi

if [ -z "$XACL" ]
then
XACL="$(cat ./x-acl.secret)"
fi

if [ -z "$XACL" ]
then
echo "$0: XACL not specified and unable to obtain one"
exit 2
fi

if [ -z "$1" ]
then
echo "$0: you need to specify company_id as a 1st parameter, example: '1dd8c59d-24cd-4155-9c6f-d4ac15ad5857'"
exit 3
fi
export company_id="$1"

if [ -z "$2" ]
then
echo "$0: you need to specify project_sfid as a 2nd parameter, example: 'a09P000000DsCE5IAN'"
exit 4
fi
export project_sfid="$2"


if [ -z "$API_URL" ]
then
export API_URL="http://localhost:5000"
fi

if [ ! -z "$DEBUG" ]
then
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'"
fi
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 comments on commit 0db3e77

Please sign in to comment.