Skip to content

Commit

Permalink
Change run_sample_ci.py to be more generic (#502)
Browse files Browse the repository at this point in the history
* Change run_sample_ci.py to be more generic
* Run fleet provisioning sample via script
  • Loading branch information
sfod authored Nov 7, 2023
1 parent 1d06bf1 commit 15fdb8d
Show file tree
Hide file tree
Showing 24 changed files with 205 additions and 129 deletions.
58 changes: 26 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,18 @@ jobs:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run PubSub sample
run: |
python ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
python ./utils/run_in_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
- name: run Windows Certificate Connect sample
run: |
python ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_windows_cert_connect_cfg.json
python ./utils/run_in_ci.py --file ./.github/workflows/ci_run_windows_cert_connect_cfg.json
- name: configure AWS credentials (MQTT5)
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run MQTT5 PubSub sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
- name: configure AWS credentials (Device Advisor)
uses: aws-actions/configure-aws-credentials@v2
with:
Expand Down Expand Up @@ -259,22 +259,22 @@ jobs:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run PubSub sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
- name: run PKCS12 Connect sample
run: |
cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > /tmp/certificate.pem
key=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/key" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > /tmp/privatekey.pem
pkcs12_password=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/key_pkcs12_password" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\")
openssl pkcs12 -export -in /tmp/certificate.pem -inkey /tmp/privatekey.pem -out ./pkcs12-key.p12 -name PubSub_Thing_Alias -password pass:$pkcs12_password
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_pkcs12_connect_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_pkcs12_connect_cfg.json
- name: configure AWS credentials (MQTT5)
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run MQTT5 PubSub sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
- name: configure AWS credentials (Device Advisor)
uses: aws-actions/configure-aws-credentials@v2
with:
Expand Down Expand Up @@ -334,15 +334,15 @@ jobs:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run PubSub sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
- name: configure AWS credentials (MQTT5)
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run MQTT5 PubSub sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
- name: configure AWS credentials (Device Advisor)
uses: aws-actions/configure-aws-credentials@v2
with:
Expand Down Expand Up @@ -478,109 +478,103 @@ jobs:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Basic Connect sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_basic_connect_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_basic_connect_cfg.json
- name: run Websocket Connect sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_websocket_connect_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_websocket_connect_cfg.json
- name: run PubSub sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_pubsub_cfg.json
- name: run CustomKeyOperations sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_custom_key_ops_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_custom_key_ops_cfg.json
- name: run PKCS11 Connect sample
run: |
mkdir -p /tmp/tokens
export SOFTHSM2_CONF=/tmp/softhsm2.conf
echo "directories.tokendir = /tmp/tokens" > /tmp/softhsm2.conf
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_pkcs11_connect_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_pkcs11_connect_cfg.json
- name: run Java keystore Connect sample
run: |
cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > /tmp/certificate.pem
key=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/key" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > /tmp/privatekey.pem
pkcs12_password=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/key_pkcs12_password" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\")
openssl pkcs12 -export -in /tmp/certificate.pem -inkey /tmp/privatekey.pem -out /tmp/pkcs12-key.p12 -name PubSub_Thing_Alias -password pass:$pkcs12_password
keytool -importkeystore -srckeystore /tmp/pkcs12-key.p12 -destkeystore ./java_keystore.keys -srcstoretype PKCS12 -alias PubSub_Thing_Alias -srcstorepass $pkcs12_password -deststorepass $pkcs12_password
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_keystore_connect_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_keystore_connect_cfg.json
- name: configure AWS credentials (Cognito)
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.CI_COGNITO_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run CognitoConnect sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_cognito_connect_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_cognito_connect_cfg.json
- name: configure AWS credentials (Custom Authorizer)
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.CI_CUSTOM_AUTHORIZER_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run CustomAuthorizerConnect sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_custom_authorizer_connect_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_custom_authorizer_connect_cfg.json
- name: configure AWS credentials (Shadow)
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.CI_SHADOW_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Shadow sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_shadow_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_shadow_cfg.json
- name: run Mqtt5 Shadow sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_shadow_mqtt5_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_shadow_mqtt5_cfg.json
- name: configure AWS credentials (Jobs)
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.CI_JOBS_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Jobs sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_jobs_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_jobs_cfg.json
- name: run Mqtt5 Jobs sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_jobs_mqtt5_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_jobs_mqtt5_cfg.json
- name: configure AWS credentials (Fleet provisioning)
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.CI_FLEET_PROVISIONING_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run Fleet Provisioning sample
run: |
echo "Generating UUID for IoT thing"
Sample_UUID=$(python3 -c "import uuid; print (uuid.uuid4())")
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_fleet_provisioning_cfg.json --input_uuid ${Sample_UUID}
python3 utils/delete_iot_thing_ci.py --thing_name "Fleet_Thing_${Sample_UUID}" --region "us-east-1"
python3 ./utils/run_fleet_provisioning_sample.py --file ./.github/workflows/ci_run_fleet_provisioning_cfg.json --thing-name-prefix "Fleet_Thing_"
- name: run Mqtt5 Fleet Provisioning sample
run: |
echo "Generating UUID for IoT thing"
Sample_UUID=$(python3 -c "import uuid; print (uuid.uuid4())")
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_fleet_provisioning_mqtt5_cfg.json --input_uuid ${Sample_UUID}
python3 utils/delete_iot_thing_ci.py --thing_name "Fleet_Thing_${Sample_UUID}" --region "us-east-1"
python3 ./utils/run_fleet_provisioning_sample.py --file ./.github/workflows/ci_run_fleet_provisioning_mqtt5_cfg.json --thing-name-prefix "Fleet_Thing_"
- name: configure AWS credentials (X509)
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.CI_X509_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run X509 sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_x509_connect_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_x509_connect_cfg.json
- name: configure AWS credentials (MQTT5)
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ env.CI_MQTT5_ROLE }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: run MQTT5 PubSub sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_mqtt5_pubsub_cfg.json
- name: run MQTT5 Shared Subscription sample
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_mqtt5_shared_subscription_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_mqtt5_shared_subscription_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
run: |
python3 ./utils/run_sample_ci.py --file ./.github/workflows/ci_run_greengrass_discovery_cfg.json
python3 ./utils/run_in_ci.py --file ./.github/workflows/ci_run_greengrass_discovery_cfg.json
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_basic_connect_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/BasicConnect",
"sample_region": "us-east-1",
"sample_main_class": "basicconnect.BasicConnect",
"runnable_file": "samples/BasicConnect",
"runnable_region": "us-east-1",
"runnable_main_class": "basicconnect.BasicConnect",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_cognito_connect_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/CognitoConnect",
"sample_region": "us-east-1",
"sample_main_class": "cognitoconnect.CognitoConnect",
"runnable_file": "samples/CognitoConnect",
"runnable_region": "us-east-1",
"runnable_main_class": "cognitoconnect.CognitoConnect",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_custom_authorizer_connect_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/CustomAuthorizerConnect",
"sample_region": "us-east-1",
"sample_main_class": "customauthorizerconnect.CustomAuthorizerConnect",
"runnable_file": "samples/CustomAuthorizerConnect",
"runnable_region": "us-east-1",
"runnable_main_class": "customauthorizerconnect.CustomAuthorizerConnect",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_custom_key_ops_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/CustomKeyOpsConnect",
"sample_region": "us-east-1",
"sample_main_class": "customkeyopsconnect.CustomKeyOpsConnect",
"runnable_file": "samples/CustomKeyOpsConnect",
"runnable_region": "us-east-1",
"runnable_main_class": "customkeyopsconnect.CustomKeyOpsConnect",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_fleet_provisioning_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/FleetProvisioning",
"sample_region": "us-east-1",
"sample_main_class": "fleetprovisioning.FleetProvisioningSample",
"runnable_file": "samples/FleetProvisioning",
"runnable_region": "us-east-1",
"runnable_main_class": "fleetprovisioning.FleetProvisioningSample",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_fleet_provisioning_mqtt5_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/FleetProvisioning",
"sample_region": "us-east-1",
"sample_main_class": "fleetprovisioning.Mqtt5FleetProvisioningSample",
"runnable_file": "samples/FleetProvisioning",
"runnable_region": "us-east-1",
"runnable_main_class": "fleetprovisioning.Mqtt5FleetProvisioningSample",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_greengrass_discovery_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/Greengrass",
"sample_region": "us-east-1",
"sample_main_class": "greengrass.BasicDiscovery",
"runnable_file": "samples/Greengrass",
"runnable_region": "us-east-1",
"runnable_main_class": "greengrass.BasicDiscovery",
"arguments": [
{
"name": "--cert",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_jobs_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/Jobs",
"sample_region": "us-east-1",
"sample_main_class": "jobs.JobsSample",
"runnable_file": "samples/Jobs",
"runnable_region": "us-east-1",
"runnable_main_class": "jobs.JobsSample",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_jobs_mqtt5_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/Jobs",
"sample_region": "us-east-1",
"sample_main_class": "jobs.Mqtt5JobsSample",
"runnable_file": "samples/Jobs",
"runnable_region": "us-east-1",
"runnable_main_class": "jobs.Mqtt5JobsSample",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_keystore_connect_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/JavaKeystoreConnect",
"sample_region": "us-east-1",
"sample_main_class": "javakeystoreconnect.JavaKeystoreConnect",
"runnable_file": "samples/JavaKeystoreConnect",
"runnable_region": "us-east-1",
"runnable_main_class": "javakeystoreconnect.JavaKeystoreConnect",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_mqtt5_pubsub_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/Mqtt5/PubSub",
"sample_region": "us-east-1",
"sample_main_class": "mqtt5.pubsub.PubSub",
"runnable_file": "samples/Mqtt5/PubSub",
"runnable_region": "us-east-1",
"runnable_main_class": "mqtt5.pubsub.PubSub",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_mqtt5_shared_subscription_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/Mqtt5/SharedSubscription",
"sample_region": "us-east-1",
"sample_main_class": "mqtt5.sharedsubscription.SharedSubscription",
"runnable_file": "samples/Mqtt5/SharedSubscription",
"runnable_region": "us-east-1",
"runnable_main_class": "mqtt5.sharedsubscription.SharedSubscription",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_pkcs11_connect_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/Pkcs11Connect",
"sample_region": "us-east-1",
"sample_main_class": "pkcs11connect.Pkcs11Connect",
"runnable_file": "samples/Pkcs11Connect",
"runnable_region": "us-east-1",
"runnable_main_class": "pkcs11connect.Pkcs11Connect",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_pkcs12_connect_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/Pkcs12Connect",
"sample_region": "us-east-1",
"sample_main_class": "pkcs12connect.Pkcs12Connect",
"runnable_file": "samples/Pkcs12Connect",
"runnable_region": "us-east-1",
"runnable_main_class": "pkcs12connect.Pkcs12Connect",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_pubsub_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/BasicPubSub",
"sample_region": "us-east-1",
"sample_main_class": "pubsub.PubSub",
"runnable_file": "samples/BasicPubSub",
"runnable_region": "us-east-1",
"runnable_main_class": "pubsub.PubSub",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_shadow_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/Shadow",
"sample_region": "us-east-1",
"sample_main_class": "shadow.ShadowSample",
"runnable_file": "samples/Shadow",
"runnable_region": "us-east-1",
"runnable_main_class": "shadow.ShadowSample",
"arguments": [
{
"name": "--endpoint",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_run_shadow_mqtt5_cfg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"language": "Java",
"sample_file": "samples/Shadow",
"sample_region": "us-east-1",
"sample_main_class": "shadow.Mqtt5ShadowSample",
"runnable_file": "samples/Shadow",
"runnable_region": "us-east-1",
"runnable_main_class": "shadow.Mqtt5ShadowSample",
"arguments": [
{
"name": "--endpoint",
Expand Down
Loading

0 comments on commit 15fdb8d

Please sign in to comment.