-
Notifications
You must be signed in to change notification settings - Fork 110
Run Greengrass samples in CI #717
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
Changes from all commits
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
3f51681
Run example gg component
sfodagain 45f7f1f
Check log file
sfodagain ea0cfc8
Remove java extra test
sfodagain 04f4034
Working with precompiled binary
sfodagain 8c3e59c
Use gg ipc sample
sfodagain 83ab376
Setup gg ipc in sample dir
sfodagain 4054f8b
Fix policy
sfodagain e320c16
Add CI job
sfodagain 44eb61c
Fix gdk version
sfodagain 7cb8f76
Another working dir
sfodagain 40cdcff
Build sources
sfodagain 4ba3b9a
Add new builder variant for GG only
sfodagain e71fcef
Debugging
sfodagain a6554ec
Temporary reconfig for builder
sfodagain 5330622
Fix path
sfodagain 8c068df
More levels
sfodagain b7424bb
fixup
sfodagain b0746fe
fixup
sfodagain 15aa9db
Playing with CI
sfodagain 3db2490
Do not setup Java
sfodagain 8917feb
Remove test path
sfodagain 445f503
Fix path
sfodagain 9366f3a
Run predefined gg core
sfodagain 6e192fd
fixup
sfodagain 3dccd48
Check gg core
sfodagain bd6d6c1
Use predefined gg core one more time
sfodagain a2e530b
Try to remove gg core from recipe
sfodagain 05c4d62
Add background
sfodagain ee02511
Echo gg core thing
sfodagain ea00deb
Roll back gg core creation
sfodagain ddebc7d
Increase timeout
sfodagain 9dde71f
Print test logs
sfodagain 9ad99af
Remove installing gg core
sfodagain 687259f
Run test using run_in_ci
sfodagain da6094c
fixup
sfodagain 0ecdc87
Add basic discovery to CI
sfodagain 7747ff9
Enable gg discovery in CI
sfodagain 39d5db7
Fix discovery CI
sfodagain d876163
fixup
sfodagain 91a73bb
fixup
sfodagain 1873232
Show associated devices
sfodagain b424777
Associate device with gg core
sfodagain fb8eb88
Use startup
sfodagain 2522862
fixup
sfodagain 0d96bb5
Add sleep
sfodagain 4e9f540
fixup
sfodagain 2380aa3
Try without print_discover_resp_only flag
sfodagain e706dae
Revert
sfodagain 2d14cba
Try topic
sfodagain d85cb69
Add component for discovery
sfodagain a4e9c45
Run discovery within component
sfodagain f901fcc
format
sfodagain bb46c89
Missing include
sfodagain c52ee96
Add artifact
sfodagain c1a602b
Add config to artifacts
sfodagain 2ab1aca
Fix log filename
sfodagain b83e05f
Install awsiotsdk
sfodagain 01865d9
Add print message
sfodagain 98b6f9e
Fix log message
sfodagain f0cea9e
Use more suitable thing
sfodagain ed1449c
fixup
sfodagain 0d2516a
fixup
sfodagain 336408c
fixup
sfodagain fa15466
Use the right thing
sfodagain 73a379c
Enable all CI jobs
sfodagain 1543e0a
Build only GG samples in GG CI job
sfodagain 79650ea
Add comments
sfodagain 4a10bff
Increase timeouts
sfodagain 0c4f49d
Move CI config to github dir
sfodagain 18bf7d7
Move test into a separate dir
sfodagain c46fc23
Move ipc test into a separate dir
sfodagain b929c2d
fixup
sfodagain a1fc3cf
fixup
sfodagain dc75a9b
Disable old sample run
sfodagain a89837c
Add readmes, review policies
sfodagain 168271d
Restrict policy
sfodagain c12a37e
Merge branch 'main' into add-gg-ci-job
sfod 62c4505
Get input from file
sfodagain bb58a2b
Merge branch 'main' into add-gg-ci-job
sfodagain bc27500
CLean CI config
sfodagain 0506505
Sync run_in_in_ci.py
sfodagain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0. | ||
|
||
import Builder | ||
import os | ||
|
||
|
||
class BuildGGSamples(Builder.Action): | ||
""" | ||
Defines a custom build step for Greengrass samples. | ||
It's used via builder.json config file in the project root directory. | ||
""" | ||
|
||
def run(self, env): | ||
# parse extra cmake configs | ||
cmd_args = env.args | ||
|
||
steps = [] | ||
samples = [ | ||
'samples/greengrass/ipc', | ||
'samples/greengrass/basic_discovery', | ||
] | ||
|
||
for sample_path in samples: | ||
build_path = os.path.join('build', sample_path) | ||
steps.append(['cmake', | ||
f'-B{build_path}', | ||
f'-H{sample_path}', | ||
f'-DCMAKE_PREFIX_PATH={env.install_dir}', | ||
'-DCMAKE_BUILD_TYPE=RelWithDebInfo']) | ||
# append extra cmake configs | ||
steps[-1].extend(cmd_args.cmake_extra) | ||
steps.append(['cmake', | ||
'--build', build_path, | ||
'--config', 'RelWithDebInfo']) | ||
|
||
return Builder.Script(steps) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ env: | |
CI_X509_ROLE: arn:aws:iam::180635532705:role/CI_X509_Role | ||
CI_MQTT5_ROLE: arn:aws:iam::180635532705:role/CI_MQTT5_Role | ||
CI_GREENGRASS_ROLE: arn:aws:iam::180635532705:role/CI_Greengrass_Role | ||
CI_GREENGRASS_INSTALLER_ROLE: arn:aws:iam::180635532705:role/CI_GreengrassInstaller_Role | ||
CI_JOBS_SERVICE_CLIENT_ROLE: arn:aws:iam::180635532705:role/CI_JobsServiceClient_Role | ||
CI_SHADOW_SERVICE_CLIENT_ROLE: arn:aws:iam::180635532705:role/CI_ShadowServiceClient_Role | ||
|
||
|
@@ -641,14 +642,66 @@ jobs: | |
- name: run X509 sample | ||
run: | | ||
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_x509_connect_cfg.json | ||
- name: configure AWS credentials (Greengrass) | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
role-to-assume: ${{ env.CI_GREENGRASS_ROLE }} | ||
aws-region: ${{ env.AWS_DEFAULT_REGION }} | ||
- name: run Greengrass Discovery sample | ||
|
||
# Runs the Greengrass samples | ||
linux-greengrass-tests: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write # This is required for requesting the JWT | ||
steps: | ||
- name: Setup C++ | ||
run: | | ||
sudo apt-get -qq update -y | ||
sudo apt-get -qq install -y build-essential | ||
sudo apt install cmake | ||
gcc --version | ||
cmake --version | ||
- name: Build ${{ env.PACKAGE_NAME }} + consumers | ||
run: | | ||
python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_greengrass_discovery_cfg.json | ||
echo "Downloading source" | ||
git clone --recursive https://github.com/aws/aws-iot-device-sdk-cpp-v2.git --branch ${{ env.HEAD_REF || github.ref_name }} | ||
echo "Running builder" | ||
python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" | ||
python builder.pyz build -p ${{ env.PACKAGE_NAME }} --variant build_gg_samples_only | ||
- name: Install Greengrass Development Kit | ||
run: | | ||
python3 -m pip install awsiotsdk | ||
python3 -m pip install -U git+https://github.com/aws-greengrass/[email protected] | ||
- name: Configure AWS credentials (Greengrass) | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
role-to-assume: ${{ env.CI_GREENGRASS_INSTALLER_ROLE }} | ||
aws-region: ${{ env.AWS_DEFAULT_REGION }} | ||
- name: Build and run Greengrass basic discovery sample | ||
working-directory: ./aws-iot-device-sdk-cpp-v2/tests/greengrass/basic_discovery | ||
run: | | ||
gdk component build | ||
gdk test-e2e build | ||
gdk test-e2e run | ||
- name: Show logs | ||
working-directory: ./aws-iot-device-sdk-cpp-v2/tests/greengrass/basic_discovery | ||
# Print logs unconditionally to provide more details on Greengrass run even if the test failed. | ||
if: always() | ||
run: | | ||
echo "=== greengrass.log" | ||
cat testResults/gg*/greengrass.log | ||
echo "=== software.amazon.awssdk.sdk-gg-test-discovery.log" | ||
cat testResults/gg*/software.amazon.awssdk.sdk-gg-test-discovery.log | ||
- name: Build and run Greengrass IPC sample | ||
working-directory: ./aws-iot-device-sdk-cpp-v2/tests/greengrass/ipc | ||
run: | | ||
gdk component build | ||
gdk test-e2e build | ||
gdk test-e2e run | ||
- name: Show logs | ||
working-directory: ./aws-iot-device-sdk-cpp-v2/tests/greengrass/ipc | ||
# Print logs unconditionally to provide more details on Greengrass run even if the test failed. | ||
if: always() | ||
run: | | ||
echo "=== greengrass.log" | ||
cat testResults/gg*/greengrass.log | ||
echo "=== software.amazon.awssdk.sdk-gg-ipc.log" | ||
cat testResults/gg*/software.amazon.awssdk.sdk-gg-ipc.log | ||
|
||
# check that docs can still build | ||
check-docs: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,35 @@ | ||
{ | ||
"language": "CPP", | ||
"sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/greengrass/basic_discovery/basic-discovery", | ||
"sample_region": "us-east-1", | ||
"sample_main_class": "", | ||
"runnable_file": "basic-discovery", | ||
"runnable_region": "us-east-1", | ||
"runnable_main_class": "", | ||
"arguments": [ | ||
{ | ||
"name": "--cert", | ||
"secret": "ci/Greengrass/cert", | ||
"secret": "ci/GreengrassDiscovery/cert", | ||
"filename": "tmp_certificate.pem" | ||
}, | ||
{ | ||
"name": "--key", | ||
"secret": "ci/Greengrass/key", | ||
"secret": "ci/GreengrassDiscovery/key", | ||
"filename": "tmp_key.pem" | ||
}, | ||
{ | ||
"name": "--ca_file", | ||
"secret": "ci/Greengrass/ca", | ||
"filename": "tmp_ca.pem" | ||
"name": "--thing_name", | ||
"data": "CI_Greengrass_Discovery_Thing" | ||
}, | ||
{ | ||
"name": "--region", | ||
"data": "us-east-1" | ||
}, | ||
{ | ||
"name": "--thing_name", | ||
"data": "CI_GreenGrass_Thing" | ||
}, | ||
{ | ||
"name": "--is_ci", | ||
"data": "true" | ||
"name": "--topic", | ||
"data": "clients/CI_Greengrass_Discovery_Thing/hello/world/$INPUT_UUID" | ||
}, | ||
{ | ||
"name": "--print_discover_resp_only", | ||
"data": "" | ||
"name": "--mode", | ||
"data": "publish" | ||
} | ||
] | ||
], | ||
"stdin_file": "messages.txt" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"language": "CPP", | ||
"runnable_file": "greengrass-ipc", | ||
"runnable_region": "us-east-1", | ||
"runnable_main_class": "", | ||
"arguments": [ | ||
{ | ||
"name": "--topic", | ||
"data": "test/gg-ipc-topic" | ||
}, | ||
{ | ||
"name": "--message", | ||
"data": "hello" | ||
}, | ||
{ | ||
"name": "--is_ci", | ||
"data": "true" | ||
} | ||
|
||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.