Skip to content

Commit 8ef4d50

Browse files
Element datetime fix (#345)
* Modified generate.sh so you can test generation with local files Fixed issue with sed not working * Fix issue where some strings were being automatically converted in Symphony Element Forms * Update to upload-artifact@v4 * Update github actions as v2 is deprecated * Change to upload-artifact v3 * Update dependencies to fix security vulnerabilities * Update testing dependencies * New Lock file * Updated tests due to issue with aiohttp 3.10.x * Exclude Vulnerability 70612
1 parent e31a701 commit 8ef4d50

14 files changed

Lines changed: 201 additions & 136 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ jobs:
2222
path: ~\AppData\Local\pypoetry\Cache\virtualenvs
2323

2424
steps:
25-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v4
2626

2727
- name: Set up Python ${{ matrix.python-version }}
2828
id: setup-python
29-
uses: actions/setup-python@v2
29+
uses: actions/setup-python@v4
3030
with:
3131
python-version: ${{ matrix.python-version }}
3232

@@ -35,7 +35,7 @@ jobs:
3535
run: |
3636
echo "::set-output name=dir::$(pip cache dir)"
3737
- name: Cache pip dependencies
38-
uses: actions/cache@v2
38+
uses: actions/cache@v4
3939
with:
4040
path: ${{ steps.pip-cache.outputs.dir }}
4141
key: ${{ runner.os }}-pip-${{ steps.setup-python.outputs.python-version }}
@@ -44,7 +44,7 @@ jobs:
4444
run: pip install poetry
4545

4646
- name: Cache poetry
47-
uses: actions/cache@v2
47+
uses: actions/cache@v4
4848
with:
4949
path: ${{ matrix.path }}
5050
key: ${{ runner.os }}-poetry-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
@@ -58,14 +58,14 @@ jobs:
5858
timeout-minutes: 10
5959

6060
- name: Upload test results
61-
uses: actions/upload-artifact@v2
61+
uses: actions/upload-artifact@v3
6262
with:
6363
name: pytest-results-${{ matrix.os }}
6464
path: test-results/junit.xml
6565
if: ${{ always() }}
6666

6767
- name: Upload test coverage
68-
uses: actions/upload-artifact@v2
68+
uses: actions/upload-artifact@v3
6969
with:
7070
name: pytest-coverage-${{ matrix.os }}
7171
path: htmlcov

.github/workflows/cve-scanning-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
name: Build and test App
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2121
- uses: actions/setup-python@v4
2222
with:
2323
python-version: "3.10"

.github/workflows/license-scanning-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: Scan for licenses
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- uses: actions/setup-python@v4
2020
with:
2121
python-version: "3.10"

.github/workflows/push.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
security:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@master
11+
- uses: actions/checkout@v4
1212
- name: Run Snyk to check for vulnerabilities
1313
uses: snyk/actions/python@b98d498629f1c368650224d6d212bf7dfa89e4bf
1414
env:
@@ -20,13 +20,13 @@ jobs:
2020
documentation:
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v2
23+
- uses: actions/checkout@v4
2424
with:
2525
fetch-depth: 0
2626

2727
- name: Set up Python 3.8
2828
id: setup-python
29-
uses: actions/setup-python@v2
29+
uses: actions/setup-python@v4
3030
with:
3131
python-version: 3.8
3232

@@ -41,7 +41,7 @@ jobs:
4141
echo "::set-output name=dir::$(pip cache dir)"
4242
4343
- name: Cache pip dependencies
44-
uses: actions/cache@v2
44+
uses: actions/cache@v4
4545
with:
4646
path: ${{ steps.pip-cache.outputs.dir }}
4747
key: ${{ runner.os }}-pip-${{ steps.setup-python.outputs.python-version }}
@@ -50,7 +50,7 @@ jobs:
5050
run: pip install poetry
5151

5252
- name: Cache poetry
53-
uses: actions/cache@v2
53+
uses: actions/cache@v4
5454
with:
5555
path: ~/.cache/pypoetry/virtualenvs
5656
key: ${{ runner.os }}-poetry-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}

