Skip to content

Run greengrass discovery in ci #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ env:
CI_SHADOW_ROLE: arn:aws:iam::180635532705:role/CI_Shadow_Role
CI_JOBS_ROLE: arn:aws:iam::180635532705:role/CI_Jobs_Role
CI_FLEET_PROVISIONING_ROLE: arn:aws:iam::180635532705:role/service-role/CI_FleetProvisioning_Role
CI_GREENGRASS_ROLE: arn:aws:iam::180635532705:role/CI_Greengrass_Role
CI_DEVICE_ADVISOR: arn:aws:iam::180635532705:role/CI_DeviceAdvisor_Role
CI_MQTT5_ROLE: arn:aws:iam::180635532705:role/CI_MQTT5_Role
CI_BUILD_AND_TEST_ROLE: arn:aws:iam::180635532705:role/V2_SDK_Unit_Testing
Expand Down Expand Up @@ -297,6 +298,14 @@ jobs:
Sample_UUID=$(python3 -c "import uuid; print (uuid.uuid4())")
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}
python3 ${{ env.CI_UTILS_FOLDER }}/delete_iot_thing_ci.py --thing_name "Fleet_Thing_${Sample_UUID}" --region "us-east-1"
- name: configure AWS credentials (Greengrass)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ env.CI_GREENGRASS_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Greengrass Discovery sample
run: |
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_greengrass_discovery_cfg.json

# check that docs can still build
check-docs:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/ci_run_greengrass_discovery_cfg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"language": "Python",
"sample_file": "./aws-iot-device-sdk-python-v2/samples/basic_discovery.py",
"sample_region": "us-east-1",
"sample_main_class": "",
"arguments": [
{
"name": "--cert",
"secret": "ci/Greengrass/cert",
"filename": "tmp_certificate.pem"
},
{
"name": "--key",
"secret": "ci/Greengrass/key",
"filename": "tmp_key.pem"
},
{
"name": "--ca_file",
"secret": "ci/Greengrass/ca",
"filename": "tmp_ca.pem"
},
{
"name": "--region",
"data": "us-east-1"
},
{
"name": "--thing_name",
"data": "CI_GreenGrass_Thing"
},
{
"name": "--is_ci",
"data": "true"
},
{
"name": "--print_discover_resp_only",
"data": ""
}
]
}
6 changes: 5 additions & 1 deletion samples/basic_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
resp_future = discovery_client.discover(cmdData.input_thing_name)
discover_response = resp_future.result()

print(discover_response)
if (cmdData.input_is_ci):
print("Received a greengrass discovery result! Not showing result in CI for possible data sensitivity.")
else:
print(discover_response)

if (cmdData.input_print_discovery_resp_only):
exit(0)

Expand Down
3 changes: 2 additions & 1 deletion utils/run_sample_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def setup_json_arguments_list(parsed_commands):
if isinstance(tmp_value, str) and 'input_uuid' in parsed_commands:
if ("$INPUT_UUID" in tmp_value):
tmp_value = tmp_value.replace("$INPUT_UUID", parsed_commands.input_uuid)
config_json_arguments_list.append(tmp_value)
if (tmp_value != None and tmp_value != ""):
config_json_arguments_list.append(tmp_value)

# None of the above? Just print an error
else:
Expand Down