Skip to content

Commit 871de07

Browse files
Run greengrass discovery in ci (#469)
Run Greengrass Basic Discovery in CI, increasing test coverage.
1 parent 65049b1 commit 871de07

File tree

4 files changed

+55
-2
lines changed

4 files changed

+55
-2
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ env:
2828
CI_SHADOW_ROLE: arn:aws:iam::180635532705:role/CI_Shadow_Role
2929
CI_JOBS_ROLE: arn:aws:iam::180635532705:role/CI_Jobs_Role
3030
CI_FLEET_PROVISIONING_ROLE: arn:aws:iam::180635532705:role/service-role/CI_FleetProvisioning_Role
31+
CI_GREENGRASS_ROLE: arn:aws:iam::180635532705:role/CI_Greengrass_Role
3132
CI_DEVICE_ADVISOR: arn:aws:iam::180635532705:role/CI_DeviceAdvisor_Role
3233
CI_MQTT5_ROLE: arn:aws:iam::180635532705:role/CI_MQTT5_Role
3334
CI_BUILD_AND_TEST_ROLE: arn:aws:iam::180635532705:role/V2_SDK_Unit_Testing
@@ -297,6 +298,14 @@ jobs:
297298
Sample_UUID=$(python3 -c "import uuid; print (uuid.uuid4())")
298299
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_fleet_provisioning_cfg.json --input_uuid ${Sample_UUID}
299300
python3 ${{ env.CI_UTILS_FOLDER }}/delete_iot_thing_ci.py --thing_name "Fleet_Thing_${Sample_UUID}" --region "us-east-1"
301+
- name: configure AWS credentials (Greengrass)
302+
uses: aws-actions/configure-aws-credentials@v1
303+
with:
304+
role-to-assume: ${{ env.CI_GREENGRASS_ROLE }}
305+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
306+
- name: run Greengrass Discovery sample
307+
run: |
308+
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_greengrass_discovery_cfg.json
300309
301310
# check that docs can still build
302311
check-docs:
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"language": "Python",
3+
"sample_file": "./aws-iot-device-sdk-python-v2/samples/basic_discovery.py",
4+
"sample_region": "us-east-1",
5+
"sample_main_class": "",
6+
"arguments": [
7+
{
8+
"name": "--cert",
9+
"secret": "ci/Greengrass/cert",
10+
"filename": "tmp_certificate.pem"
11+
},
12+
{
13+
"name": "--key",
14+
"secret": "ci/Greengrass/key",
15+
"filename": "tmp_key.pem"
16+
},
17+
{
18+
"name": "--ca_file",
19+
"secret": "ci/Greengrass/ca",
20+
"filename": "tmp_ca.pem"
21+
},
22+
{
23+
"name": "--region",
24+
"data": "us-east-1"
25+
},
26+
{
27+
"name": "--thing_name",
28+
"data": "CI_GreenGrass_Thing"
29+
},
30+
{
31+
"name": "--is_ci",
32+
"data": "true"
33+
},
34+
{
35+
"name": "--print_discover_resp_only",
36+
"data": ""
37+
}
38+
]
39+
}

samples/basic_discovery.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@
3737
resp_future = discovery_client.discover(cmdData.input_thing_name)
3838
discover_response = resp_future.result()
3939

40-
print(discover_response)
40+
if (cmdData.input_is_ci):
41+
print("Received a greengrass discovery result! Not showing result in CI for possible data sensitivity.")
42+
else:
43+
print(discover_response)
44+
4145
if (cmdData.input_print_discovery_resp_only):
4246
exit(0)
4347

utils/run_sample_ci.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ def setup_json_arguments_list(parsed_commands):
8383
if isinstance(tmp_value, str) and 'input_uuid' in parsed_commands:
8484
if ("$INPUT_UUID" in tmp_value):
8585
tmp_value = tmp_value.replace("$INPUT_UUID", parsed_commands.input_uuid)
86-
config_json_arguments_list.append(tmp_value)
86+
if (tmp_value != None and tmp_value != ""):
87+
config_json_arguments_list.append(tmp_value)
8788

8889
# None of the above? Just print an error
8990
else:

0 commit comments

Comments
 (0)