.github/workflows/pylint.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313

1414
steps:
1515
- name: Checkout Code
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1717

1818
- name: Set up Python 3.8
1919
id: setup-python
20-
uses: actions/setup-python@v2
20+
uses: actions/setup-python@v4
2121
with:
2222
python-version: 3.8
2323

@@ -27,7 +27,7 @@ jobs:
2727
echo "::set-output name=dir::$(pip cache dir)"
2828
2929
- name: Cache pip dependencies
30-
uses: actions/cache@v2
30+
uses: actions/cache@v4
3131
with:
3232
path: ${{ steps.pip-cache.outputs.dir }}
3333
key: ${{ runner.os }}-pip-${{ steps.setup-python.outputs.python-version }}
@@ -50,7 +50,7 @@ jobs:
5050

5151
- name: Upload Pylint results
5252
if: ${{ always() }}
53-
uses: actions/upload-artifact@v2
53+
uses: actions/upload-artifact@v3
5454
with:
5555
name: .pylint.d
5656
path: ~/.pylint.d

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515

1616
- name: Set up Python 3.8
17-
uses: actions/setup-python@v2
17+
uses: actions/setup-python@v4
1818
with:
1919
python-version: 3.8
2020

.github/workflows/security.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313

1414
steps:
1515
- name: Checkout Code
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1717

1818
- name: Set up Python 3.8
1919
id: setup-python
20-
uses: actions/setup-python@v2
20+
uses: actions/setup-python@v4
2121
with:
2222
python-version: 3.8
2323

@@ -27,7 +27,7 @@ jobs:
2727
echo "::set-output name=dir::$(pip cache dir)"
2828
2929
- name: Cache pip dependencies
30-
uses: actions/cache@v2
30+
uses: actions/cache@v4
3131
with:
3232
path: ${{ steps.pip-cache.outputs.dir }}
3333
key: ${{ runner.os }}-pip-${{ steps.setup-python.outputs.python-version }}
@@ -36,7 +36,7 @@ jobs:
3636
run: pip install poetry
3737

3838
- name: Cache poetry
39-
uses: actions/cache@v2
39+
uses: actions/cache@v4
4040
with:
4141
path: ~/.cache/pypoetry/virtualenvs
4242
key: ${{ runner.os }}-poetry-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}

.github/workflows/semgrep.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
container:
1010
image: returntocorp/semgrep
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313
- run: semgrep scan --error --config auto
1414
env:
1515
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}

.safety-policy.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ security: # configuration for the `safety check` command
77
#25853: # Example vulnerability ID
88
# reason: we do not use the vulnerable function # optional, for internal note purposes to communicate with your team. This reason will be reported in the Safety reports
99
# expires: '2022-10-21' # datetime string - date this ignore will expire, best practice to use this variable
10-
continue-on-vulnerability-error: False # Suppress non-zero exit codes when vulnerabilities are found. Enable this in pipelines and CI/CD processes if you want to pass builds that have vulnerabilities
10+
70612:
11+
reason: The maintainer and multiple third parties believe that this vulnerability isn't valid because users shouldn't use untrusted templates without sandboxing.
12+
continue-on-vulnerability-error: False # Suppress non-zero exit codes when vulnerabilities are found. Enable this in pipelines and CI/CD processes if you want to pass builds that have vulnerabilities

api_client_generation/generate.sh

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,77 @@ code_gen_dir=`pwd`
44
project_root=$code_gen_dir/..
55
echo $code_gen_dir
66

7-
commit_hash=30fcab0fe6eaa26dcc46e7dc5909467332ec8d0d
7+
commit_hash=ab10aa5263cfed89ddae0720cea31eca0c06a003
88
api_spec_base_url=https://raw.githubusercontent.com/symphonyoss/symphony-api-spec/${commit_hash}
99
echo $api_spec_base_url
1010

11+
#local_api_spec_base_url=./local
12+
1113
# This function accepts the following parameters (in order):
1214
# - name of the module we want to generate
1315
# - uri of the file to be used for generation
1416
# - uri of the support file needed for the generation
15-
generate_files() {
17+
download_and_generate_files() {
1618
name=$1
1719
file_url=$2
1820
file_name=${file_url##*/}
1921
support_file_url=$3
2022
support_file_name=${support_file_url##*/}
2123

24+
download_files ${file_url} ${file_name} ${support_file_url} ${support_file_name}
25+
generate_files ${name} ${file_name}
26+
cleanup_files ${file_name} ${support_file_name}
27+
}
2228

29+
download_files() {
2330
# download files
31+
file_url=$1
32+
file_name=$2
33+
support_file_url=$3
34+
support_file_name=$4
35+
2436
cd $code_gen_dir
2537
curl $file_url -o $file_name
2638
if [ ! -z "${support_file_name}" ]
2739
then
2840
curl $support_file_url -o $support_file_name
2941
fi
42+
}
43+
44+
generate_files() {
45+
46+
name=$1
47+
file_name=$2
3048

3149
# generate files
3250
java -jar openapi-generator-cli.jar generate -g python -i $file_name --package-name symphony.bdk.gen -o output
3351

3452
# update api files
3553
cd $code_gen_dir/output/symphony/bdk/gen/api/
36-
sed -i ".bak" "s/symphony\.bdk\.gen\.model\./symphony\.bdk\.gen\.${name}_model\./g" *.py
37-
sed -i ".bak" "s/ api\./ ${name}_api\./g" *.py
54+
sed -i "s/symphony\.bdk\.gen\.model\./symphony\.bdk\.gen\.${name}_model\./g" *.py
55+
sed -i "s/ api\./ ${name}_api\./g" *.py
3856
rm __init__.py # we don't care about __init__.py files
3957
cp *.py $project_root/symphony/bdk/gen/${name}_api
4058

4159
# update model files
4260
cd $code_gen_dir/output/symphony/bdk/gen/model/
43-
sed -i ".bak" "s/symphony\.bdk\.gen\.model\./symphony\.bdk\.gen\.${name}_model\./g" *.py
44-
sed -i ".bak" "s/model /${name}_model /g" *.py
61+
sed -i "s/symphony\.bdk\.gen\.model\./symphony\.bdk\.gen\.${name}_model\./g" *.py
62+
sed -i "s/model /${name}_model /g" *.py
4563
rm __init__.py # we don't care about __init__.py files
4664
cp *.py $project_root/symphony/bdk/gen/${name}_model
4765

4866
# update rest.py
4967
cd $code_gen_dir/output/symphony/bdk/gen
5068
cp rest.py $project_root/symphony/bdk/gen/rest.py
5169

70+
cd $code_gen_dir
71+
rm -r output
72+
}
73+
74+
cleanup_files() {
75+
file_name=$1
76+
support_file_name=$2
77+
5278
# remove downloaded files
5379
cd $code_gen_dir
5480
rm -r output
@@ -57,12 +83,13 @@ generate_files() {
5783
then
5884
rm $support_file_name
5985
fi
60-
6186
}
6287

88+
6389
generate_files agent ${api_spec_base_url}/agent/agent-api-public-deprecated.yaml
6490
generate_files auth ${api_spec_base_url}/authenticator/authenticator-api-public-deprecated.yaml
6591
generate_files login ${api_spec_base_url}/login/login-api-public.yaml
6692
generate_files pod ${api_spec_base_url}/pod/pod-api-public.yaml
67-
6893
generate_files group ${api_spec_base_url}/profile-manager/profile-manager-api.yaml ${api_spec_base_url}/profile-manager/symphony-common-definitions.yaml
94+
95+
#generate_files agent ${local_api_spec_base_url}/agent-api-public-deprecated-formValues-modified.yaml

0 commit comments

Comments
 (0)